driftdetect-mcp 0.4.4 → 0.5.0

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 (98) hide show
  1. package/LICENSE +21 -0
  2. package/dist/bin/server.js +0 -0
  3. package/dist/enterprise-server.d.ts +7 -0
  4. package/dist/enterprise-server.d.ts.map +1 -1
  5. package/dist/enterprise-server.js +77 -7
  6. package/dist/enterprise-server.js.map +1 -1
  7. package/dist/infrastructure/index.d.ts +2 -0
  8. package/dist/infrastructure/index.d.ts.map +1 -1
  9. package/dist/infrastructure/index.js +3 -0
  10. package/dist/infrastructure/index.js.map +1 -1
  11. package/dist/infrastructure/project-resolver.d.ts +43 -0
  12. package/dist/infrastructure/project-resolver.d.ts.map +1 -0
  13. package/dist/infrastructure/project-resolver.js +108 -0
  14. package/dist/infrastructure/project-resolver.js.map +1 -0
  15. package/dist/tools/analysis/coupling.d.ts +56 -0
  16. package/dist/tools/analysis/coupling.d.ts.map +1 -0
  17. package/dist/tools/analysis/coupling.js +248 -0
  18. package/dist/tools/analysis/coupling.js.map +1 -0
  19. package/dist/tools/analysis/error-handling.d.ts +45 -0
  20. package/dist/tools/analysis/error-handling.d.ts.map +1 -0
  21. package/dist/tools/analysis/error-handling.js +220 -0
  22. package/dist/tools/analysis/error-handling.js.map +1 -0
  23. package/dist/tools/analysis/index.d.ts +11 -0
  24. package/dist/tools/analysis/index.d.ts.map +1 -0
  25. package/dist/tools/analysis/index.js +111 -0
  26. package/dist/tools/analysis/index.js.map +1 -0
  27. package/dist/tools/analysis/test-topology.d.ts +43 -0
  28. package/dist/tools/analysis/test-topology.d.ts.map +1 -0
  29. package/dist/tools/analysis/test-topology.js +294 -0
  30. package/dist/tools/analysis/test-topology.js.map +1 -0
  31. package/dist/tools/detail/code-examples.d.ts +20 -3
  32. package/dist/tools/detail/code-examples.d.ts.map +1 -1
  33. package/dist/tools/detail/code-examples.js +104 -0
  34. package/dist/tools/detail/code-examples.js.map +1 -1
  35. package/dist/tools/detail/index.d.ts +6 -4
  36. package/dist/tools/detail/index.d.ts.map +1 -1
  37. package/dist/tools/detail/index.js +44 -6
  38. package/dist/tools/detail/index.js.map +1 -1
  39. package/dist/tools/detail/pattern-get.d.ts +20 -3
  40. package/dist/tools/detail/pattern-get.d.ts.map +1 -1
  41. package/dist/tools/detail/pattern-get.js +87 -0
  42. package/dist/tools/detail/pattern-get.js.map +1 -1
  43. package/dist/tools/detail/wrappers.d.ts +97 -0
  44. package/dist/tools/detail/wrappers.d.ts.map +1 -0
  45. package/dist/tools/detail/wrappers.js +124 -0
  46. package/dist/tools/detail/wrappers.js.map +1 -0
  47. package/dist/tools/discovery/index.d.ts +3 -1
  48. package/dist/tools/discovery/index.d.ts.map +1 -1
  49. package/dist/tools/discovery/index.js +36 -3
  50. package/dist/tools/discovery/index.js.map +1 -1
  51. package/dist/tools/discovery/projects.d.ts +7 -1
  52. package/dist/tools/discovery/projects.d.ts.map +1 -1
  53. package/dist/tools/discovery/projects.js +55 -1
  54. package/dist/tools/discovery/projects.js.map +1 -1
  55. package/dist/tools/discovery/status.d.ts +16 -3
  56. package/dist/tools/discovery/status.d.ts.map +1 -1
  57. package/dist/tools/discovery/status.js +83 -1
  58. package/dist/tools/discovery/status.js.map +1 -1
  59. package/dist/tools/exploration/index.d.ts +2 -2
  60. package/dist/tools/exploration/index.d.ts.map +1 -1
  61. package/dist/tools/exploration/index.js +1 -5
  62. package/dist/tools/exploration/index.js.map +1 -1
  63. package/dist/tools/exploration/patterns-list.d.ts +21 -4
  64. package/dist/tools/exploration/patterns-list.d.ts.map +1 -1
  65. package/dist/tools/exploration/patterns-list.js +70 -0
  66. package/dist/tools/exploration/patterns-list.js.map +1 -1
  67. package/dist/tools/generation/__tests__/generation-tools.test.d.ts +6 -0
  68. package/dist/tools/generation/__tests__/generation-tools.test.d.ts.map +1 -0
  69. package/dist/tools/generation/__tests__/generation-tools.test.js +119 -0
  70. package/dist/tools/generation/__tests__/generation-tools.test.js.map +1 -0
  71. package/dist/tools/generation/explain.d.ts +75 -0
  72. package/dist/tools/generation/explain.d.ts.map +1 -0
  73. package/dist/tools/generation/explain.js +238 -0
  74. package/dist/tools/generation/explain.js.map +1 -0
  75. package/dist/tools/generation/index.d.ts +12 -0
  76. package/dist/tools/generation/index.d.ts.map +1 -0
  77. package/dist/tools/generation/index.js +90 -0
  78. package/dist/tools/generation/index.js.map +1 -0
  79. package/dist/tools/generation/suggest-changes.d.ts +64 -0
  80. package/dist/tools/generation/suggest-changes.d.ts.map +1 -0
  81. package/dist/tools/generation/suggest-changes.js +342 -0
  82. package/dist/tools/generation/suggest-changes.js.map +1 -0
  83. package/dist/tools/generation/validate-change.d.ts +76 -0
  84. package/dist/tools/generation/validate-change.d.ts.map +1 -0
  85. package/dist/tools/generation/validate-change.js +415 -0
  86. package/dist/tools/generation/validate-change.js.map +1 -0
  87. package/dist/tools/orchestration/context.d.ts +41 -0
  88. package/dist/tools/orchestration/context.d.ts.map +1 -1
  89. package/dist/tools/orchestration/context.js +215 -14
  90. package/dist/tools/orchestration/context.js.map +1 -1
  91. package/dist/tools/orchestration/index.d.ts.map +1 -1
  92. package/dist/tools/orchestration/index.js +13 -1
  93. package/dist/tools/orchestration/index.js.map +1 -1
  94. package/dist/tools/registry.d.ts +5 -1
  95. package/dist/tools/registry.d.ts.map +1 -1
  96. package/dist/tools/registry.js +12 -0
  97. package/dist/tools/registry.js.map +1 -1
  98. package/package.json +11 -11
