mcp-adr-analysis-server 2.7.23 → 2.7.25

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 (42) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/src/tools/bootstrap-validation-loop-tool.d.ts +0 -178
  3. package/dist/src/tools/bootstrap-validation-loop-tool.d.ts.map +1 -1
  4. package/dist/src/tools/bootstrap-validation-loop-tool.js +0 -1580
  5. package/dist/src/tools/bootstrap-validation-loop-tool.js.map +1 -1
  6. package/dist/src/tools/deployment-guidance-tool.d.ts +19 -1
  7. package/dist/src/tools/deployment-guidance-tool.d.ts.map +1 -1
  8. package/dist/src/tools/deployment-guidance-tool.js +9 -4
  9. package/dist/src/tools/deployment-guidance-tool.js.map +1 -1
  10. package/package.json +1 -2
  11. package/dist/src/utils/dag-executor.d.ts +0 -106
  12. package/dist/src/utils/dag-executor.d.ts.map +0 -1
  13. package/dist/src/utils/dag-executor.js +0 -453
  14. package/dist/src/utils/dag-executor.js.map +0 -1
  15. package/dist/src/utils/deployment-task-integration.d.ts +0 -260
  16. package/dist/src/utils/deployment-task-integration.d.ts.map +0 -1
  17. package/dist/src/utils/deployment-task-integration.js +0 -393
  18. package/dist/src/utils/deployment-task-integration.js.map +0 -1
  19. package/dist/src/utils/dynamic-deployment-intelligence.d.ts +0 -117
  20. package/dist/src/utils/dynamic-deployment-intelligence.d.ts.map +0 -1
  21. package/dist/src/utils/dynamic-deployment-intelligence.js +0 -445
  22. package/dist/src/utils/dynamic-deployment-intelligence.js.map +0 -1
  23. package/dist/src/utils/pattern-contribution-helper.d.ts +0 -60
  24. package/dist/src/utils/pattern-contribution-helper.d.ts.map +0 -1
  25. package/dist/src/utils/pattern-contribution-helper.js +0 -308
  26. package/dist/src/utils/pattern-contribution-helper.js.map +0 -1
  27. package/dist/src/utils/pattern-loader.d.ts +0 -183
  28. package/dist/src/utils/pattern-loader.d.ts.map +0 -1
  29. package/dist/src/utils/pattern-loader.js +0 -198
  30. package/dist/src/utils/pattern-loader.js.map +0 -1
  31. package/dist/src/utils/pattern-to-dag-converter.d.ts +0 -62
  32. package/dist/src/utils/pattern-to-dag-converter.d.ts.map +0 -1
  33. package/dist/src/utils/pattern-to-dag-converter.js +0 -265
  34. package/dist/src/utils/pattern-to-dag-converter.js.map +0 -1
  35. package/dist/src/utils/resource-extractor.d.ts +0 -57
  36. package/dist/src/utils/resource-extractor.d.ts.map +0 -1
  37. package/dist/src/utils/resource-extractor.js +0 -323
  38. package/dist/src/utils/resource-extractor.js.map +0 -1
  39. package/dist/src/utils/system-card-manager.d.ts +0 -194
  40. package/dist/src/utils/system-card-manager.d.ts.map +0 -1
  41. package/dist/src/utils/system-card-manager.js +0 -336
  42. package/dist/src/utils/system-card-manager.js.map +0 -1
