@angular-modernizer/adapter-mcp 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +917 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +129 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/project-analyzer.d.ts +59 -0
- package/dist/core/project-analyzer.d.ts.map +1 -0
- package/dist/core/project-analyzer.js +116 -0
- package/dist/core/project-analyzer.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-watcher.d.ts +119 -0
- package/dist/mcp-watcher.d.ts.map +1 -0
- package/dist/mcp-watcher.js +380 -0
- package/dist/mcp-watcher.js.map +1 -0
- package/dist/server/json-rpc-handler.d.ts +57 -0
- package/dist/server/json-rpc-handler.d.ts.map +1 -0
- package/dist/server/json-rpc-handler.js +222 -0
- package/dist/server/json-rpc-handler.js.map +1 -0
- package/dist/server/mcp-server.d.ts +62 -0
- package/dist/server/mcp-server.d.ts.map +1 -0
- package/dist/server/mcp-server.js +184 -0
- package/dist/server/mcp-server.js.map +1 -0
- package/dist/server/tool-registry.d.ts +73 -0
- package/dist/server/tool-registry.d.ts.map +1 -0
- package/dist/server/tool-registry.js +102 -0
- package/dist/server/tool-registry.js.map +1 -0
- package/dist/streaming/progress-store.d.ts +120 -0
- package/dist/streaming/progress-store.d.ts.map +1 -0
- package/dist/streaming/progress-store.js +238 -0
- package/dist/streaming/progress-store.js.map +1 -0
- package/dist/tools/analyze-build-impact.d.ts +127 -0
- package/dist/tools/analyze-build-impact.d.ts.map +1 -0
- package/dist/tools/analyze-build-impact.js +194 -0
- package/dist/tools/analyze-build-impact.js.map +1 -0
- package/dist/tools/analyze-core-to-shared.d.ts +163 -0
- package/dist/tools/analyze-core-to-shared.d.ts.map +1 -0
- package/dist/tools/analyze-core-to-shared.js +436 -0
- package/dist/tools/analyze-core-to-shared.js.map +1 -0
- package/dist/tools/analyze-parser-performance.d.ts +105 -0
- package/dist/tools/analyze-parser-performance.d.ts.map +1 -0
- package/dist/tools/analyze-parser-performance.js +313 -0
- package/dist/tools/analyze-parser-performance.js.map +1 -0
- package/dist/tools/analyze-project.d.ts +277 -0
- package/dist/tools/analyze-project.d.ts.map +1 -0
- package/dist/tools/analyze-project.js +946 -0
- package/dist/tools/analyze-project.js.map +1 -0
- package/dist/tools/check-incremental-compatibility.d.ts +109 -0
- package/dist/tools/check-incremental-compatibility.d.ts.map +1 -0
- package/dist/tools/check-incremental-compatibility.js +302 -0
- package/dist/tools/check-incremental-compatibility.js.map +1 -0
- package/dist/tools/collect-feedback.d.ts +117 -0
- package/dist/tools/collect-feedback.d.ts.map +1 -0
- package/dist/tools/collect-feedback.js +773 -0
- package/dist/tools/collect-feedback.js.map +1 -0
- package/dist/tools/extract-libraries.d.ts +121 -0
- package/dist/tools/extract-libraries.d.ts.map +1 -0
- package/dist/tools/extract-libraries.js +223 -0
- package/dist/tools/extract-libraries.js.map +1 -0
- package/dist/tools/find-angular-symbol.d.ts +55 -0
- package/dist/tools/find-angular-symbol.d.ts.map +1 -0
- package/dist/tools/find-angular-symbol.js +104 -0
- package/dist/tools/find-angular-symbol.js.map +1 -0
- package/dist/tools/find-usages.d.ts +65 -0
- package/dist/tools/find-usages.d.ts.map +1 -0
- package/dist/tools/find-usages.js +108 -0
- package/dist/tools/find-usages.js.map +1 -0
- package/dist/tools/get-call-graph.d.ts +61 -0
- package/dist/tools/get-call-graph.d.ts.map +1 -0
- package/dist/tools/get-call-graph.js +119 -0
- package/dist/tools/get-call-graph.js.map +1 -0
- package/dist/tools/get-operation-progress-tool.d.ts +29 -0
- package/dist/tools/get-operation-progress-tool.d.ts.map +1 -0
- package/dist/tools/get-operation-progress-tool.js +36 -0
- package/dist/tools/get-operation-progress-tool.js.map +1 -0
- package/dist/tools/get-operation-progress.d.ts +51 -0
- package/dist/tools/get-operation-progress.d.ts.map +1 -0
- package/dist/tools/get-operation-progress.js +93 -0
- package/dist/tools/get-operation-progress.js.map +1 -0
- package/dist/tools/helpers/feedback-analyzer.d.ts +43 -0
- package/dist/tools/helpers/feedback-analyzer.d.ts.map +1 -0
- package/dist/tools/helpers/feedback-analyzer.js +196 -0
- package/dist/tools/helpers/feedback-analyzer.js.map +1 -0
- package/dist/tools/helpers/find-ts-config.d.ts +10 -0
- package/dist/tools/helpers/find-ts-config.d.ts.map +1 -0
- package/dist/tools/helpers/find-ts-config.js +32 -0
- package/dist/tools/helpers/find-ts-config.js.map +1 -0
- package/dist/tools/helpers/platform-root-resolver.d.ts +33 -0
- package/dist/tools/helpers/platform-root-resolver.d.ts.map +1 -0
- package/dist/tools/helpers/platform-root-resolver.js +60 -0
- package/dist/tools/helpers/platform-root-resolver.js.map +1 -0
- package/dist/tools/helpers/rule-matcher.d.ts +84 -0
- package/dist/tools/helpers/rule-matcher.d.ts.map +1 -0
- package/dist/tools/helpers/rule-matcher.js +212 -0
- package/dist/tools/helpers/rule-matcher.js.map +1 -0
- package/dist/tools/helpers/suggestion-generator.d.ts +66 -0
- package/dist/tools/helpers/suggestion-generator.d.ts.map +1 -0
- package/dist/tools/helpers/suggestion-generator.js +248 -0
- package/dist/tools/helpers/suggestion-generator.js.map +1 -0
- package/dist/tools/learn-patterns.d.ts +368 -0
- package/dist/tools/learn-patterns.d.ts.map +1 -0
- package/dist/tools/learn-patterns.js +1089 -0
- package/dist/tools/learn-patterns.js.map +1 -0
- package/dist/tools/orchestrate-migration.d.ts +187 -0
- package/dist/tools/orchestrate-migration.d.ts.map +1 -0
- package/dist/tools/orchestrate-migration.js +235 -0
- package/dist/tools/orchestrate-migration.js.map +1 -0
- package/dist/tools/parse-stack-trace.d.ts +63 -0
- package/dist/tools/parse-stack-trace.d.ts.map +1 -0
- package/dist/tools/parse-stack-trace.js +92 -0
- package/dist/tools/parse-stack-trace.js.map +1 -0
- package/dist/tools/plan-migration.d.ts +388 -0
- package/dist/tools/plan-migration.d.ts.map +1 -0
- package/dist/tools/plan-migration.js +826 -0
- package/dist/tools/plan-migration.js.map +1 -0
- package/dist/tools/resolve-type.d.ts +54 -0
- package/dist/tools/resolve-type.d.ts.map +1 -0
- package/dist/tools/resolve-type.js +101 -0
- package/dist/tools/resolve-type.js.map +1 -0
- package/dist/tools/review-feedback.d.ts +124 -0
- package/dist/tools/review-feedback.d.ts.map +1 -0
- package/dist/tools/review-feedback.js +276 -0
- package/dist/tools/review-feedback.js.map +1 -0
- package/dist/tools/rollback-changes.d.ts +42 -0
- package/dist/tools/rollback-changes.d.ts.map +1 -0
- package/dist/tools/rollback-changes.js +95 -0
- package/dist/tools/rollback-changes.js.map +1 -0
- package/dist/tools/run-angular-cli.d.ts +102 -0
- package/dist/tools/run-angular-cli.d.ts.map +1 -0
- package/dist/tools/run-angular-cli.js +152 -0
- package/dist/tools/run-angular-cli.js.map +1 -0
- package/dist/tools/run-build.d.ts +201 -0
- package/dist/tools/run-build.d.ts.map +1 -0
- package/dist/tools/run-build.js +554 -0
- package/dist/tools/run-build.js.map +1 -0
- package/dist/tools/run-schematic.d.ts +173 -0
- package/dist/tools/run-schematic.d.ts.map +1 -0
- package/dist/tools/run-schematic.js +410 -0
- package/dist/tools/run-schematic.js.map +1 -0
- package/dist/tools/scan-all.d.ts +160 -0
- package/dist/tools/scan-all.d.ts.map +1 -0
- package/dist/tools/scan-all.js +486 -0
- package/dist/tools/scan-all.js.map +1 -0
- package/dist/tools/scan-angular.d.ts +132 -0
- package/dist/tools/scan-angular.d.ts.map +1 -0
- package/dist/tools/scan-angular.js +411 -0
- package/dist/tools/scan-angular.js.map +1 -0
- package/dist/tools/scan-architecture.d.ts +351 -0
- package/dist/tools/scan-architecture.d.ts.map +1 -0
- package/dist/tools/scan-architecture.js +1290 -0
- package/dist/tools/scan-architecture.js.map +1 -0
- package/dist/tools/scan-solid.d.ts +132 -0
- package/dist/tools/scan-solid.d.ts.map +1 -0
- package/dist/tools/scan-solid.js +435 -0
- package/dist/tools/scan-solid.js.map +1 -0
- package/dist/tools/search-codebase.d.ts +64 -0
- package/dist/tools/search-codebase.d.ts.map +1 -0
- package/dist/tools/search-codebase.js +109 -0
- package/dist/tools/search-codebase.js.map +1 -0
- package/dist/tools/shared/scan-types.d.ts +200 -0
- package/dist/tools/shared/scan-types.d.ts.map +1 -0
- package/dist/tools/shared/scan-types.js +7 -0
- package/dist/tools/shared/scan-types.js.map +1 -0
- package/dist/tools/suggest-improvements.d.ts +96 -0
- package/dist/tools/suggest-improvements.d.ts.map +1 -0
- package/dist/tools/suggest-improvements.js +182 -0
- package/dist/tools/suggest-improvements.js.map +1 -0
- package/dist/tools/transform-code-batch.d.ts +57 -0
- package/dist/tools/transform-code-batch.d.ts.map +1 -0
- package/dist/tools/transform-code-batch.js +107 -0
- package/dist/tools/transform-code-batch.js.map +1 -0
- package/dist/tools/transform-code.d.ts +352 -0
- package/dist/tools/transform-code.d.ts.map +1 -0
- package/dist/tools/transform-code.js +1171 -0
- package/dist/tools/transform-code.js.map +1 -0
- package/dist/tools/validate-before-transform.d.ts +54 -0
- package/dist/tools/validate-before-transform.d.ts.map +1 -0
- package/dist/tools/validate-before-transform.js +141 -0
- package/dist/tools/validate-before-transform.js.map +1 -0
- package/dist/tools/validate-project-compatibility.d.ts +119 -0
- package/dist/tools/validate-project-compatibility.d.ts.map +1 -0
- package/dist/tools/validate-project-compatibility.js +243 -0
- package/dist/tools/validate-project-compatibility.js.map +1 -0
- package/dist/tools/validate-transformation.d.ts +105 -0
- package/dist/tools/validate-transformation.d.ts.map +1 -0
- package/dist/tools/validate-transformation.js +391 -0
- package/dist/tools/validate-transformation.js.map +1 -0
- package/dist/types.d.ts +153 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +38 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/format-tool-response.d.ts +72 -0
- package/dist/utils/format-tool-response.d.ts.map +1 -0
- package/dist/utils/format-tool-response.js +149 -0
- package/dist/utils/format-tool-response.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Feedback Analyzer Helper
|
|
3
|
+
*
|
|
4
|
+
* Pattern analysis utilities for transformation feedback.
|
|
5
|
+
* Detects success patterns, failure patterns, and quality trends.
|
|
6
|
+
*
|
|
7
|
+
* Analysis Criteria:
|
|
8
|
+
* - Success patterns: ≥3 occurrences, ≥80% success rate, high confidence
|
|
9
|
+
* - Failure patterns: ≥2 occurrences, recommend avoiding
|
|
10
|
+
* - Quality trends: Identify degraded quality, suggest review
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Analyze patterns in transformation feedback
|
|
14
|
+
*
|
|
15
|
+
* @param feedback - Array of transformation feedback to analyze
|
|
16
|
+
* @param analysisType - Type of analysis to perform
|
|
17
|
+
* @param minConfidence - Minimum confidence threshold (0.0-1.0)
|
|
18
|
+
* @returns Array of feedback insights sorted by confidence
|
|
19
|
+
*/
|
|
20
|
+
export function analyzePatterns(feedback, analysisType, minConfidence) {
|
|
21
|
+
if (feedback.length === 0) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
// Aggregate feedback by pattern
|
|
25
|
+
const aggregated = aggregateFeedback(feedback);
|
|
26
|
+
const insights = [];
|
|
27
|
+
// Analyze based on type
|
|
28
|
+
if (analysisType === 'success-patterns' || analysisType === 'all') {
|
|
29
|
+
insights.push(...detectSuccessPatterns(aggregated, minConfidence));
|
|
30
|
+
}
|
|
31
|
+
if (analysisType === 'failure-patterns' || analysisType === 'all') {
|
|
32
|
+
insights.push(...detectFailurePatterns(aggregated, minConfidence));
|
|
33
|
+
}
|
|
34
|
+
if (analysisType === 'quality-trends' || analysisType === 'all') {
|
|
35
|
+
insights.push(...detectQualityTrends(aggregated, minConfidence));
|
|
36
|
+
}
|
|
37
|
+
// Sort by confidence (descending)
|
|
38
|
+
insights.sort((a, b) => b.confidence - a.confidence);
|
|
39
|
+
return insights;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Aggregate feedback by pattern (rule category + file type)
|
|
43
|
+
*/
|
|
44
|
+
function aggregateFeedback(feedback) {
|
|
45
|
+
const aggregated = new Map();
|
|
46
|
+
for (const f of feedback) {
|
|
47
|
+
// Pattern key: rule category + file type
|
|
48
|
+
const pattern = `${f.rule.category}:${f.target.fileType}`;
|
|
49
|
+
if (!aggregated.has(pattern)) {
|
|
50
|
+
aggregated.set(pattern, {
|
|
51
|
+
pattern,
|
|
52
|
+
transformations: [],
|
|
53
|
+
successful: 0,
|
|
54
|
+
failed: 0,
|
|
55
|
+
successRate: 0,
|
|
56
|
+
avgConfidence: 0,
|
|
57
|
+
qualityImpact: 'unchanged',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const agg = aggregated.get(pattern);
|
|
61
|
+
if (!agg) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
agg.transformations.push(f);
|
|
65
|
+
if (f.outcome.status === 'success') {
|
|
66
|
+
agg.successful++;
|
|
67
|
+
}
|
|
68
|
+
else if (f.outcome.status === 'failure') {
|
|
69
|
+
agg.failed++;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Calculate metrics
|
|
73
|
+
for (const agg of aggregated.values()) {
|
|
74
|
+
const total = agg.transformations.length;
|
|
75
|
+
agg.successRate = total > 0 ? agg.successful / total : 0;
|
|
76
|
+
agg.avgConfidence =
|
|
77
|
+
total > 0
|
|
78
|
+
? agg.transformations.reduce((sum, f) => sum + f.decision.confidence, 0) / total
|
|
79
|
+
: 0;
|
|
80
|
+
// Determine quality impact
|
|
81
|
+
const qualityCounts = {
|
|
82
|
+
improved: agg.transformations.filter((f) => f.outcome.quality === 'improved').length,
|
|
83
|
+
unchanged: agg.transformations.filter((f) => f.outcome.quality === 'unchanged').length,
|
|
84
|
+
degraded: agg.transformations.filter((f) => f.outcome.quality === 'degraded').length,
|
|
85
|
+
};
|
|
86
|
+
if (qualityCounts.improved > qualityCounts.degraded) {
|
|
87
|
+
agg.qualityImpact = 'improved';
|
|
88
|
+
}
|
|
89
|
+
else if (qualityCounts.degraded > qualityCounts.improved) {
|
|
90
|
+
agg.qualityImpact = 'degraded';
|
|
91
|
+
}
|
|
92
|
+
else if (qualityCounts.improved === qualityCounts.degraded &&
|
|
93
|
+
qualityCounts.improved > 0) {
|
|
94
|
+
agg.qualityImpact = 'mixed';
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
agg.qualityImpact = 'unchanged';
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return aggregated;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Detect success patterns (≥3 occurrences, ≥80% success rate)
|
|
104
|
+
*/
|
|
105
|
+
function detectSuccessPatterns(aggregated, minConfidence) {
|
|
106
|
+
const insights = [];
|
|
107
|
+
for (const agg of aggregated.values()) {
|
|
108
|
+
// Success pattern criteria: ≥3 occurrences, ≥80% success rate, high confidence
|
|
109
|
+
if (agg.transformations.length >= 3 &&
|
|
110
|
+
agg.successRate >= 0.8 &&
|
|
111
|
+
agg.avgConfidence >= minConfidence) {
|
|
112
|
+
insights.push({
|
|
113
|
+
type: 'success-pattern',
|
|
114
|
+
pattern: agg.pattern,
|
|
115
|
+
occurrences: agg.transformations.length,
|
|
116
|
+
successRate: agg.successRate,
|
|
117
|
+
confidence: agg.avgConfidence,
|
|
118
|
+
description: `Pattern '${agg.pattern}' has consistently succeeded with ${(agg.successRate * 100).toFixed(0)}% success rate across ${agg.transformations.length} transformations`,
|
|
119
|
+
recommendation: `Continue using this approach for ${agg.pattern} transformations. High confidence and success rate indicate reliable pattern.`,
|
|
120
|
+
examples: agg.transformations
|
|
121
|
+
.slice(0, 3)
|
|
122
|
+
.map((f) => f.transformationId),
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return insights;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Detect failure patterns (≥2 occurrences)
|
|
130
|
+
*/
|
|
131
|
+
function detectFailurePatterns(aggregated, _minConfidence) {
|
|
132
|
+
const insights = [];
|
|
133
|
+
for (const agg of aggregated.values()) {
|
|
134
|
+
// Failure pattern criteria: ≥2 occurrences, <50% success rate
|
|
135
|
+
if (agg.failed >= 2 && agg.successRate < 0.5) {
|
|
136
|
+
const avgConfidence = Math.max(agg.avgConfidence, 0.5); // Boost confidence for clear failures
|
|
137
|
+
insights.push({
|
|
138
|
+
type: 'failure-pattern',
|
|
139
|
+
pattern: agg.pattern,
|
|
140
|
+
occurrences: agg.failed,
|
|
141
|
+
successRate: agg.successRate,
|
|
142
|
+
confidence: avgConfidence,
|
|
143
|
+
description: `Pattern '${agg.pattern}' has failed ${agg.failed} times with only ${(agg.successRate * 100).toFixed(0)}% success rate`,
|
|
144
|
+
recommendation: `Avoid this approach for ${agg.pattern} transformations. Consider alternative patterns or pre-transformation validation.`,
|
|
145
|
+
examples: agg.transformations
|
|
146
|
+
.filter((f) => f.outcome.status === 'failure')
|
|
147
|
+
.slice(0, 3)
|
|
148
|
+
.map((f) => f.transformationId),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return insights;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Detect quality trends (degraded quality patterns)
|
|
156
|
+
*/
|
|
157
|
+
function detectQualityTrends(aggregated, _minConfidence) {
|
|
158
|
+
const insights = [];
|
|
159
|
+
for (const agg of aggregated.values()) {
|
|
160
|
+
// Quality trend criteria: degraded quality impact, ≥2 occurrences
|
|
161
|
+
if (agg.qualityImpact === 'degraded' && agg.transformations.length >= 2) {
|
|
162
|
+
insights.push({
|
|
163
|
+
type: 'quality-trend',
|
|
164
|
+
pattern: agg.pattern,
|
|
165
|
+
occurrences: agg.transformations.length,
|
|
166
|
+
successRate: agg.successRate,
|
|
167
|
+
confidence: Math.max(agg.avgConfidence, 0.6), // Boost confidence for quality issues
|
|
168
|
+
description: `Pattern '${agg.pattern}' shows quality degradation across ${agg.transformations.length} transformations despite ${(agg.successRate * 100).toFixed(0)}% success rate`,
|
|
169
|
+
recommendation: `Review ${agg.pattern} transformations for code quality impact. Consider refining approach to improve maintainability.`,
|
|
170
|
+
examples: agg.transformations
|
|
171
|
+
.filter((f) => f.outcome.quality === 'degraded')
|
|
172
|
+
.slice(0, 3)
|
|
173
|
+
.map((f) => f.transformationId),
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
// Anti-pattern: successful but low quality
|
|
177
|
+
if (agg.successRate >= 0.8 &&
|
|
178
|
+
agg.qualityImpact === 'degraded' &&
|
|
179
|
+
agg.transformations.length >= 3) {
|
|
180
|
+
insights.push({
|
|
181
|
+
type: 'anti-pattern',
|
|
182
|
+
pattern: agg.pattern,
|
|
183
|
+
occurrences: agg.transformations.length,
|
|
184
|
+
successRate: agg.successRate,
|
|
185
|
+
confidence: agg.avgConfidence,
|
|
186
|
+
description: `Pattern '${agg.pattern}' succeeds but consistently degrades code quality (anti-pattern)`,
|
|
187
|
+
recommendation: `Investigate and refine ${agg.pattern} approach. Successful transformations should maintain or improve quality.`,
|
|
188
|
+
examples: agg.transformations
|
|
189
|
+
.slice(0, 3)
|
|
190
|
+
.map((f) => f.transformationId),
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return insights;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=feedback-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feedback-analyzer.js","sourceRoot":"","sources":["../../../src/tools/helpers/feedback-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAkDH;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAkC,EAClC,YAIS,EACT,aAAqB;IAErB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAA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ootPath`.
|
|
6
|
+
*
|
|
7
|
+
* @returns Absolute path to the tsconfig file, or `null` if none found.
|
|
8
|
+
*/
|
|
9
|
+
export declare function findTsConfig(rootPath: string): string | null;
|
|
10
|
+
//# sourceMappingURL=find-ts-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-ts-config.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/find-ts-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ5D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - TypeScript Config Finder
|
|
3
|
+
*/
|
|
4
|
+
import { existsSync } from 'node:fs';
|
|
5
|
+
import { resolve } from 'node:path';
|
|
6
|
+
/**
|
|
7
|
+
* Candidate tsconfig filenames searched in order.
|
|
8
|
+
* Covers standard Angular CLI layouts, library projects, and monorepo roots.
|
|
9
|
+
*/
|
|
10
|
+
const TS_CONFIG_CANDIDATES = [
|
|
11
|
+
'tsconfig.json',
|
|
12
|
+
'tsconfig.app.json',
|
|
13
|
+
'tsconfig.base.json',
|
|
14
|
+
'tsconfig.build.json',
|
|
15
|
+
'tsconfig.lib.json',
|
|
16
|
+
'tsconfig.workspace.json',
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Locate the first resolvable TypeScript config file under `rootPath`.
|
|
20
|
+
*
|
|
21
|
+
* @returns Absolute path to the tsconfig file, or `null` if none found.
|
|
22
|
+
*/
|
|
23
|
+
export function findTsConfig(rootPath) {
|
|
24
|
+
for (const candidate of TS_CONFIG_CANDIDATES) {
|
|
25
|
+
const fullPath = resolve(rootPath, candidate);
|
|
26
|
+
if (existsSync(fullPath)) {
|
|
27
|
+
return fullPath;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=find-ts-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-ts-config.js","sourceRoot":"","sources":["../../../src/tools/helpers/find-ts-config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;GAGG;AACH,MAAM,oBAAoB,GAAG;IAC3B,eAAe;IACf,mBAAmB;IACnB,oBAAoB;IACpB,qBAAqB;IACrB,mBAAmB;IACnB,yBAAyB;CAC1B,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,KAAK,MAAM,SAAS,IAAI,oBAAoB,EAAE,CAAC;QAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC9C,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Platform Root Resolver
|
|
3
|
+
*
|
|
4
|
+
* Utility for intelligently resolving the platform root directory.
|
|
5
|
+
* Searches upward for monorepo root (package.json with workspaces).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Resolve platform root directory by searching upward for package.json with workspaces
|
|
9
|
+
* Falls back to environment variable or calculated path
|
|
10
|
+
*
|
|
11
|
+
* @param currentDir - Starting directory for upward search (typically __dirname)
|
|
12
|
+
* @param fallbackPath - Fallback relative path if monorepo root not found (e.g., '../../../..')
|
|
13
|
+
* @returns Absolute path to platform root directory
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* - First checks ANGULAR_MODERNIZER_PLATFORM_ROOT environment variable
|
|
17
|
+
* - Then searches upward from currentDir for package.json with workspaces field
|
|
18
|
+
* - Falls back to calculated path relative to currentDir if not found
|
|
19
|
+
* - Stops searching at filesystem root to prevent infinite loops
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { fileURLToPath } from 'node:url';
|
|
24
|
+
* import * as path from 'node:path';
|
|
25
|
+
*
|
|
26
|
+
* const __filename = fileURLToPath(import.meta.url);
|
|
27
|
+
* const __dirname = path.dirname(__filename);
|
|
28
|
+
*
|
|
29
|
+
* const platformRoot = resolvePlatformRoot(__dirname, '../../../..');
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolvePlatformRoot(currentDir: string, fallbackPath: string): string;
|
|
33
|
+
//# sourceMappingURL=platform-root-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-root-resolver.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/platform-root-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,MAAM,CA+BR"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Platform Root Resolver
|
|
3
|
+
*
|
|
4
|
+
* Utility for intelligently resolving the platform root directory.
|
|
5
|
+
* Searches upward for monorepo root (package.json with workspaces).
|
|
6
|
+
*/
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
import { readFileSync } from 'node:fs';
|
|
9
|
+
/**
|
|
10
|
+
* Resolve platform root directory by searching upward for package.json with workspaces
|
|
11
|
+
* Falls back to environment variable or calculated path
|
|
12
|
+
*
|
|
13
|
+
* @param currentDir - Starting directory for upward search (typically __dirname)
|
|
14
|
+
* @param fallbackPath - Fallback relative path if monorepo root not found (e.g., '../../../..')
|
|
15
|
+
* @returns Absolute path to platform root directory
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* - First checks ANGULAR_MODERNIZER_PLATFORM_ROOT environment variable
|
|
19
|
+
* - Then searches upward from currentDir for package.json with workspaces field
|
|
20
|
+
* - Falls back to calculated path relative to currentDir if not found
|
|
21
|
+
* - Stops searching at filesystem root to prevent infinite loops
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { fileURLToPath } from 'node:url';
|
|
26
|
+
* import * as path from 'node:path';
|
|
27
|
+
*
|
|
28
|
+
* const __filename = fileURLToPath(import.meta.url);
|
|
29
|
+
* const __dirname = path.dirname(__filename);
|
|
30
|
+
*
|
|
31
|
+
* const platformRoot = resolvePlatformRoot(__dirname, '../../../..');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function resolvePlatformRoot(currentDir, fallbackPath) {
|
|
35
|
+
// Allow override via environment variable
|
|
36
|
+
if (process.env['ANGULAR_MODERNIZER_PLATFORM_ROOT']) {
|
|
37
|
+
return process.env['ANGULAR_MODERNIZER_PLATFORM_ROOT'];
|
|
38
|
+
}
|
|
39
|
+
// Search upward from current directory for monorepo root (package.json with workspaces)
|
|
40
|
+
let searchDir = currentDir;
|
|
41
|
+
const root = path.parse(searchDir).root;
|
|
42
|
+
while (searchDir !== root) {
|
|
43
|
+
try {
|
|
44
|
+
const packageJsonPath = path.join(searchDir, 'package.json');
|
|
45
|
+
const packageJsonContent = readFileSync(packageJsonPath, 'utf-8');
|
|
46
|
+
const packageJson = JSON.parse(packageJsonContent);
|
|
47
|
+
// Check if this is the monorepo root (has workspaces)
|
|
48
|
+
if (packageJson.workspaces) {
|
|
49
|
+
return searchDir;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// package.json not found or invalid, continue searching
|
|
54
|
+
}
|
|
55
|
+
searchDir = path.dirname(searchDir);
|
|
56
|
+
}
|
|
57
|
+
// Fallback to calculated path relative to currentDir
|
|
58
|
+
return path.join(currentDir, fallbackPath);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=platform-root-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-root-resolver.js","sourceRoot":"","sources":["../../../src/tools/helpers/platform-root-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAkB,EAClB,YAAoB;IAEpB,0CAA0C;IAC1C,IAAI,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,EAAE,CAAC;QACpD,OAAO,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IACzD,CAAC;IAED,wFAAwF;IACxF,IAAI,SAAS,GAAG,UAAU,CAAC;IAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC;IAExC,OAAO,SAAS,KAAK,IAAI,EAAE,CAAC;QAC1B,IAAI,CAAC;YACH,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;YAC7D,MAAM,kBAAkB,GAAG,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;YAClE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAEhD,CAAC;YAEF,sDAAsD;YACtD,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;gBAC3B,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,wDAAwD;QAC1D,CAAC;QAED,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,qDAAqD;IACrD,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Rule Matcher Utility
|
|
3
|
+
*
|
|
4
|
+
* Fuzzy matching for rule IDs to provide helpful suggestions
|
|
5
|
+
* when a rule is not found.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Available transformation rule.
|
|
9
|
+
*/
|
|
10
|
+
export interface TransformationRule {
|
|
11
|
+
/**
|
|
12
|
+
* Unique rule ID (e.g., 'standalone:migrate-to-standalone').
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* Human-readable rule name.
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* Optional description of what the rule does.
|
|
21
|
+
*/
|
|
22
|
+
description?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Calculate Levenshtein distance between two strings (edit distance).
|
|
26
|
+
*
|
|
27
|
+
* The Levenshtein distance is the minimum number of single-character edits
|
|
28
|
+
* (insertions, deletions, or substitutions) required to change one string
|
|
29
|
+
* into another.
|
|
30
|
+
*
|
|
31
|
+
* @param a - First string
|
|
32
|
+
* @param b - Second string
|
|
33
|
+
* @returns Edit distance (0 = identical, higher = more different)
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* levenshteinDistance('kitten', 'sitting'); // 3
|
|
38
|
+
* levenshteinDistance('saturday', 'sunday'); // 3
|
|
39
|
+
* levenshteinDistance('hello', 'hello'); // 0
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function levenshteinDistance(a: string, b: string): number;
|
|
43
|
+
/**
|
|
44
|
+
* Find similar rule IDs using fuzzy matching.
|
|
45
|
+
*
|
|
46
|
+
* Uses Levenshtein distance to find rules that are similar to the
|
|
47
|
+
* requested rule ID. Returns up to 3 suggestions sorted by similarity.
|
|
48
|
+
*
|
|
49
|
+
* @param requested - The rule ID that was not found
|
|
50
|
+
* @param available - List of available transformation rules
|
|
51
|
+
* @param maxDistance - Maximum edit distance to consider similar (default: 10)
|
|
52
|
+
* @returns Top 3 similar rules sorted by similarity (lower distance = more similar)
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const rules = [
|
|
57
|
+
* { id: 'standalone:migrate-to-standalone', name: 'Migrate to Standalone' },
|
|
58
|
+
* { id: 'angular:constructor-to-inject', name: 'Constructor to Inject' }
|
|
59
|
+
* ];
|
|
60
|
+
*
|
|
61
|
+
* // User typo: 'convert-to-standalone' instead of 'standalone:migrate-to-standalone'
|
|
62
|
+
* const similar = findSimilarRules('convert-to-standalone', rules);
|
|
63
|
+
* // Returns: [{ id: 'standalone:migrate-to-standalone', distance: 12 }]
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function findSimilarRules(requested: string, available: TransformationRule[], maxDistance?: number): (TransformationRule & {
|
|
67
|
+
distance: number;
|
|
68
|
+
})[];
|
|
69
|
+
/**
|
|
70
|
+
* Get all available transformation rule IDs from the inputSchema.
|
|
71
|
+
*
|
|
72
|
+
* Extracts rule IDs from the 'transformation' enum in the MCP tool schema.
|
|
73
|
+
*
|
|
74
|
+
* @param inputSchema - The MCP tool's input schema
|
|
75
|
+
* @returns Array of available transformation rule metadata
|
|
76
|
+
*/
|
|
77
|
+
export declare function getAvailableRules(inputSchema: {
|
|
78
|
+
properties?: {
|
|
79
|
+
transformation?: {
|
|
80
|
+
enum?: string[];
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}): TransformationRule[];
|
|
84
|
+
//# sourceMappingURL=rule-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-matcher.d.ts","sourceRoot":"","sources":["../../../src/tools/helpers/rule-matcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAyChE;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,kBAAkB,EAAE,EAC/B,WAAW,SAAK,GACf,CAAC,kBAAkB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,CAe/C;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE;IAC7C,UAAU,CAAC,EAAE;QACX,cAAc,CAAC,EAAE;YACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;SACjB,CAAC;KACH,CAAC;CACH,GAAG,kBAAkB,EAAE,CAqHvB"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @angular-modernizer/adapter-mcp - Rule Matcher Utility
|
|
3
|
+
*
|
|
4
|
+
* Fuzzy matching for rule IDs to provide helpful suggestions
|
|
5
|
+
* when a rule is not found.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Calculate Levenshtein distance between two strings (edit distance).
|
|
9
|
+
*
|
|
10
|
+
* The Levenshtein distance is the minimum number of single-character edits
|
|
11
|
+
* (insertions, deletions, or substitutions) required to change one string
|
|
12
|
+
* into another.
|
|
13
|
+
*
|
|
14
|
+
* @param a - First string
|
|
15
|
+
* @param b - Second string
|
|
16
|
+
* @returns Edit distance (0 = identical, higher = more different)
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* levenshteinDistance('kitten', 'sitting'); // 3
|
|
21
|
+
* levenshteinDistance('saturday', 'sunday'); // 3
|
|
22
|
+
* levenshteinDistance('hello', 'hello'); // 0
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export function levenshteinDistance(a, b) {
|
|
26
|
+
// Handle empty strings
|
|
27
|
+
if (a.length === 0) {
|
|
28
|
+
return b.length;
|
|
29
|
+
}
|
|
30
|
+
if (b.length === 0) {
|
|
31
|
+
return a.length;
|
|
32
|
+
}
|
|
33
|
+
// Create distance matrix
|
|
34
|
+
const matrix = [];
|
|
35
|
+
// Initialize first column (0 to b.length)
|
|
36
|
+
for (let i = 0; i <= b.length; i++) {
|
|
37
|
+
matrix[i] = [i];
|
|
38
|
+
}
|
|
39
|
+
// Initialize first row (0 to a.length)
|
|
40
|
+
for (let j = 0; j <= a.length; j++) {
|
|
41
|
+
matrix[0][j] = j;
|
|
42
|
+
}
|
|
43
|
+
// Fill in the rest of the matrix
|
|
44
|
+
for (let i = 1; i <= b.length; i++) {
|
|
45
|
+
for (let j = 1; j <= a.length; j++) {
|
|
46
|
+
if (b.charAt(i - 1) === a.charAt(j - 1)) {
|
|
47
|
+
// Characters match - no edit needed
|
|
48
|
+
matrix[i][j] = matrix[i - 1][j - 1];
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Characters don't match - choose minimum cost operation
|
|
52
|
+
matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // Substitution
|
|
53
|
+
matrix[i][j - 1] + 1, // Insertion
|
|
54
|
+
matrix[i - 1][j] + 1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Return bottom-right cell (final distance)
|
|
59
|
+
return matrix[b.length][a.length];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Find similar rule IDs using fuzzy matching.
|
|
63
|
+
*
|
|
64
|
+
* Uses Levenshtein distance to find rules that are similar to the
|
|
65
|
+
* requested rule ID. Returns up to 3 suggestions sorted by similarity.
|
|
66
|
+
*
|
|
67
|
+
* @param requested - The rule ID that was not found
|
|
68
|
+
* @param available - List of available transformation rules
|
|
69
|
+
* @param maxDistance - Maximum edit distance to consider similar (default: 10)
|
|
70
|
+
* @returns Top 3 similar rules sorted by similarity (lower distance = more similar)
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const rules = [
|
|
75
|
+
* { id: 'standalone:migrate-to-standalone', name: 'Migrate to Standalone' },
|
|
76
|
+
* { id: 'angular:constructor-to-inject', name: 'Constructor to Inject' }
|
|
77
|
+
* ];
|
|
78
|
+
*
|
|
79
|
+
* // User typo: 'convert-to-standalone' instead of 'standalone:migrate-to-standalone'
|
|
80
|
+
* const similar = findSimilarRules('convert-to-standalone', rules);
|
|
81
|
+
* // Returns: [{ id: 'standalone:migrate-to-standalone', distance: 12 }]
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export function findSimilarRules(requested, available, maxDistance = 10) {
|
|
85
|
+
// Normalize strings for better matching (case-insensitive)
|
|
86
|
+
const requestedLower = requested.toLowerCase();
|
|
87
|
+
// Calculate similarity scores for all rules
|
|
88
|
+
const scored = available.map((rule) => ({
|
|
89
|
+
...rule,
|
|
90
|
+
distance: levenshteinDistance(requestedLower, rule.id.toLowerCase()),
|
|
91
|
+
}));
|
|
92
|
+
// Sort by distance (lower = more similar)
|
|
93
|
+
scored.sort((a, b) => a.distance - b.distance);
|
|
94
|
+
// Return top 3 matches with distance below threshold
|
|
95
|
+
return scored.filter((s) => s.distance <= maxDistance).slice(0, 3);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get all available transformation rule IDs from the inputSchema.
|
|
99
|
+
*
|
|
100
|
+
* Extracts rule IDs from the 'transformation' enum in the MCP tool schema.
|
|
101
|
+
*
|
|
102
|
+
* @param inputSchema - The MCP tool's input schema
|
|
103
|
+
* @returns Array of available transformation rule metadata
|
|
104
|
+
*/
|
|
105
|
+
export function getAvailableRules(inputSchema) {
|
|
106
|
+
const transformationEnum = inputSchema.properties?.transformation?.enum;
|
|
107
|
+
if (!transformationEnum || !Array.isArray(transformationEnum)) {
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
// Map transformation types to rule IDs with descriptions
|
|
111
|
+
const ruleMapping = {
|
|
112
|
+
'constructor-to-inject': {
|
|
113
|
+
id: 'angular:constructor-to-inject',
|
|
114
|
+
name: 'Constructor to Inject',
|
|
115
|
+
description: 'Convert constructor injection to inject() pattern',
|
|
116
|
+
},
|
|
117
|
+
'interface-extraction': {
|
|
118
|
+
id: 'angular:interface-extraction',
|
|
119
|
+
name: 'Interface Extraction',
|
|
120
|
+
description: 'Extract inline types to interfaces',
|
|
121
|
+
},
|
|
122
|
+
'standalone-migration': {
|
|
123
|
+
id: 'standalone:migrate-to-standalone',
|
|
124
|
+
name: 'Standalone Migration',
|
|
125
|
+
description: 'Migrate NgModule components to standalone',
|
|
126
|
+
},
|
|
127
|
+
'dependency-injection-migration': {
|
|
128
|
+
id: 'angular:dependency-injection-migration',
|
|
129
|
+
name: 'Dependency Injection Migration',
|
|
130
|
+
description: 'Modernize dependency injection patterns',
|
|
131
|
+
},
|
|
132
|
+
'facade-pattern': {
|
|
133
|
+
id: 'angular:facade-pattern',
|
|
134
|
+
name: 'Facade Pattern',
|
|
135
|
+
description: 'Apply facade pattern to services',
|
|
136
|
+
},
|
|
137
|
+
'form-modernization': {
|
|
138
|
+
id: 'angular:form-modernization',
|
|
139
|
+
name: 'Form Modernization',
|
|
140
|
+
description: 'Modernize Angular forms',
|
|
141
|
+
},
|
|
142
|
+
'constructor-injection-transform': {
|
|
143
|
+
id: 'angular:constructor-injection-transform',
|
|
144
|
+
name: 'Constructor Injection Transform',
|
|
145
|
+
description: 'Transform manual service instantiation to DI',
|
|
146
|
+
},
|
|
147
|
+
'component-inputs-interface-extraction': {
|
|
148
|
+
id: 'angular:component-inputs-interface-extraction',
|
|
149
|
+
name: 'Component Inputs Interface',
|
|
150
|
+
description: 'Extract @Input properties to interface',
|
|
151
|
+
},
|
|
152
|
+
'service-injection-cleanup': {
|
|
153
|
+
id: 'angular:service-injection-cleanup',
|
|
154
|
+
name: 'Service Injection Cleanup',
|
|
155
|
+
description: 'Clean up pseudo-service classes',
|
|
156
|
+
},
|
|
157
|
+
'container-presentational': {
|
|
158
|
+
id: 'angular:container-presentational',
|
|
159
|
+
name: 'Container/Presentational',
|
|
160
|
+
description: 'Split mixed responsibility components',
|
|
161
|
+
},
|
|
162
|
+
'core-shared-modules': {
|
|
163
|
+
id: 'angular:core-shared-modules',
|
|
164
|
+
name: 'Core/Shared Modules',
|
|
165
|
+
description: 'Migrate modules to core/shared structure',
|
|
166
|
+
},
|
|
167
|
+
'inheritance-to-composition': {
|
|
168
|
+
id: 'angular:inheritance-to-composition',
|
|
169
|
+
name: 'Inheritance to Composition',
|
|
170
|
+
description: 'Convert inheritance to composition',
|
|
171
|
+
},
|
|
172
|
+
'promise-service-to-observable': {
|
|
173
|
+
id: 'angular:promise-service-to-observable',
|
|
174
|
+
name: 'Promise Service to Observable',
|
|
175
|
+
description: 'Convert Promise-based Injectable methods to Observable<T>',
|
|
176
|
+
},
|
|
177
|
+
'promise-component-to-reactive': {
|
|
178
|
+
id: 'angular:promise-component-to-reactive',
|
|
179
|
+
name: 'Promise Component to Reactive',
|
|
180
|
+
description: 'Convert async component methods to Observable properties with async pipe',
|
|
181
|
+
},
|
|
182
|
+
'promise-cleanup': {
|
|
183
|
+
id: 'angular:promise-cleanup',
|
|
184
|
+
name: 'Promise Cleanup',
|
|
185
|
+
description: 'Remove obsolete promise patterns after service/component transforms',
|
|
186
|
+
},
|
|
187
|
+
'sequential-await-to-forkjoin': {
|
|
188
|
+
id: 'angular:sequential-await-to-forkjoin',
|
|
189
|
+
name: 'Sequential Await to forkJoin',
|
|
190
|
+
description: 'Convert sequential independent await calls to parallel forkJoin() execution',
|
|
191
|
+
},
|
|
192
|
+
'missing-output-transform': {
|
|
193
|
+
id: 'angular:missing-output-transform',
|
|
194
|
+
name: 'Missing Output Transform',
|
|
195
|
+
description: 'Add output() signals for presentational component methods calling services directly',
|
|
196
|
+
},
|
|
197
|
+
'subscription-transform': {
|
|
198
|
+
id: 'angular:subscription-transform',
|
|
199
|
+
name: 'Subscription Transform',
|
|
200
|
+
description: 'Add takeUntilDestroyed() to raw .subscribe() calls in lifecycle hooks',
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
return transformationEnum.map((transformationType) => {
|
|
204
|
+
const mapping = ruleMapping[transformationType];
|
|
205
|
+
return {
|
|
206
|
+
id: mapping?.id ?? `unknown:${transformationType}`,
|
|
207
|
+
name: mapping?.name ?? transformationType,
|
|
208
|
+
description: mapping?.description,
|
|
209
|
+
};
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=rule-matcher.js.map
|