@eduardbar/drift 0.9.1 → 1.1.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 (129) hide show
  1. package/.github/actions/drift-scan/README.md +61 -0
  2. package/.github/actions/drift-scan/action.yml +65 -0
  3. package/.github/workflows/publish-vscode.yml +78 -0
  4. package/AGENTS.md +83 -23
  5. package/README.md +69 -2
  6. package/ROADMAP.md +130 -98
  7. package/dist/analyzer.d.ts +8 -38
  8. package/dist/analyzer.js +181 -1526
  9. package/dist/badge.js +40 -22
  10. package/dist/ci.js +32 -18
  11. package/dist/cli.js +125 -4
  12. package/dist/config.js +1 -1
  13. package/dist/diff.d.ts +0 -7
  14. package/dist/diff.js +26 -25
  15. package/dist/fix.d.ts +17 -0
  16. package/dist/fix.js +132 -0
  17. package/dist/git/blame.d.ts +22 -0
  18. package/dist/git/blame.js +227 -0
  19. package/dist/git/helpers.d.ts +36 -0
  20. package/dist/git/helpers.js +152 -0
  21. package/dist/git/trend.d.ts +21 -0
  22. package/dist/git/trend.js +81 -0
  23. package/dist/git.d.ts +0 -13
  24. package/dist/git.js +27 -21
  25. package/dist/index.d.ts +5 -1
  26. package/dist/index.js +3 -0
  27. package/dist/map.d.ts +3 -0
  28. package/dist/map.js +103 -0
  29. package/dist/metrics.d.ts +4 -0
  30. package/dist/metrics.js +176 -0
  31. package/dist/plugins.d.ts +6 -0
  32. package/dist/plugins.js +74 -0
  33. package/dist/printer.js +20 -0
  34. package/dist/report.js +654 -293
  35. package/dist/reporter.js +85 -2
  36. package/dist/review.d.ts +15 -0
  37. package/dist/review.js +80 -0
  38. package/dist/rules/comments.d.ts +4 -0
  39. package/dist/rules/comments.js +45 -0
  40. package/dist/rules/complexity.d.ts +4 -0
  41. package/dist/rules/complexity.js +51 -0
  42. package/dist/rules/coupling.d.ts +4 -0
  43. package/dist/rules/coupling.js +19 -0
  44. package/dist/rules/magic.d.ts +4 -0
  45. package/dist/rules/magic.js +33 -0
  46. package/dist/rules/nesting.d.ts +5 -0
  47. package/dist/rules/nesting.js +82 -0
  48. package/dist/rules/phase0-basic.d.ts +11 -0
  49. package/dist/rules/phase0-basic.js +183 -0
  50. package/dist/rules/phase1-complexity.d.ts +7 -0
  51. package/dist/rules/phase1-complexity.js +8 -0
  52. package/dist/rules/phase2-crossfile.d.ts +23 -0
  53. package/dist/rules/phase2-crossfile.js +135 -0
  54. package/dist/rules/phase3-arch.d.ts +23 -0
  55. package/dist/rules/phase3-arch.js +151 -0
  56. package/dist/rules/phase3-configurable.d.ts +6 -0
  57. package/dist/rules/phase3-configurable.js +97 -0
  58. package/dist/rules/phase5-ai.d.ts +8 -0
  59. package/dist/rules/phase5-ai.js +262 -0
  60. package/dist/rules/phase8-semantic.d.ts +17 -0
  61. package/dist/rules/phase8-semantic.js +110 -0
  62. package/dist/rules/promise.d.ts +4 -0
  63. package/dist/rules/promise.js +24 -0
  64. package/dist/rules/shared.d.ts +7 -0
  65. package/dist/rules/shared.js +27 -0
  66. package/dist/snapshot.d.ts +19 -0
  67. package/dist/snapshot.js +119 -0
  68. package/dist/types.d.ts +69 -0
  69. package/dist/utils.d.ts +2 -1
  70. package/dist/utils.js +1 -0
  71. package/docs/AGENTS.md +146 -0
  72. package/docs/PRD.md +208 -0
  73. package/package.json +8 -3
  74. package/packages/eslint-plugin-drift/src/index.ts +1 -1
  75. package/packages/vscode-drift/.vscodeignore +9 -0
  76. package/packages/vscode-drift/LICENSE +21 -0
  77. package/packages/vscode-drift/README.md +64 -0
  78. package/packages/vscode-drift/images/icon.png +0 -0
  79. package/packages/vscode-drift/images/icon.svg +30 -0
  80. package/packages/vscode-drift/package-lock.json +485 -0
  81. package/packages/vscode-drift/package.json +119 -0
  82. package/packages/vscode-drift/src/analyzer.ts +40 -0
  83. package/packages/vscode-drift/src/diagnostics.ts +55 -0
  84. package/packages/vscode-drift/src/extension.ts +135 -0
  85. package/packages/vscode-drift/src/statusbar.ts +55 -0
  86. package/packages/vscode-drift/src/treeview.ts +110 -0
  87. package/packages/vscode-drift/tsconfig.json +18 -0
  88. package/packages/vscode-drift/vscode-drift-0.1.0.vsix +0 -0
  89. package/packages/vscode-drift/vscode-drift-0.1.1.vsix +0 -0
  90. package/src/analyzer.ts +248 -1765
  91. package/src/badge.ts +38 -16
  92. package/src/ci.ts +38 -17
  93. package/src/cli.ts +143 -4
  94. package/src/config.ts +1 -1
  95. package/src/diff.ts +36 -30
  96. package/src/fix.ts +178 -0
  97. package/src/git/blame.ts +279 -0
  98. package/src/git/helpers.ts +198 -0
  99. package/src/git/trend.ts +117 -0
  100. package/src/git.ts +33 -24
  101. package/src/index.ts +16 -1
  102. package/src/map.ts +117 -0
  103. package/src/metrics.ts +200 -0
  104. package/src/plugins.ts +76 -0
  105. package/src/printer.ts +20 -0
  106. package/src/report.ts +666 -296
  107. package/src/reporter.ts +95 -2
  108. package/src/review.ts +98 -0
  109. package/src/rules/comments.ts +56 -0
  110. package/src/rules/complexity.ts +57 -0
  111. package/src/rules/coupling.ts +23 -0
  112. package/src/rules/magic.ts +38 -0
  113. package/src/rules/nesting.ts +88 -0
  114. package/src/rules/phase0-basic.ts +194 -0
  115. package/src/rules/phase1-complexity.ts +8 -0
  116. package/src/rules/phase2-crossfile.ts +177 -0
  117. package/src/rules/phase3-arch.ts +183 -0
  118. package/src/rules/phase3-configurable.ts +132 -0
  119. package/src/rules/phase5-ai.ts +292 -0
  120. package/src/rules/phase8-semantic.ts +136 -0
  121. package/src/rules/promise.ts +29 -0
  122. package/src/rules/shared.ts +39 -0
  123. package/src/snapshot.ts +175 -0
  124. package/src/types.ts +75 -1
  125. package/src/utils.ts +3 -1
  126. package/tests/helpers.ts +45 -0
  127. package/tests/new-features.test.ts +153 -0
  128. package/tests/rules.test.ts +1269 -0
  129. package/vitest.config.ts +15 -0