@@ -1,198 +0,0 @@
1
- import { promises as fs } from 'fs';
2
- import * as path from 'path';
3
- import * as yaml from 'js-yaml';
4
- import { EnhancedLogger } from './enhanced-logging.js';
5
- import { getCurrentDirCompat } from './directory-compat.js';
6
- /**
7
- * Loads and manages dynamic patterns from YAML files
8
- */
9
- export class PatternLoader {
10
- logger;
11
- patternsDir;
12
- cache = new Map();
13
- constructor(patternsDir) {
14
- this.logger = new EnhancedLogger();
15
- // Default to patterns/ directory at project root
16
- const currentDir = getCurrentDirCompat(import.meta.url);
17
- this.patternsDir = patternsDir || path.join(currentDir, '../../patterns');
18
- }
19
- /**
20
- * Load a pattern from YAML file by ID
21
- * @param patternId - Pattern identifier (filename without .yaml)
22
- * @returns Loaded pattern or null if not found
23
- */
24
- async loadPattern(patternId) {
25
- // Check cache first
26
- if (this.cache.has(patternId)) {
27
- this.logger.info(`Loading pattern from cache: ${patternId}`, 'PatternLoader');
28
- return this.cache.get(patternId);
29
- }
30
- try {
31
- // Search in different directories
32
- const directories = ['composite', 'infrastructure', 'runtime', 'protocol'];
33
- for (const dir of directories) {
34
- const filePath = path.join(this.patternsDir, dir, `${patternId}.yaml`);
35
- try {
36
- const content = await fs.readFile(filePath, 'utf-8');
37
- const pattern = yaml.load(content);
38
- // Validate pattern
39
- this.validatePattern(pattern);
40
- // Cache it
41
- this.cache.set(patternId, pattern);
42
- this.logger.info(`Loaded pattern: ${patternId} (${pattern.name})`, 'PatternLoader');
43
- return pattern;
44
- }
45
- catch (error) {
46
- if (error.code === 'ENOENT') {
47
- // File not found in this directory, continue to next
48
- continue;
49
- }
50
- // Other error, re-throw
51
- throw error;
52
- }
53
- }
54
- this.logger.warn(`Pattern not found: ${patternId}`, 'PatternLoader');
55
- return null;
56
- }
57
- catch (error) {
58
- this.logger.error(`Failed to load pattern: ${patternId}`, 'PatternLoader', error);
59
- return null;
60
- }
61
- }
62
- /**
63
- * Load pattern by composition (infrastructure + runtime)
64
- * @param infrastructure - Infrastructure platform
65
- * @param runtime - Runtime environment (optional)
66
- * @returns Loaded pattern or null if not found
67
- */
68
- async loadPatternByComposition(infrastructure, runtime) {
69
- // Try composite pattern first (infrastructure-runtime)
70
- if (runtime) {
71
- const compositeId = `${infrastructure}-${runtime}`;
72
- const pattern = await this.loadPattern(compositeId);
73
- if (pattern) {
74
- return pattern;
75
- }
76
- }
77
- // Fallback to infrastructure-only pattern
78
- const infrastructurePattern = await this.loadPattern(infrastructure);
79
- if (infrastructurePattern) {
80
- return infrastructurePattern;
81
- }
82
- return null;
83
- }
84
- /**
85
- * List all available patterns
86
- * @returns Array of pattern IDs
87
- */
88
- async listPatterns() {
89
- const patterns = [];
90
- const directories = ['composite', 'infrastructure', 'runtime', 'protocol'];
91
- for (const dir of directories) {
92
- const dirPath = path.join(this.patternsDir, dir);
93
- try {
94
- const files = await fs.readdir(dirPath);
95
- const yamlFiles = files.filter(f => f.endsWith('.yaml') || f.endsWith('.yml'));
96
- for (const file of yamlFiles) {
97
- const patternId = file.replace(/\.(yaml|yml)$/, '');
98
- patterns.push(patternId);
99
- }
100
- }
101
- catch (error) {
102
- if (error.code === 'ENOENT') {
103
- // Directory doesn't exist, skip
104
- continue;
105
- }
106
- throw error;
107
- }
108
- }
109
- return patterns;
110
- }
111
- /**
112
- * List patterns by category
113
- * @param category - Pattern category (composite, infrastructure, runtime, protocol)
114
- * @returns Array of pattern IDs in that category
115
- */
116
- async listPatternsByCategory(category) {
117
- const dirPath = path.join(this.patternsDir, category);
118
- const patterns = [];
119
- try {
120
- const files = await fs.readdir(dirPath);
121
- const yamlFiles = files.filter(f => f.endsWith('.yaml') || f.endsWith('.yml'));
122
- for (const file of yamlFiles) {
123
- const patternId = file.replace(/\.(yaml|yml)$/, '');
124
- patterns.push(patternId);
125
- }
126
- }
127
- catch (error) {
128
- if (error.code === 'ENOENT') {
129
- return [];
130
- }
131
- throw error;
132
- }
133
- return patterns;
134
- }
135
- /**
136
- * Validate pattern structure
137
- * @param pattern - Pattern to validate
138
- * @throws Error if validation fails
139
- */
140
- validatePattern(pattern) {
141
- // Check required fields
142
- if (!pattern.id || !pattern.name || !pattern.version) {
143
- throw new Error('Pattern missing required fields: id, name, version');
144
- }
145
- // Check authoritative sources
146
- if (!pattern.authoritativeSources || pattern.authoritativeSources.length === 0) {
147
- throw new Error(`Pattern ${pattern.id} must have at least one authoritative source`);
148
- }
149
- // Check deployment phases
150
- if (!pattern.deploymentPhases || pattern.deploymentPhases.length === 0) {
151
- throw new Error(`Pattern ${pattern.id} must have at least one deployment phase`);
152
- }
153
- // Validate URLs in authoritative sources
154
- for (const source of pattern.authoritativeSources) {
155
- try {
156
- new globalThis.URL(source.url);
157
- }
158
- catch {
159
- throw new Error(`Invalid URL in pattern ${pattern.id}: ${source.url}`);
160
- }
161
- }
162
- // Validate base repository URL if present
163
- if (pattern.baseCodeRepository?.url) {
164
- try {
165
- new globalThis.URL(pattern.baseCodeRepository.url);
166
- }
167
- catch {
168
- throw new Error(`Invalid base repository URL in pattern ${pattern.id}: ${pattern.baseCodeRepository.url}`);
169
- }
170
- }
171
- this.logger.info(`Pattern validation passed: ${pattern.id}`, 'PatternLoader');
172
- }
173
- /**
174
- * Clear pattern cache
175
- * Useful for testing or reloading patterns
176
- */
177
- clearCache() {
178
- this.cache.clear();
179
- this.logger.info('Pattern cache cleared', 'PatternLoader');
180
- }
181
- /**
182
- * Get pattern from cache
183
- * @param patternId - Pattern identifier
184
- * @returns Cached pattern or null
185
- */
186
- getCachedPattern(patternId) {
187
- return this.cache.get(patternId) || null;
188
- }
189
- /**
190
- * Check if a pattern is cached
191
- * @param patternId - Pattern identifier
192
- * @returns True if cached
193
- */
194
- isCached(patternId) {
195
- return this.cache.has(patternId);
196
- }
197
- }
198
- //# sourceMappingURL=pattern-loader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pattern-loader.js","sourceRoot":"","sources":["../../../src/utils/pattern-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAoI5D;;GAEG;AACH,MAAM,OAAO,aAAa;IAChB,MAAM,CAAiB;IACvB,WAAW,CAAS;IACpB,KAAK,GAAgC,IAAI,GAAG,EAAE,CAAC;IAEvD,YAAY,WAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QACnC,iDAAiD;QACjD,MAAM,UAAU,GAAG,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAC5E,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,SAAiB;QACjC,oBAAoB;QACpB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EA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CACb,0CAA0C,OAAO,CAAC,EAAE,KAAK,OAAO,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAC1F,CAAC;YACJ,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,8BAA8B,OAAO,CAAC,EAAE,EAAE,EAAE,eAAe,CAAC,CAAC;IAChF,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE,eAAe,CAAC,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CAAC,SAAiB;QAChC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,SAAiB;QACxB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;CACF"}
@@ -1,62 +0,0 @@
1
- /**
2
- * Pattern to DAG Converter
3
- *
4
- * Converts validated patterns (YAML definitions) into executable DAG task nodes
5
- * for the bootstrap validation loop's infrastructure layer.
6
- */
7
- import type { TaskNode } from './dag-executor.js';
8
- import type { DynamicPattern } from './pattern-loader.js';
9
- /**
10
- * Convert validated pattern to infrastructure DAG tasks
11
- */
12
- export declare class PatternToDAGConverter {
13
- private logger;
14
- constructor();
15
- /**
16
- * Build infrastructure DAG tasks from validated pattern
17
- *
18
- * This is the KEY method that auto-generates DAG tasks from pattern YAML
19
- */
20
- buildInfrastructureTasksFromPattern(pattern: DynamicPattern, platform: string): TaskNode[];
21
- /**
22
- * Create dependency installation task
23
- */
24
- private createDependencyInstallTask;
25
- /**
26
- * Create dependency verification task
27
- */
28
- private createDependencyVerificationTask;
29
- /**
30
- * Create tasks from a deployment phase
31
- */
32
- private createTasksFromPhase;
33
- /**
34
- * Create validation check task
35
- */
36
- private createValidationCheckTask;
37
- /**
38
- * Determine if a deployment phase is infrastructure-related
39
- */
40
- private isInfrastructurePhase;
41
- /**
42
- * Determine if a validation check is infrastructure-related
43
- */
44
- private isInfrastructureValidationCheck;
45
- /**
46
- * Map phase prerequisites to task dependencies
47
- */
48
- private mapPrerequisitesToDependencies;
49
- /**
50
- * Create validation check function from validation check definition
51
- */
52
- private createValidationCheckFunction;
53
- /**
54
- * Parse duration string to milliseconds
55
- */
56
- private parseDuration;
57
- /**
58
- * Sanitize task ID (remove special characters)
59
- */
60
- private sanitizeTaskId;
61
- }
62
- //# sourceMappingURL=pattern-to-dag-converter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pattern-to-dag-converter.d.ts","sourceRoot":"","sources":["../../../src/utils/pattern-to-dag-converter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAoC,MAAM,qBAAqB,CAAC;AAG5F;;GAEG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAiB;;IAM/B;;;;OAIG;IACH,mCAAmC,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE;IA0E1F;;OAEG;IACH,OAAO,CAAC,2BAA2B;IA8BnC;;OAEG;IACH,OAAO,CAAC,gCAAgC;IA8BxC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAyC5B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAgCjC;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAe7B;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAgBvC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAuBtC;;OAEG;IACH,OAAO,CAAC,6BAA6B;IA2BrC;;OAEG;IACH,OAAO,CAAC,aAAa;IAiBrB;;OAEG;IACH,OAAO,CAAC,cAAc;CAMvB"}
@@ -1,265 +0,0 @@
1
- /**
2
- * Pattern to DAG Converter
3
- *
4
- * Converts validated patterns (YAML definitions) into executable DAG task nodes
5
- * for the bootstrap validation loop's infrastructure layer.
6
- */
7
- import { EnhancedLogger } from './enhanced-logging.js';
8
- /**
9
- * Convert validated pattern to infrastructure DAG tasks
10
- */
11
- export class PatternToDAGConverter {
12
- logger;
13
- constructor() {
14
- this.logger = new EnhancedLogger();
15
- }
16
- /**
17
- * Build infrastructure DAG tasks from validated pattern
18
- *
19
- * This is the KEY method that auto-generates DAG tasks from pattern YAML
20
- */
21
- buildInfrastructureTasksFromPattern(pattern, platform) {
22
- const tasks = [];
23
- this.logger.info(`🔨 Building infrastructure DAG tasks for platform: ${platform}`, 'PatternToDAGConverter');
24
- // 1. Add dependency installation tasks (highest priority)
25
- if (pattern.dependencies) {
26
- this.logger.info(`📦 Adding ${pattern.dependencies.length} dependency installation tasks`, 'PatternToDAGConverter');
27
- for (const dep of pattern.dependencies) {
28
- if (dep.required) {
29
- // Install task
30
- if (dep.installCommand) {
31
- const installTask = this.createDependencyInstallTask(dep, platform);
32
- tasks.push(installTask);
33
- }
34
- // Verification task
35
- if (dep.verificationCommand) {
36
- const verifyTask = this.createDependencyVerificationTask(dep, platform);
37
- tasks.push(verifyTask);
38
- }
39
- }
40
- }
41
- }
42
- // 2. Build tasks from deploymentPhases (core infrastructure setup)
43
- if (pattern.deploymentPhases) {
44
- this.logger.info(`🏗️ Processing ${pattern.deploymentPhases.length} deployment phases`, 'PatternToDAGConverter');
45
- for (const phase of pattern.deploymentPhases) {
46
- const isInfraPhase = this.isInfrastructurePhase(phase);
47
- if (isInfraPhase) {
48
- const phaseTasks = this.createTasksFromPhase(phase, pattern, platform);
49
- tasks.push(...phaseTasks);
50
- }
51
- }
52
- }
53
- // 3. Add validation checks as DAG tasks
54
- if (pattern.validationChecks) {
55
- this.logger.info(`✅ Adding ${pattern.validationChecks.length} validation check tasks`, 'PatternToDAGConverter');
56
- for (const check of pattern.validationChecks) {
57
- const isInfraCheck = this.isInfrastructureValidationCheck(check);
58
- if (isInfraCheck) {
59
- const checkTask = this.createValidationCheckTask(check, tasks, platform);
60
- tasks.push(checkTask);
61
- }
62
- }
63
- }
64
- this.logger.info(`✅ Generated ${tasks.length} infrastructure DAG tasks from pattern`, 'PatternToDAGConverter');
65
- return tasks;
66
- }
67
- /**
68
- * Create dependency installation task
69
- */
70
- createDependencyInstallTask(dependency, platform) {
71
- const cmd = dependency.installCommand;
72
- const parts = cmd.split(' ').filter(p => p.trim());
73
- const task = {
74
- id: `${platform}-install-${this.sanitizeTaskId(dependency.name)}`,
75
- name: `Install ${dependency.name}`,
76
- description: `Install required dependency: ${dependency.name}`,
77
- commandArgs: parts.slice(1),
78
- expectedExitCode: 0,
79
- dependsOn: [],
80
- category: 'infrastructure',
81
- severity: 'critical',
82
- timeout: 120000, // 2 minutes for installations
83
- };
84
- if (parts[0]) {
85
- task.command = parts[0];
86
- }
87
- return task;
88
- }
89
- /**
90
- * Create dependency verification task
91
- */
92
- createDependencyVerificationTask(dependency, platform) {
93
- const cmd = dependency.verificationCommand;
94
- const parts = cmd.split(' ').filter(p => p.trim());
95
- const task = {
96
- id: `${platform}-verify-${this.sanitizeTaskId(dependency.name)}`,
97
- name: `Verify ${dependency.name}`,
98
- description: `Verify ${dependency.name} is properly installed`,
99
- commandArgs: parts.slice(1),
100
- expectedExitCode: 0,
101
- dependsOn: [`${platform}-install-${this.sanitizeTaskId(dependency.name)}`],
102
- category: 'infrastructure',
103
- severity: 'critical',
104
- timeout: 30000,
105
- };
106
- if (parts[0]) {
107
- task.command = parts[0];
108
- }
109
- return task;
110
- }
111
- /**
112
- * Create tasks from a deployment phase
113
- */
114
- createTasksFromPhase(phase, pattern, platform) {
115
- const tasks = [];
116
- for (const cmd of phase.commands) {
117
- const taskId = `${platform}-phase-${phase.order}-${this.sanitizeTaskId(cmd.description)}`;
118
- const parts = cmd.command.split(' ').filter(p => p.trim());
119
- // Map phase prerequisites to task dependencies
120
- const dependencies = this.mapPrerequisitesToDependencies(phase.prerequisites, pattern.deploymentPhases, platform);
121
- const task = {
122
- id: taskId,
123
- name: cmd.description,
124
- description: cmd.description,
125
- commandArgs: parts.slice(1),
126
- expectedExitCode: cmd.expectedExitCode ?? 0,
127
- dependsOn: dependencies,
128
- category: 'infrastructure',
129
- severity: phase.order === 1 ? 'critical' : 'error',
130
- timeout: this.parseDuration(phase.estimatedDuration),
131
- canFailSafely: phase.order > 2, // Later phases can fail without stopping
132
- };
133
- if (parts[0]) {
134
- task.command = parts[0];
135
- }
136
- tasks.push(task);
137
- }
138
- return tasks;
139
- }
140
- /**
141
- * Create validation check task
142
- */
143
- createValidationCheckTask(check, existingTasks, platform) {
144
- const parts = check.command.split(' ').filter(p => p.trim());
145
- // Validation checks depend on all deployment tasks
146
- const deploymentTaskIds = existingTasks
147
- .filter(t => t.category === 'infrastructure' && !t.id.startsWith(`${platform}-validate-`))
148
- .map(t => t.id);
149
- const task = {
150
- id: `${platform}-validate-${check.id}`,
151
- name: check.name,
152
- description: check.description,
153
- commandArgs: parts.slice(1),
154
- expectedExitCode: check.expectedExitCode ?? 0,
155
- dependsOn: deploymentTaskIds,
156
- category: 'infrastructure',
157
- severity: check.severity,
158
- timeout: 30000,
159
- validationCheck: this.createValidationCheckFunction(check),
160
- };
161
- if (parts[0]) {
162
- task.command = parts[0];
163
- }
164
- return task;
165
- }
166
- /**
167
- * Determine if a deployment phase is infrastructure-related
168
- */
169
- isInfrastructurePhase(phase) {
170
- const name = phase.name.toLowerCase();
171
- return (name.includes('infrastructure') ||
172
- name.includes('prerequisite') ||
173
- name.includes('setup') ||
174
- name.includes('namespace') ||
175
- name.includes('validation') ||
176
- name.includes('cluster') ||
177
- name.includes('environment') ||
178
- phase.order <= 2 // First 2 phases are typically infrastructure
179
- );
180
- }
181
- /**
182
- * Determine if a validation check is infrastructure-related
183
- */
184
- isInfrastructureValidationCheck(check) {
185
- const id = check.id.toLowerCase();
186
- const name = check.name.toLowerCase();
187
- return (id.includes('cluster') ||
188
- id.includes('node') ||
189
- id.includes('connection') ||
190
- id.includes('infrastructure') ||
191
- name.includes('cluster') ||
192
- name.includes('node') ||
193
- name.includes('connectivity') ||
194
- check.severity === 'critical');
195
- }
196
- /**
197
- * Map phase prerequisites to task dependencies
198
- */
199
- mapPrerequisitesToDependencies(prerequisites, allPhases, platform) {
200
- const dependencies = [];
201
- for (const prereq of prerequisites) {
202
- // Find the phase with this name
203
- const phase = allPhases.find(p => p.name === prereq);
204
- if (phase) {
205
- // Add all tasks from that phase as dependencies
206
- for (const cmd of phase.commands) {
207
- const taskId = `${platform}-phase-${phase.order}-${this.sanitizeTaskId(cmd.description)}`;
208
- dependencies.push(taskId);
209
- }
210
- }
211
- }
212
- return dependencies;
213
- }
214
- /**
215
- * Create validation check function from validation check definition
216
- */
217
- createValidationCheckFunction(check) {
218
- return (output) => {
219
- const outputLower = output.toLowerCase();
220
- // Check for explicit failure keywords
221
- const failureKeywords = ['error', 'failed', 'not found', 'cannot', 'unable', 'denied'];
222
- const hasFailure = failureKeywords.some(keyword => outputLower.includes(keyword));
223
- if (hasFailure) {
224
- return false;
225
- }
226
- // Check for success indicators based on check type
227
- if (check.id.includes('deployment') || check.id.includes('ready')) {
228
- return outputLower.includes('ready') || outputLower.includes('running');
229
- }
230
- if (check.id.includes('endpoint') || check.id.includes('service')) {
231
- // Service endpoints should have IP addresses
232
- return /\d+\.\d+\.\d+\.\d+/.test(output);
233
- }
234
- // Default: no failure keywords = success
235
- return true;
236
- };
237
- }
238
- /**
239
- * Parse duration string to milliseconds
240
- */
241
- parseDuration(duration) {
242
- const match = duration.match(/(\d+)\s*(minutes?|mins?|seconds?|secs?)/i);
243
- if (!match || !match[1] || !match[2]) {
244
- return 30000; // Default 30 seconds
245
- }
246
- const value = parseInt(match[1], 10);
247
- const unit = match[2].toLowerCase();
248
- if (unit.startsWith('min')) {
249
- return value * 60 * 1000;
250
- }
251
- else {
252
- return value * 1000;
253
- }
254
- }
255
- /**
256
- * Sanitize task ID (remove special characters)
257
- */
258
- sanitizeTaskId(description) {
259
- return description
260
- .toLowerCase()
261
- .replace(/[^a-z0-9]+/g, '-')
262
- .replace(/^-|-$/g, '');
263
- }
264
- }
265
- //# sourceMappingURL=pattern-to-dag-converter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pattern-to-dag-converter.js","sourceRoot":"","sources":["../../../src/utils/pattern-to-dag-converter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,qBAAqB;IACxB,MAAM,CAAiB;IAE/B;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,mCAAmC,CAAC,OAAuB,EAAE,QAAgB;QAC3E,MAAM,KAAK,GAAe,EAAE,CAAC;QAE7B,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,sDAAsD,QAAQ,EAAE,EAChE,uBAAuB,CACxB,CAAC;QAEF,0DAA0D;QAC1D,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,aAAa,OAAO,CAAC,YAAY,CAAC,MAAM,gCAAgC,EACxE,uBAAuB,CACxB,CAAC;YAEF,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;gBACvC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;oBACjB,eAAe;oBACf,IAAI,GAAG,CAAC,cAAc,EAAE,CAAC;wBACvB,MAAM,WAAW,GAAG,IAAI,CAAC,2BAA2B,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;wBACpE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBAC1B,CAAC;oBAED,oBAAoB;oBACpB,IAAI,GAAG,CAAC,mBAAmB,EAAE,CAAC;wBAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,gCAAgC,CA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KAAK,GAAG,EAAE,GAAG,IAAI,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,OAAO,KAAK,GAAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;IAED;;OAEG;IACK,cAAc,CAAC,WAAmB;QACxC,OAAO,WAAW;aACf,WAAW,EAAE;aACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;aAC3B,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC3B,CAAC;CACF"}
@@ -1,57 +0,0 @@
1
- import { ResourceRecord } from './system-card-manager.js';
2
- /**
3
- * Extraction pattern for parsing command outputs
4
- */
5
- export interface ExtractionPattern {
6
- resourceType: ResourceRecord['type'];
7
- commandPattern: RegExp;
8
- outputPattern: RegExp;
9
- extractionFunction: (matches: RegExpMatchArray, command: string) => Partial<ResourceRecord>;
10
- }
11
- /**
12
- * Resource extraction result
13
- */
14
- export interface ExtractionResult {
15
- resources: ResourceRecord[];
16
- confidence: number;
17
- warnings: string[];
18
- }
19
- /**
20
- * Extracts resource information from command outputs
21
- * Supports kubectl, oc, docker, and other infrastructure commands
22
- */
23
- export declare class ResourceExtractor {
24
- private logger;
25
- private patterns;
26
- constructor();
27
- /**
28
- * Extract resources from a command and its output
29
- */
30
- extract(command: string, stdout: string, stderr: string, taskId: string): ExtractionResult;
31
- /**
32
- * Initialize extraction patterns for different commands
33
- */
34
- private initializePatterns;
35
- /**
36
- * Generate cleanup command for a resource
37
- */
38
- private generateCleanupCommand;
39
- /**
40
- * Extract multiple resources from batch command output
41
- */
42
- extractBatch(commands: Array<{
43
- command: string;
44
- stdout: string;
45
- stderr: string;
46
- taskId: string;
47
- }>): ResourceRecord[];
48
- /**
49
- * Add a custom extraction pattern
50
- */
51
- addPattern(pattern: ExtractionPattern): void;
52
- /**
53
- * Get all registered patterns
54
- */
55
- getPatterns(): ExtractionPattern[];
56
- }
57
- //# sourceMappingURL=resource-extractor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource-extractor.d.ts","sourceRoot":"","sources":["../../../src/utils/resource-extractor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CAC7F;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,QAAQ,CAAsB;;IAOtC;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB;IAwE1F;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAwM1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAoD9B;;OAEG;IACH,YAAY,CACV,QAAQ,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,GACnF,cAAc,EAAE;IAkBnB;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAQ5C;;OAEG;IACH,WAAW,IAAI,iBAAiB,EAAE;CAGnC"}