@@ -0,0 +1,248 @@
1
+ /**
2
+ * drift_coupling - Module Coupling Analysis
3
+ *
4
+ * Analysis tool for module dependencies, cycles, and coupling metrics.
5
+ * Based on Robert C. Martin's coupling metrics (Ca, Ce, Instability, Abstractness, Distance).
6
+ */
7
+ import * as fs from 'node:fs/promises';
8
+ import * as path from 'node:path';
9
+ import { createModuleCouplingAnalyzer, createCallGraphAnalyzer, } from 'driftdetect-core';
10
+ import { createResponseBuilder, Errors } from '../../infrastructure/index.js';
11
+ // ============================================================================
12
+ // Constants
13
+ // ============================================================================
14
+ const DRIFT_DIR = '.drift';
15
+ const COUPLING_DIR = 'module-coupling';
16
+ // ============================================================================
17
+ // Handler
18
+ // ============================================================================
19
+ export async function handleCoupling(projectRoot, args) {
20
+ const { action } = args;
21
+ switch (action) {
22
+ case 'status':
23
+ return handleStatus(projectRoot);
24
+ case 'cycles':
25
+ return handleCycles(projectRoot, args.maxCycleLength, args.minSeverity);
26
+ case 'hotspots':
27
+ return handleHotspots(projectRoot, args.limit, args.minCoupling);
28
+ case 'analyze':
29
+ return handleAnalyze(projectRoot, args.module);
30
+ case 'refactor-impact':
31
+ return handleRefactorImpact(projectRoot, args.module);
32
+ case 'unused-exports':
33
+ return handleUnusedExports(projectRoot, args.limit);
34
+ default:
35
+ throw Errors.invalidArgument('action', `Invalid action: ${action}. Valid: status, cycles, hotspots, analyze, refactor-impact, unused-exports`);
36
+ }
37
+ }
38
+ // ============================================================================
39
+ // Action Handlers
40
+ // ============================================================================
41
+ async function handleStatus(projectRoot) {
42
+ const builder = createResponseBuilder();
43
+ // Try to load cached data first
44
+ const graphPath = path.join(projectRoot, DRIFT_DIR, COUPLING_DIR, 'graph.json');
45
+ try {
46
+ const data = JSON.parse(await fs.readFile(graphPath, 'utf-8'));
47
+ const { metrics, generatedAt } = data;
48
+ let summaryText = `🔗 ${metrics.totalModules} modules, ${metrics.totalEdges} dependencies. `;
49
+ summaryText += `${metrics.cycleCount} cycles. `;
50
+ summaryText += `Avg instability: ${metrics.avgInstability}, distance: ${metrics.avgDistance}.`;
51
+ const warnings = [];
52
+ if (metrics.cycleCount > 0) {
53
+ warnings.push(`${metrics.cycleCount} dependency cycles detected`);
54
+ }
55
+ if (metrics.zoneOfPain.length > 0) {
56
+ warnings.push(`${metrics.zoneOfPain.length} modules in zone of pain`);
57
+ }
58
+ const hints = {
59
+ nextActions: metrics.cycleCount > 0
60
+ ? ['Run drift_coupling action="cycles" to see cycle details']
61
+ : ['Coupling looks healthy'],
62
+ warnings: warnings.length > 0 ? warnings : undefined,
63
+ relatedTools: ['drift_coupling action="cycles"', 'drift_coupling action="hotspots"'],
64
+ };
65
+ return builder
66
+ .withSummary(summaryText)
67
+ .withData({ metrics, generatedAt })
68
+ .withHints(hints)
69
+ .buildContent();
70
+ }
71
+ catch {
72
+ throw Errors.custom('NO_COUPLING_GRAPH', 'No coupling graph found. Build it first using the CLI: drift coupling build', ['drift coupling build']);
73
+ }
74
+ }
75
+ async function handleCycles(projectRoot, maxCycleLength, minSeverity) {
76
+ const builder = createResponseBuilder();
77
+ const graphPath = path.join(projectRoot, DRIFT_DIR, COUPLING_DIR, 'graph.json');
78
+ try {
79
+ const data = JSON.parse(await fs.readFile(graphPath, 'utf-8'));
80
+ let cycles = data.cycles;
81
+ // Filter by length
82
+ if (maxCycleLength) {
83
+ cycles = cycles.filter(c => c.length <= maxCycleLength);
84
+ }
85
+ // Filter by severity
86
+ if (minSeverity) {
87
+ const severityOrder = { critical: 0, warning: 1, info: 2 };
88
+ const minOrder = severityOrder[minSeverity];
89
+ cycles = cycles.filter(c => severityOrder[c.severity] <= minOrder);
90
+ }
91
+ const bySeverity = {
92
+ critical: cycles.filter(c => c.severity === 'critical').length,
93
+ warning: cycles.filter(c => c.severity === 'warning').length,
94
+ info: cycles.filter(c => c.severity === 'info').length,
95
+ };
96
+ let summaryText = `🔄 ${cycles.length} cycles. `;
97
+ if (bySeverity.critical > 0)
98
+ summaryText += `🔴 ${bySeverity.critical} critical. `;
99
+ if (bySeverity.warning > 0)
100
+ summaryText += `🟡 ${bySeverity.warning} warning. `;
101
+ if (bySeverity.info > 0)
102
+ summaryText += `⚪ ${bySeverity.info} info.`;
103
+ const hints = {
104
+ nextActions: bySeverity.critical > 0
105
+ ? ['Focus on breaking critical cycles first']
106
+ : cycles.length > 0
107
+ ? ['Consider breaking cycles to improve maintainability']
108
+ : ['No cycles - good architecture!'],
109
+ relatedTools: ['drift_coupling action="analyze" module="<path>"'],
110
+ };
111
+ return builder
112
+ .withSummary(summaryText)
113
+ .withData({ cycles, total: cycles.length, bySeverity })
114
+ .withHints(hints)
115
+ .buildContent();
116
+ }
117
+ catch {
118
+ throw Errors.custom('NO_COUPLING_GRAPH', 'No coupling graph found. Build it first.', ['drift coupling build']);
119
+ }
120
+ }
121
+ async function handleHotspots(projectRoot, limit, minCoupling) {
122
+ const builder = createResponseBuilder();
123
+ const graphPath = path.join(projectRoot, DRIFT_DIR, COUPLING_DIR, 'graph.json');
124
+ try {
125
+ const data = JSON.parse(await fs.readFile(graphPath, 'utf-8'));
126
+ const modules = Object.entries(data.modules);
127
+ const hotspots = modules
128
+ .map(([modPath, mod]) => ({
129
+ path: modPath,
130
+ coupling: mod.metrics.Ca + mod.metrics.Ce,
131
+ metrics: mod.metrics,
132
+ }))
133
+ .filter(h => h.coupling >= (minCoupling ?? 3))
134
+ .sort((a, b) => b.coupling - a.coupling)
135
+ .slice(0, limit ?? 15);
136
+ let summaryText = `🔥 ${hotspots.length} coupling hotspots. `;
137
+ if (hotspots.length > 0) {
138
+ summaryText += `Top: ${hotspots[0].path} (${hotspots[0].coupling} connections).`;
139
+ }
140
+ const hints = {
141
+ nextActions: hotspots.length > 0
142
+ ? [`Analyze top hotspot: drift_coupling action="analyze" module="${hotspots[0].path}"`]
143
+ : ['No hotspots - coupling is well distributed'],
144
+ relatedTools: ['drift_coupling action="refactor-impact"'],
145
+ };
146
+ return builder
147
+ .withSummary(summaryText)
148
+ .withData({ hotspots, total: hotspots.length })
149
+ .withHints(hints)
150
+ .buildContent();
151
+ }
152
+ catch {
153
+ throw Errors.custom('NO_COUPLING_GRAPH', 'No coupling graph found. Build it first.', ['drift coupling build']);
154
+ }
155
+ }
156
+ async function handleAnalyze(projectRoot, modulePath) {
157
+ const builder = createResponseBuilder();
158
+ if (!modulePath) {
159
+ throw Errors.missingParameter('module');
160
+ }
161
+ // Build analyzer on-demand
162
+ const analyzer = await buildAnalyzer(projectRoot);
163
+ const analysis = analyzer.analyzeModule(modulePath);
164
+ if (!analysis) {
165
+ throw Errors.custom('MODULE_NOT_FOUND', `Module not found: ${modulePath}`, ['Check the module path and ensure call graph is built']);
166
+ }
167
+ const { module, cyclesInvolved, health } = analysis;
168
+ let summaryText = `📦 ${modulePath}: ${module.role} role. `;
169
+ summaryText += `Ca: ${module.metrics.Ca}, Ce: ${module.metrics.Ce}. `;
170
+ summaryText += `Health: ${health.score}/100.`;
171
+ const warnings = [];
172
+ if (cyclesInvolved.length > 0) {
173
+ warnings.push(`Involved in ${cyclesInvolved.length} cycle(s)`);
174
+ }
175
+ if (health.issues.length > 0) {
176
+ warnings.push(...health.issues);
177
+ }
178
+ const hints = {
179
+ nextActions: health.suggestions,
180
+ warnings: warnings.length > 0 ? warnings : undefined,
181
+ relatedTools: ['drift_coupling action="refactor-impact"', 'drift_impact_analysis'],
182
+ };
183
+ return builder
184
+ .withSummary(summaryText)
185
+ .withData({ module: modulePath, analysis })
186
+ .withHints(hints)
187
+ .buildContent();
188
+ }
189
+ async function handleRefactorImpact(projectRoot, modulePath) {
190
+ const builder = createResponseBuilder();
191
+ if (!modulePath) {
192
+ throw Errors.missingParameter('module');
193
+ }
194
+ const analyzer = await buildAnalyzer(projectRoot);
195
+ const impact = analyzer.analyzeRefactorImpact(modulePath);
196
+ if (!impact) {
197
+ throw Errors.custom('MODULE_NOT_FOUND', `Module not found: ${modulePath}`, ['Check the module path']);
198
+ }
199
+ let summaryText = `🔧 Refactoring ${modulePath}: ${impact.totalAffected} affected modules. `;
200
+ summaryText += `Risk: ${impact.risk.toUpperCase()}.`;
201
+ const hints = {
202
+ nextActions: impact.suggestions,
203
+ warnings: impact.risk === 'critical' || impact.risk === 'high'
204
+ ? [`High risk refactor - ${impact.totalAffected} modules affected`]
205
+ : undefined,
206
+ relatedTools: ['drift_coupling action="analyze"', 'drift_impact_analysis'],
207
+ };
208
+ return builder
209
+ .withSummary(summaryText)
210
+ .withData({ module: modulePath, impact })
211
+ .withHints(hints)
212
+ .buildContent();
213
+ }
214
+ async function handleUnusedExports(projectRoot, limit) {
215
+ const builder = createResponseBuilder();
216
+ const analyzer = await buildAnalyzer(projectRoot);
217
+ const unused = analyzer.getUnusedExports().slice(0, limit ?? 20);
218
+ const totalExports = unused.reduce((sum, u) => sum + u.unusedExports.length, 0);
219
+ let summaryText = `📤 ${unused.length} modules with unused exports. `;
220
+ summaryText += `${totalExports} total unused exports.`;
221
+ const hints = {
222
+ nextActions: unused.length > 0
223
+ ? ['Review unused exports - may be dead code or public API']
224
+ : ['No unused exports found'],
225
+ relatedTools: ['drift_dead_code'],
226
+ };
227
+ return builder
228
+ .withSummary(summaryText)
229
+ .withData({ unused, total: unused.length })
230
+ .withHints(hints)
231
+ .buildContent();
232
+ }
233
+ // ============================================================================
234
+ // Helpers
235
+ // ============================================================================
236
+ async function buildAnalyzer(projectRoot) {
237
+ const callGraphAnalyzer = createCallGraphAnalyzer({ rootDir: projectRoot });
238
+ await callGraphAnalyzer.initialize();
239
+ const callGraph = callGraphAnalyzer.getGraph();
240
+ if (!callGraph) {
241
+ throw Errors.custom('NO_CALL_GRAPH', 'Call graph required for coupling analysis', ['drift callgraph build']);
242
+ }
243
+ const analyzer = createModuleCouplingAnalyzer({ rootDir: projectRoot });
244
+ analyzer.setCallGraph(callGraph);
245
+ analyzer.build();
246
+ return analyzer;
247
+ }
248
+ //# sourceMappingURL=coupling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coupling.js","sourceRoot":"","sources":["../../../src/tools/analysis/coupling.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,GAOxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAsD9E,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,SAAS,GAAG,Q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AK,GAAG;QACZ,WAAW,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC;YAC5B,CAAC,CAAC,CAAC,wDAAwD,CAAC;YAC5D,CAAC,CAAC,CAAC,yBAAyB,CAAC;QAC/B,YAAY,EAAE,CAAC,iBAAiB,CAAC;KAClC,CAAC;IAEF,OAAO,OAAO;SACX,WAAW,CAAC,WAAW,CAAC;SACxB,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;SAC1C,SAAS,CAAC,KAAK,CAAC;SAChB,YAAY,EAAE,CAAC;AACpB,CAAC;AAED,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,KAAK,UAAU,aAAa,CAAC,WAAmB;IAC9C,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IAC5E,MAAM,iBAAiB,CAAC,UAAU,EAAE,CAAC;IACrC,MAAM,SAAS,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IAE/C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,MAAM,CAAC,MAAM,CACjB,eAAe,EACf,2CAA2C,EAC3C,CAAC,uBAAuB,CAAC,CAC1B,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,4BAA4B,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IACxE,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,CAAC;IAEjB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * drift_error_handling - Error Handling Analysis
3
+ *
4
+ * Analysis tool for error handling patterns, boundaries, and gaps.
5
+ * Detects unhandled error paths and swallowed exceptions.
6
+ */
7
+ import { type ErrorHandlingSummary, type ErrorHandlingMetrics, type ErrorHandlingGap, type ErrorBoundary, type UnhandledErrorPath, type FunctionErrorAnalysis, type ErrorSeverity } from 'driftdetect-core';
8
+ export type ErrorHandlingAction = 'status' | 'gaps' | 'boundaries' | 'unhandled' | 'analyze';
9
+ export interface ErrorHandlingArgs {
10
+ action: ErrorHandlingAction;
11
+ function?: string;
12
+ limit?: number;
13
+ minSeverity?: ErrorSeverity;
14
+ }
15
+ export interface ErrorHandlingStatusData {
16
+ summary: ErrorHandlingSummary;
17
+ metrics: ErrorHandlingMetrics;
18
+ generatedAt?: string;
19
+ }
20
+ export interface ErrorHandlingGapsData {
21
+ gaps: ErrorHandlingGap[];
22
+ total: number;
23
+ bySeverity: Record<ErrorSeverity, number>;
24
+ }
25
+ export interface ErrorHandlingBoundariesData {
26
+ boundaries: ErrorBoundary[];
27
+ total: number;
28
+ frameworkBoundaries: number;
29
+ }
30
+ export interface ErrorHandlingUnhandledData {
31
+ paths: UnhandledErrorPath[];
32
+ total: number;
33
+ bySeverity: Record<ErrorSeverity, number>;
34
+ }
35
+ export interface ErrorHandlingAnalyzeData {
36
+ function: string;
37
+ analysis: FunctionErrorAnalysis;
38
+ }
39
+ export declare function handleErrorHandling(projectRoot: string, args: ErrorHandlingArgs): Promise<{
40
+ content: Array<{
41
+ type: string;
42
+ text: string;
43
+ }>;
44
+ }>;
45
+ //# sourceMappingURL=error-handling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../../src/tools/analysis/error-handling.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAO1B,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,WAAW,GACX,SAAS,CAAC;AAEd,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,qBAAqB,CAAC;CACjC;AAaD,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAiB7D"}
@@ -0,0 +1,220 @@
1
+ /**
2
+ * drift_error_handling - Error Handling Analysis
3
+ *
4
+ * Analysis tool for error handling patterns, boundaries, and gaps.
5
+ * Detects unhandled error paths and swallowed exceptions.
6
+ */
7
+ import * as fs from 'node:fs/promises';
8
+ import * as path from 'node:path';
9
+ import { createErrorHandlingAnalyzer, createCallGraphAnalyzer, } from 'driftdetect-core';
10
+ import { createResponseBuilder, Errors } from '../../infrastructure/index.js';
11
+ // ============================================================================
12
+ // Constants
13
+ // ============================================================================
14
+ const DRIFT_DIR = '.drift';
15
+ const ERROR_HANDLING_DIR = 'error-handling';
16
+ // ============================================================================
17
+ // Handler
18
+ // ============================================================================
19
+ export async function handleErrorHandling(projectRoot, args) {
20
+ const { action } = args;
21
+ switch (action) {
22
+ case 'status':
23
+ return handleStatus(projectRoot);
24
+ case 'gaps':
25
+ return handleGaps(projectRoot, args.limit, args.minSeverity);
26
+ case 'boundaries':
27
+ return handleBoundaries(projectRoot);
28
+ case 'unhandled':
29
+ return handleUnhandled(projectRoot, args.minSeverity);
30
+ case 'analyze':
31
+ return handleAnalyze(projectRoot, args.function);
32
+ default:
33
+ throw Errors.invalidArgument('action', `Invalid action: ${action}. Valid: status, gaps, boundaries, unhandled, analyze`);
34
+ }
35
+ }
36
+ // ============================================================================
37
+ // Action Handlers
38
+ // ============================================================================
39
+ async function handleStatus(projectRoot) {
40
+ const builder = createResponseBuilder();
41
+ const dataPath = path.join(projectRoot, DRIFT_DIR, ERROR_HANDLING_DIR, 'topology.json');
42
+ try {
43
+ const data = JSON.parse(await fs.readFile(dataPath, 'utf-8'));
44
+ const { summary, metrics, topology } = data;
45
+ let summaryText = `🛡️ ${summary.totalFunctions} functions. `;
46
+ summaryText += `Coverage: ${summary.coveragePercent}%. `;
47
+ summaryText += `Quality: ${summary.avgQuality}/100. `;
48
+ summaryText += `${summary.unhandledPaths} unhandled paths.`;
49
+ const warnings = [];
50
+ if (summary.criticalUnhandled > 0) {
51
+ warnings.push(`${summary.criticalUnhandled} critical unhandled error paths`);
52
+ }
53
+ if (metrics.swallowedErrorCount > 0) {
54
+ warnings.push(`${metrics.swallowedErrorCount} swallowed errors`);
55
+ }
56
+ const hints = {
57
+ nextActions: summary.unhandledPaths > 0
58
+ ? ['Run drift_error_handling action="gaps" to see specific issues']
59
+ : ['Error handling looks good'],
60
+ warnings: warnings.length > 0 ? warnings : undefined,
61
+ relatedTools: ['drift_error_handling action="gaps"', 'drift_error_handling action="boundaries"'],
62
+ };
63
+ return builder
64
+ .withSummary(summaryText)
65
+ .withData({ summary, metrics, generatedAt: topology.generatedAt })
66
+ .withHints(hints)
67
+ .buildContent();
68
+ }
69
+ catch {
70
+ throw Errors.custom('NO_ERROR_HANDLING_DATA', 'No error handling analysis found. Build it first using the CLI: drift error-handling build', ['drift error-handling build']);
71
+ }
72
+ }
73
+ async function handleGaps(projectRoot, limit, minSeverity) {
74
+ const builder = createResponseBuilder();
75
+ const analyzer = await buildAnalyzer(projectRoot);
76
+ const gaps = analyzer.getGaps({
77
+ limit: limit ?? 20,
78
+ minSeverity: minSeverity ?? 'medium',
79
+ includeSuggestions: true,
80
+ });
81
+ const bySeverity = {
82
+ critical: 0,
83
+ high: 0,
84
+ medium: 0,
85
+ low: 0,
86
+ };
87
+ for (const gap of gaps) {
88
+ bySeverity[gap.severity]++;
89
+ }
90
+ let summaryText = `🔍 ${gaps.length} error handling gaps. `;
91
+ if (bySeverity.critical > 0)
92
+ summaryText += `🔴 ${bySeverity.critical} critical. `;
93
+ if (bySeverity.high > 0)
94
+ summaryText += `🟡 ${bySeverity.high} high. `;
95
+ const hints = {
96
+ nextActions: gaps.length > 0
97
+ ? [`Fix: ${gaps[0]?.suggestion ?? 'Add error handling'}`]
98
+ : ['No gaps found - good error handling!'],
99
+ relatedTools: ['drift_error_handling action="analyze"'],
100
+ };
101
+ return builder
102
+ .withSummary(summaryText)
103
+ .withData({ gaps, total: gaps.length, bySeverity })
104
+ .withHints(hints)
105
+ .buildContent();
106
+ }
107
+ async function handleBoundaries(projectRoot) {
108
+ const builder = createResponseBuilder();
109
+ const dataPath = path.join(projectRoot, DRIFT_DIR, ERROR_HANDLING_DIR, 'topology.json');
110
+ try {
111
+ const data = JSON.parse(await fs.readFile(dataPath, 'utf-8'));
112
+ const boundaries = data.topology.boundaries;
113
+ const frameworkBoundaries = boundaries.filter(b => b.isFrameworkBoundary).length;
114
+ let summaryText = `🛡️ ${boundaries.length} error boundaries. `;
115
+ summaryText += `${frameworkBoundaries} framework boundaries.`;
116
+ const hints = {
117
+ nextActions: boundaries.length === 0
118
+ ? ['Consider adding error boundaries to protect critical paths']
119
+ : ['Review boundary coverage'],
120
+ relatedTools: ['drift_error_handling action="unhandled"'],
121
+ };
122
+ return builder
123
+ .withSummary(summaryText)
124
+ .withData({ boundaries, total: boundaries.length, frameworkBoundaries })
125
+ .withHints(hints)
126
+ .buildContent();
127
+ }
128
+ catch {
129
+ throw Errors.custom('NO_ERROR_HANDLING_DATA', 'No error handling analysis found. Build it first.', ['drift error-handling build']);
130
+ }
131
+ }
132
+ async function handleUnhandled(projectRoot, minSeverity) {
133
+ const builder = createResponseBuilder();
134
+ const dataPath = path.join(projectRoot, DRIFT_DIR, ERROR_HANDLING_DIR, 'topology.json');
135
+ try {
136
+ const data = JSON.parse(await fs.readFile(dataPath, 'utf-8'));
137
+ let paths = data.topology.unhandledPaths;
138
+ // Filter by severity
139
+ if (minSeverity) {
140
+ const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
141
+ const minOrder = severityOrder[minSeverity];
142
+ paths = paths.filter(p => severityOrder[p.severity] <= minOrder);
143
+ }
144
+ const bySeverity = {
145
+ critical: 0,
146
+ high: 0,
147
+ medium: 0,
148
+ low: 0,
149
+ };
150
+ for (const p of paths) {
151
+ bySeverity[p.severity]++;
152
+ }
153
+ let summaryText = `⚠️ ${paths.length} unhandled error paths. `;
154
+ if (bySeverity.critical > 0)
155
+ summaryText += `🔴 ${bySeverity.critical} critical. `;
156
+ if (bySeverity.high > 0)
157
+ summaryText += `🟡 ${bySeverity.high} high.`;
158
+ const hints = {
159
+ nextActions: paths.length > 0
160
+ ? [`Add error boundary at: ${paths[0]?.suggestedBoundary ?? 'entry point'}`]
161
+ : ['All error paths are handled!'],
162
+ warnings: bySeverity.critical > 0
163
+ ? ['Critical unhandled paths can cause application crashes']
164
+ : undefined,
165
+ relatedTools: ['drift_error_handling action="boundaries"'],
166
+ };
167
+ return builder
168
+ .withSummary(summaryText)
169
+ .withData({ paths, total: paths.length, bySeverity })
170
+ .withHints(hints)
171
+ .buildContent();
172
+ }
173
+ catch {
174
+ throw Errors.custom('NO_ERROR_HANDLING_DATA', 'No error handling analysis found. Build it first.', ['drift error-handling build']);
175
+ }
176
+ }
177
+ async function handleAnalyze(projectRoot, funcPath) {
178
+ const builder = createResponseBuilder();
179
+ if (!funcPath) {
180
+ throw Errors.missingParameter('function');
181
+ }
182
+ const analyzer = await buildAnalyzer(projectRoot);
183
+ const analysis = analyzer.getFunctionAnalysis(funcPath);
184
+ if (!analysis) {
185
+ throw Errors.custom('FUNCTION_NOT_FOUND', `Function not found: ${funcPath}`, ['Check the function path']);
186
+ }
187
+ const { profile, issues } = analysis;
188
+ let summaryText = `🔍 ${funcPath}: `;
189
+ summaryText += profile.hasTryCatch ? 'Has error handling. ' : 'No error handling. ';
190
+ summaryText += `Quality: ${profile.qualityScore}/100. `;
191
+ summaryText += `${issues.length} issues.`;
192
+ const hints = {
193
+ nextActions: analysis.suggestions,
194
+ warnings: issues.length > 0
195
+ ? issues.map(i => i.message)
196
+ : undefined,
197
+ relatedTools: ['drift_error_handling action="gaps"'],
198
+ };
199
+ return builder
200
+ .withSummary(summaryText)
201
+ .withData({ function: funcPath, analysis })
202
+ .withHints(hints)
203
+ .buildContent();
204
+ }
205
+ // ============================================================================
206
+ // Helpers
207
+ // ============================================================================
208
+ async function buildAnalyzer(projectRoot) {
209
+ const callGraphAnalyzer = createCallGraphAnalyzer({ rootDir: projectRoot });
210
+ await callGraphAnalyzer.initialize();
211
+ const callGraph = callGraphAnalyzer.getGraph();
212
+ if (!callGraph) {
213
+ throw Errors.custom('NO_CALL_GRAPH', 'Call graph required for error handling analysis', ['drift callgraph build']);
214
+ }
215
+ const analyzer = createErrorHandlingAnalyzer({ rootDir: projectRoot });
216
+ analyzer.setCallGraph(callGraph);
217
+ analyzer.build();
218
+ return analyzer;
219
+ }
220
+ //# sourceMappingURL=error-handling.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handling.js","sourceRoot":"","sources":["../../../src/tools/analysis/error-handling.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,GAQxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAiD9E,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,SAAS,GAAG,QAAQ,CAAC;AAC3B,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAE5C,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,WAAmB,EACnB,IAAuB;IAEvB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAExB,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,YAAY,CAAC,WAAW,CAAC,CAAC;QACnC,KAAK,MAAM;YACT,OAAO,UAAU,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/D,KAAK,YAAY;YACf,OAAO,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACvC,KAAK,WAAW;YACd,OAAO,eAAe,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACxD,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnD;YACE,MAAM,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,mBAAmB,MAAM,uDAAuD,CAAC,CAAC;IAC7H,CAAC;AACH,CAAC;A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AAY,EAAE,CAAC;AACpB,CAAC;AAED,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E,KAAK,UAAU,aAAa,CAAC,WAAmB;IAC9C,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IAC5E,MAAM,iBAAiB,CAAC,UAAU,EAAE,CAAC;IACrC,MAAM,SAAS,GAAG,iBAAiB,CAAC,QAAQ,EAAE,CAAC;IAE/C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,MAAM,CAAC,MAAM,CACjB,eAAe,EACf,iDAAiD,EACjD,CAAC,uBAAuB,CAAC,CAC1B,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,2BAA2B,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IACvE,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,CAAC;IAEjB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Analysis Tools Index
3
+ *
4
+ * Tools for deeper analysis of codebase patterns and quality.
5
+ */
6
+ import type { Tool } from '@modelcontextprotocol/sdk/types.js';
7
+ export declare const ANALYSIS_TOOLS: Tool[];
8
+ export { handleTestTopology, type TestTopologyArgs, type TestTopologyAction } from './test-topology.js';
9
+ export { handleCoupling, type CouplingArgs, type CouplingAction } from './coupling.js';
10
+ export { handleErrorHandling, type ErrorHandlingArgs, type ErrorHandlingAction } from './error-handling.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/analysis/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAM/D,eAAO,MAAM,cAAc,EAAE,IAAI,EAkGhC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxG,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}