package/dist/map.js ADDED
@@ -0,0 +1,103 @@
1
+ import { writeFileSync } from 'node:fs';
2
+ import { resolve, relative } from 'node:path';
3
+ import { Project } from 'ts-morph';
4
+ function detectLayer(relPath) {
5
+ const normalized = relPath.replace(/\\/g, '/').replace(/^\.\//, '');
6
+ const first = normalized.split('/')[0] || 'root';
7
+ return first;
8
+ }
9
+ function esc(value) {
10
+ return value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
11
+ }
12
+ export function generateArchitectureSvg(targetPath) {
13
+ const project = new Project({
14
+ skipAddingFilesFromTsConfig: true,
15
+ compilerOptions: { allowJs: true, jsx: 1 },
16
+ });
17
+ project.addSourceFilesAtPaths([
18
+ `${targetPath}/**/*.ts`,
19
+ `${targetPath}/**/*.tsx`,
20
+ `${targetPath}/**/*.js`,
21
+ `${targetPath}/**/*.jsx`,
22
+ `!${targetPath}/**/node_modules/**`,
23
+ `!${targetPath}/**/dist/**`,
24
+ `!${targetPath}/**/.next/**`,
25
+ `!${targetPath}/**/*.d.ts`,
26
+ ]);
27
+ const layers = new Map();
28
+ const edges = new Map();
29
+ for (const file of project.getSourceFiles()) {
30
+ const rel = relative(targetPath, file.getFilePath()).replace(/\\/g, '/');
31
+ const layerName = detectLayer(rel);
32
+ if (!layers.has(layerName))
33
+ layers.set(layerName, { name: layerName, files: new Set() });
34
+ layers.get(layerName).files.add(rel);
35
+ for (const decl of file.getImportDeclarations()) {
36
+ const imported = decl.getModuleSpecifierSourceFile();
37
+ if (!imported)
38
+ continue;
39
+ const importedRel = relative(targetPath, imported.getFilePath()).replace(/\\/g, '/');
40
+ const importedLayer = detectLayer(importedRel);
41
+ if (importedLayer === layerName)
42
+ continue;
43
+ const key = `${layerName}->${importedLayer}`;
44
+ edges.set(key, (edges.get(key) ?? 0) + 1);
45
+ }
46
+ }
47
+ const layerList = [...layers.values()].sort((a, b) => a.name.localeCompare(b.name));
48
+ const width = 960;
49
+ const rowHeight = 90;
50
+ const height = Math.max(180, layerList.length * rowHeight + 120);
51
+ const boxWidth = 240;
52
+ const boxHeight = 50;
53
+ const left = 100;
54
+ const boxes = layerList.map((layer, index) => {
55
+ const y = 60 + index * rowHeight;
56
+ return {
57
+ ...layer,
58
+ x: left,
59
+ y,
60
+ };
61
+ });
62
+ const boxByName = new Map(boxes.map((box) => [box.name, box]));
63
+ const lines = [...edges.entries()].map(([key, count]) => {
64
+ const [from, to] = key.split('->');
65
+ const a = boxByName.get(from);
66
+ const b = boxByName.get(to);
67
+ if (!a || !b)
68
+ return '';
69
+ const startX = a.x + boxWidth;
70
+ const startY = a.y + boxHeight / 2;
71
+ const endX = b.x;
72
+ const endY = b.y + boxHeight / 2;
73
+ return `
74
+ <line x1="${startX}" y1="${startY}" x2="${endX}" y2="${endY}" stroke="#64748b" stroke-width="2" marker-end="url(#arrow)" />
75
+ <text x="${(startX + endX) / 2}" y="${(startY + endY) / 2 - 4}" fill="#94a3b8" font-size="11" text-anchor="middle">${count}</text>`;
76
+ }).join('');
77
+ const nodes = boxes.map((box) => `
78
+ <g>
79
+ <rect x="${box.x}" y="${box.y}" width="${boxWidth}" height="${boxHeight}" rx="8" fill="#0f172a" stroke="#334155" />
80
+ <text x="${box.x + 12}" y="${box.y + 22}" fill="#e2e8f0" font-size="13" font-family="monospace">${esc(box.name)}</text>
81
+ <text x="${box.x + 12}" y="${box.y + 38}" fill="#94a3b8" font-size="11" font-family="monospace">${box.files.size} file(s)</text>
82
+ </g>`).join('');
83
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">
84
+ <defs>
85
+ <marker id="arrow" markerWidth="10" markerHeight="10" refX="6" refY="3" orient="auto">
86
+ <path d="M0,0 L0,6 L7,3 z" fill="#64748b"/>
87
+ </marker>
88
+ </defs>
89
+ <rect x="0" y="0" width="${width}" height="${height}" fill="#020617" />
90
+ <text x="28" y="34" fill="#f8fafc" font-size="16" font-family="monospace">drift architecture map</text>
91
+ <text x="28" y="54" fill="#94a3b8" font-size="11" font-family="monospace">Layers inferred from top-level directories</text>
92
+ ${lines}
93
+ ${nodes}
94
+ </svg>`;
95
+ }
96
+ export function generateArchitectureMap(targetPath, outputFile = 'architecture.svg') {
97
+ const resolvedTarget = resolve(targetPath);
98
+ const svg = generateArchitectureSvg(resolvedTarget);
99
+ const outPath = resolve(outputFile);
100
+ writeFileSync(outPath, svg, 'utf8');
101
+ return outPath;
102
+ }
103
+ //# sourceMappingURL=map.js.map
@@ -0,0 +1,4 @@
1
+ import type { DriftReport, FileReport, MaintenanceRiskMetrics, RepoQualityScore } from './types.js';
2
+ export declare function computeRepoQuality(targetPath: string, files: FileReport[]): RepoQualityScore;
3
+ export declare function computeMaintenanceRisk(report: DriftReport): MaintenanceRiskMetrics;
4
+ //# sourceMappingURL=metrics.d.ts.map
@@ -0,0 +1,176 @@
1
+ import { existsSync, readdirSync, statSync } from 'node:fs';
2
+ import { execSync } from 'node:child_process';
3
+ import { join, relative } from 'node:path';
4
+ const ARCH_RULES = new Set([
5
+ 'circular-dependency',
6
+ 'layer-violation',
7
+ 'cross-boundary-import',
8
+ 'controller-no-db',
9
+ 'service-no-http',
10
+ ]);
11
+ const COMPLEXITY_RULES = new Set([
12
+ 'large-file',
13
+ 'large-function',
14
+ 'high-complexity',
15
+ 'deep-nesting',
16
+ 'too-many-params',
17
+ 'max-function-lines',
18
+ ]);
19
+ const AI_RULES = new Set([
20
+ 'over-commented',
21
+ 'hardcoded-config',
22
+ 'inconsistent-error-handling',
23
+ 'unnecessary-abstraction',
24
+ 'naming-inconsistency',
25
+ 'comment-contradiction',
26
+ 'ai-code-smell',
27
+ ]);
28
+ function clamp(value, min, max) {
29
+ return Math.max(min, Math.min(max, value));
30
+ }
31
+ function listFilesRecursively(root) {
32
+ if (!existsSync(root))
33
+ return [];
34
+ const out = [];
35
+ const stack = [root];
36
+ while (stack.length > 0) {
37
+ const current = stack.pop();
38
+ const entries = readdirSync(current);
39
+ for (const entry of entries) {
40
+ const full = join(current, entry);
41
+ const stat = statSync(full);
42
+ if (stat.isDirectory()) {
43
+ if (entry === 'node_modules' || entry === 'dist' || entry === '.git' || entry === '.next' || entry === 'build') {
44
+ continue;
45
+ }
46
+ stack.push(full);
47
+ }
48
+ else {
49
+ out.push(full);
50
+ }
51
+ }
52
+ }
53
+ return out;
54
+ }
55
+ function hasNearbyTest(targetPath, filePath) {
56
+ const rel = relative(targetPath, filePath).replace(/\\/g, '/');
57
+ const noExt = rel.replace(/\.[^.]+$/, '');
58
+ const candidates = [
59
+ `${noExt}.test.ts`,
60
+ `${noExt}.test.tsx`,
61
+ `${noExt}.spec.ts`,
62
+ `${noExt}.spec.tsx`,
63
+ `${noExt}.test.js`,
64
+ `${noExt}.spec.js`,
65
+ ];
66
+ return candidates.some((candidate) => existsSync(join(targetPath, candidate)));
67
+ }
68
+ function getCommitTouchCount(targetPath, filePath) {
69
+ try {
70
+ const rel = relative(targetPath, filePath).replace(/\\/g, '/');
71
+ const output = execSync(`git rev-list --count HEAD -- "${rel}"`, {
72
+ cwd: targetPath,
73
+ encoding: 'utf8',
74
+ stdio: ['pipe', 'pipe', 'pipe'],
75
+ }).trim();
76
+ return Number(output) || 0;
77
+ }
78
+ catch {
79
+ return 0;
80
+ }
81
+ }
82
+ function qualityFromIssues(totalFiles, issues, rules) {
83
+ const count = issues.filter((issue) => rules.has(issue.rule)).length;
84
+ if (totalFiles === 0)
85
+ return 100;
86
+ return clamp(100 - Math.round((count / totalFiles) * 20), 0, 100);
87
+ }
88
+ export function computeRepoQuality(targetPath, files) {
89
+ const allIssues = files.flatMap((file) => file.issues);
90
+ const sourceFiles = files.filter((file) => !file.path.endsWith('package.json'));
91
+ const totalFiles = Math.max(sourceFiles.length, 1);
92
+ const testingCandidates = listFilesRecursively(targetPath).filter((filePath) => /\.(ts|tsx|js|jsx)$/.test(filePath) &&
93
+ !/\.test\.|\.spec\./.test(filePath) &&
94
+ !filePath.includes('node_modules'));
95
+ const withoutTests = testingCandidates.filter((filePath) => !hasNearbyTest(targetPath, filePath)).length;
96
+ const testing = testingCandidates.length === 0
97
+ ? 100
98
+ : clamp(100 - Math.round((withoutTests / testingCandidates.length) * 100), 0, 100);
99
+ const dimensions = {
100
+ architecture: qualityFromIssues(totalFiles, allIssues, ARCH_RULES),
101
+ complexity: qualityFromIssues(totalFiles, allIssues, COMPLEXITY_RULES),
102
+ 'ai-patterns': qualityFromIssues(totalFiles, allIssues, AI_RULES),
103
+ testing,
104
+ };
105
+ const overall = Math.round((dimensions.architecture +
106
+ dimensions.complexity +
107
+ dimensions['ai-patterns'] +
108
+ dimensions.testing) / 4);
109
+ return { overall, dimensions };
110
+ }
111
+ export function computeMaintenanceRisk(report) {
112
+ const allFiles = report.files;
113
+ const hotspots = allFiles
114
+ .map((file) => {
115
+ const complexityIssues = file.issues.filter((issue) => issue.rule === 'high-complexity' ||
116
+ issue.rule === 'deep-nesting' ||
117
+ issue.rule === 'large-function' ||
118
+ issue.rule === 'max-function-lines').length;
119
+ const changeFrequency = getCommitTouchCount(report.targetPath, file.path);
120
+ const hasTests = hasNearbyTest(report.targetPath, file.path);
121
+ const reasons = [];
122
+ let risk = 0;
123
+ if (complexityIssues > 0) {
124
+ risk += Math.min(40, complexityIssues * 10);
125
+ reasons.push('high complexity signals');
126
+ }
127
+ if (!hasTests) {
128
+ risk += 25;
129
+ reasons.push('no nearby tests');
130
+ }
131
+ if (changeFrequency >= 8) {
132
+ risk += 20;
133
+ reasons.push('frequently changed file');
134
+ }
135
+ if (file.score >= 50) {
136
+ risk += 15;
137
+ reasons.push('high drift score');
138
+ }
139
+ return {
140
+ file: file.path,
141
+ driftScore: file.score,
142
+ complexityIssues,
143
+ hasNearbyTests: hasTests,
144
+ changeFrequency,
145
+ risk: clamp(risk, 0, 100),
146
+ reasons,
147
+ };
148
+ })
149
+ .filter((hotspot) => hotspot.risk > 0)
150
+ .sort((a, b) => b.risk - a.risk)
151
+ .slice(0, 10);
152
+ const highComplexityFiles = hotspots.filter((hotspot) => hotspot.complexityIssues > 0).length;
153
+ const filesWithoutNearbyTests = hotspots.filter((hotspot) => !hotspot.hasNearbyTests).length;
154
+ const frequentChangeFiles = hotspots.filter((hotspot) => hotspot.changeFrequency >= 8).length;
155
+ const score = hotspots.length === 0
156
+ ? 0
157
+ : Math.round(hotspots.reduce((sum, hotspot) => sum + hotspot.risk, 0) / hotspots.length);
158
+ const level = score >= 75
159
+ ? 'critical'
160
+ : score >= 55
161
+ ? 'high'
162
+ : score >= 30
163
+ ? 'medium'
164
+ : 'low';
165
+ return {
166
+ score,
167
+ level,
168
+ hotspots,
169
+ signals: {
170
+ highComplexityFiles,
171
+ filesWithoutNearbyTests,
172
+ frequentChangeFiles,
173
+ },
174
+ };
175
+ }
176
+ //# sourceMappingURL=metrics.js.map
@@ -0,0 +1,6 @@
1
+ import type { PluginLoadError, LoadedPlugin } from './types.js';
2
+ export declare function loadPlugins(projectRoot: string, pluginIds: string[] | undefined): {
3
+ plugins: LoadedPlugin[];
4
+ errors: PluginLoadError[];
5
+ };
6
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1,74 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { isAbsolute, resolve } from 'node:path';
3
+ import { createRequire } from 'node:module';
4
+ const require = createRequire(import.meta.url);
5
+ function isPluginShape(value) {
6
+ if (!value || typeof value !== 'object')
7
+ return false;
8
+ const candidate = value;
9
+ if (typeof candidate.name !== 'string')
10
+ return false;
11
+ if (!Array.isArray(candidate.rules))
12
+ return false;
13
+ return candidate.rules.every((rule) => rule &&
14
+ typeof rule === 'object' &&
15
+ typeof rule.name === 'string' &&
16
+ typeof rule.detect === 'function');
17
+ }
18
+ function normalizePluginExport(mod) {
19
+ if (isPluginShape(mod))
20
+ return mod;
21
+ if (mod && typeof mod === 'object' && 'default' in mod) {
22
+ const maybeDefault = mod.default;
23
+ if (isPluginShape(maybeDefault))
24
+ return maybeDefault;
25
+ }
26
+ return undefined;
27
+ }
28
+ function resolvePluginSpecifier(projectRoot, pluginId) {
29
+ if (pluginId.startsWith('.') || pluginId.startsWith('/')) {
30
+ const abs = isAbsolute(pluginId) ? pluginId : resolve(projectRoot, pluginId);
31
+ if (existsSync(abs))
32
+ return abs;
33
+ if (existsSync(`${abs}.js`))
34
+ return `${abs}.js`;
35
+ if (existsSync(`${abs}.cjs`))
36
+ return `${abs}.cjs`;
37
+ if (existsSync(`${abs}.mjs`))
38
+ return `${abs}.mjs`;
39
+ if (existsSync(`${abs}.ts`))
40
+ return `${abs}.ts`;
41
+ return abs;
42
+ }
43
+ return pluginId;
44
+ }
45
+ export function loadPlugins(projectRoot, pluginIds) {
46
+ if (!pluginIds || pluginIds.length === 0) {
47
+ return { plugins: [], errors: [] };
48
+ }
49
+ const loaded = [];
50
+ const errors = [];
51
+ for (const pluginId of pluginIds) {
52
+ const resolved = resolvePluginSpecifier(projectRoot, pluginId);
53
+ try {
54
+ const mod = require(resolved);
55
+ const plugin = normalizePluginExport(mod);
56
+ if (!plugin) {
57
+ errors.push({
58
+ pluginId,
59
+ message: `Invalid plugin contract in '${pluginId}'. Expected: { name, rules[] }`,
60
+ });
61
+ continue;
62
+ }
63
+ loaded.push({ id: pluginId, plugin });
64
+ }
65
+ catch (error) {
66
+ errors.push({
67
+ pluginId,
68
+ message: error instanceof Error ? error.message : String(error),
69
+ });
70
+ }
71
+ }
72
+ return { plugins: loaded, errors };
73
+ }
74
+ //# sourceMappingURL=plugins.js.map
package/dist/printer.js CHANGED
@@ -111,6 +111,26 @@ function formatFixSuggestion(issue) {
111
111
  'Pick one naming convention (camelCase for variables/functions, PascalCase for types)',
112
112
  'Rename snake_case identifiers to camelCase to match TypeScript conventions',
113
113
  ],
114
+ 'controller-no-db': [
115
+ 'Move DB access to a service/repository and inject it into the controller',
116
+ 'Keep controllers focused on transport and orchestration only',
117
+ ],
118
+ 'service-no-http': [
119
+ 'Move HTTP concerns to adapters/clients and keep services framework-agnostic',
120
+ 'Inject interfaces for outbound calls instead of calling fetch/express directly',
121
+ ],
122
+ 'max-function-lines': [
123
+ 'Split the function into smaller units with clear responsibilities',
124
+ 'Extract branch-heavy chunks into dedicated helpers',
125
+ ],
126
+ 'ai-code-smell': [
127
+ 'Address the listed AI-smell signals in this file before adding more code',
128
+ 'Prioritize consistency: naming, error handling, and abstraction level',
129
+ ],
130
+ 'plugin-error': [
131
+ 'Fix or remove the failing plugin in drift.config.*',
132
+ 'Validate plugin contract: export { name, rules[] } and detector functions',
133
+ ],
114
134
  };
115
135
  return suggestions[issue.rule] ?? ['Review and fix manually'];
116
136
  }