driftdetect-mcp 0.4.0 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/bin/server.d.ts +12 -2
- package/dist/bin/server.d.ts.map +1 -1
- package/dist/bin/server.js +25 -5
- package/dist/bin/server.js.map +1 -1
- package/dist/enterprise-server.d.ts +78 -0
- package/dist/enterprise-server.d.ts.map +1 -0
- package/dist/enterprise-server.js +201 -0
- package/dist/enterprise-server.js.map +1 -0
- package/dist/index.d.ts +15 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -1
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/cache.d.ts +86 -0
- package/dist/infrastructure/cache.d.ts.map +1 -0
- package/dist/infrastructure/cache.js +271 -0
- package/dist/infrastructure/cache.js.map +1 -0
- package/dist/infrastructure/cursor-manager.d.ts +86 -0
- package/dist/infrastructure/cursor-manager.d.ts.map +1 -0
- package/dist/infrastructure/cursor-manager.js +175 -0
- package/dist/infrastructure/cursor-manager.js.map +1 -0
- package/dist/infrastructure/error-handler.d.ts +82 -0
- package/dist/infrastructure/error-handler.d.ts.map +1 -0
- package/dist/infrastructure/error-handler.js +226 -0
- package/dist/infrastructure/error-handler.js.map +1 -0
- package/dist/infrastructure/index.d.ts +19 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +26 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/dist/infrastructure/metrics.d.ts +104 -0
- package/dist/infrastructure/metrics.d.ts.map +1 -0
- package/dist/infrastructure/metrics.js +291 -0
- package/dist/infrastructure/metrics.js.map +1 -0
- package/dist/infrastructure/rate-limiter.d.ts +59 -0
- package/dist/infrastructure/rate-limiter.d.ts.map +1 -0
- package/dist/infrastructure/rate-limiter.js +132 -0
- package/dist/infrastructure/rate-limiter.js.map +1 -0
- package/dist/infrastructure/response-builder.d.ts +104 -0
- package/dist/infrastructure/response-builder.d.ts.map +1 -0
- package/dist/infrastructure/response-builder.js +207 -0
- package/dist/infrastructure/response-builder.js.map +1 -0
- package/dist/infrastructure/token-estimator.d.ts +48 -0
- package/dist/infrastructure/token-estimator.d.ts.map +1 -0
- package/dist/infrastructure/token-estimator.js +131 -0
- package/dist/infrastructure/token-estimator.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1074 -17
- package/dist/server.js.map +1 -1
- package/dist/tools/detail/code-examples.d.ts +33 -0
- package/dist/tools/detail/code-examples.d.ts.map +1 -0
- package/dist/tools/detail/code-examples.js +126 -0
- package/dist/tools/detail/code-examples.js.map +1 -0
- package/dist/tools/detail/dna-check.d.ts +32 -0
- package/dist/tools/detail/dna-check.d.ts.map +1 -0
- package/dist/tools/detail/dna-check.js +231 -0
- package/dist/tools/detail/dna-check.js.map +1 -0
- package/dist/tools/detail/dna-profile.d.ts +37 -0
- package/dist/tools/detail/dna-profile.d.ts.map +1 -0
- package/dist/tools/detail/dna-profile.js +101 -0
- package/dist/tools/detail/dna-profile.js.map +1 -0
- package/dist/tools/detail/file-patterns.d.ts +39 -0
- package/dist/tools/detail/file-patterns.d.ts.map +1 -0
- package/dist/tools/detail/file-patterns.js +103 -0
- package/dist/tools/detail/file-patterns.js.map +1 -0
- package/dist/tools/detail/files-list.d.ts +30 -0
- package/dist/tools/detail/files-list.d.ts.map +1 -0
- package/dist/tools/detail/files-list.js +99 -0
- package/dist/tools/detail/files-list.js.map +1 -0
- package/dist/tools/detail/impact-analysis.d.ts +53 -0
- package/dist/tools/detail/impact-analysis.d.ts.map +1 -0
- package/dist/tools/detail/impact-analysis.js +130 -0
- package/dist/tools/detail/impact-analysis.js.map +1 -0
- package/dist/tools/detail/index.d.ts +23 -0
- package/dist/tools/detail/index.d.ts.map +1 -0
- package/dist/tools/detail/index.js +200 -0
- package/dist/tools/detail/index.js.map +1 -0
- package/dist/tools/detail/pattern-get.d.ts +45 -0
- package/dist/tools/detail/pattern-get.d.ts.map +1 -0
- package/dist/tools/detail/pattern-get.js +87 -0
- package/dist/tools/detail/pattern-get.js.map +1 -0
- package/dist/tools/detail/reachability.d.ts +60 -0
- package/dist/tools/detail/reachability.d.ts.map +1 -0
- package/dist/tools/detail/reachability.js +168 -0
- package/dist/tools/detail/reachability.js.map +1 -0
- package/dist/tools/discovery/capabilities.d.ts +28 -0
- package/dist/tools/discovery/capabilities.d.ts.map +1 -0
- package/dist/tools/discovery/capabilities.js +112 -0
- package/dist/tools/discovery/capabilities.js.map +1 -0
- package/dist/tools/discovery/index.d.ts +13 -0
- package/dist/tools/discovery/index.d.ts.map +1 -0
- package/dist/tools/discovery/index.js +30 -0
- package/dist/tools/discovery/index.js.map +1 -0
- package/dist/tools/discovery/projects.d.ts +26 -0
- package/dist/tools/discovery/projects.d.ts.map +1 -0
- package/dist/tools/discovery/projects.js +210 -0
- package/dist/tools/discovery/projects.js.map +1 -0
- package/dist/tools/discovery/status.d.ts +42 -0
- package/dist/tools/discovery/status.d.ts.map +1 -0
- package/dist/tools/discovery/status.js +157 -0
- package/dist/tools/discovery/status.js.map +1 -0
- package/dist/tools/exploration/contracts-list.d.ts +35 -0
- package/dist/tools/exploration/contracts-list.d.ts.map +1 -0
- package/dist/tools/exploration/contracts-list.js +106 -0
- package/dist/tools/exploration/contracts-list.js.map +1 -0
- package/dist/tools/exploration/files-list.d.ts +29 -0
- package/dist/tools/exploration/files-list.d.ts.map +1 -0
- package/dist/tools/exploration/files-list.js +94 -0
- package/dist/tools/exploration/files-list.js.map +1 -0
- package/dist/tools/exploration/index.d.ts +17 -0
- package/dist/tools/exploration/index.d.ts.map +1 -0
- package/dist/tools/exploration/index.js +126 -0
- package/dist/tools/exploration/index.js.map +1 -0
- package/dist/tools/exploration/patterns-list.d.ts +40 -0
- package/dist/tools/exploration/patterns-list.d.ts.map +1 -0
- package/dist/tools/exploration/patterns-list.js +172 -0
- package/dist/tools/exploration/patterns-list.js.map +1 -0
- package/dist/tools/exploration/security-summary.d.ts +49 -0
- package/dist/tools/exploration/security-summary.d.ts.map +1 -0
- package/dist/tools/exploration/security-summary.js +111 -0
- package/dist/tools/exploration/security-summary.js.map +1 -0
- package/dist/tools/exploration/trends.d.ts +49 -0
- package/dist/tools/exploration/trends.d.ts.map +1 -0
- package/dist/tools/exploration/trends.js +147 -0
- package/dist/tools/exploration/trends.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +13 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/orchestration/context.d.ts +72 -0
- package/dist/tools/orchestration/context.d.ts.map +1 -0
- package/dist/tools/orchestration/context.js +499 -0
- package/dist/tools/orchestration/context.js.map +1 -0
- package/dist/tools/orchestration/index.d.ts +11 -0
- package/dist/tools/orchestration/index.d.ts.map +1 -0
- package/dist/tools/orchestration/index.js +56 -0
- package/dist/tools/orchestration/index.js.map +1 -0
- package/dist/tools/registry.d.ts +41 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +64 -0
- package/dist/tools/registry.js.map +1 -0
- package/package.json +11 -11
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* drift_dna_check - Styling DNA Validation
|
|
3
|
+
*
|
|
4
|
+
* Detail tool that checks if code follows established styling DNA.
|
|
5
|
+
* Use before generating component code to ensure consistency.
|
|
6
|
+
*/
|
|
7
|
+
import type { DNAStore } from 'driftdetect-core';
|
|
8
|
+
export interface GeneViolation {
|
|
9
|
+
gene: string;
|
|
10
|
+
expected: string;
|
|
11
|
+
found: string;
|
|
12
|
+
line?: number;
|
|
13
|
+
suggestion: string;
|
|
14
|
+
}
|
|
15
|
+
export interface DNACheckData {
|
|
16
|
+
passed: boolean;
|
|
17
|
+
score: number;
|
|
18
|
+
violations: GeneViolation[];
|
|
19
|
+
genesChecked: string[];
|
|
20
|
+
recommendations: string[];
|
|
21
|
+
}
|
|
22
|
+
export declare function handleDnaCheck(store: DNAStore, projectRoot: string, args: {
|
|
23
|
+
code?: string;
|
|
24
|
+
file?: string;
|
|
25
|
+
genes?: string[];
|
|
26
|
+
}): Promise<{
|
|
27
|
+
content: Array<{
|
|
28
|
+
type: string;
|
|
29
|
+
text: string;
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=dna-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dna-check.d.ts","sourceRoot":"","sources":["../../../src/tools/detail/dna-check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIjD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAWD,wBAAsB,cAAc,CAClC,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE;IACJ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,GACA,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAwG7D"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* drift_dna_check - Styling DNA Validation
|
|
3
|
+
*
|
|
4
|
+
* Detail tool that checks if code follows established styling DNA.
|
|
5
|
+
* Use before generating component code to ensure consistency.
|
|
6
|
+
*/
|
|
7
|
+
import { createResponseBuilder, Errors } from '../../infrastructure/index.js';
|
|
8
|
+
import * as fs from 'fs/promises';
|
|
9
|
+
const VALID_GENES = [
|
|
10
|
+
'variant-handling',
|
|
11
|
+
'responsive-approach',
|
|
12
|
+
'state-styling',
|
|
13
|
+
'theming',
|
|
14
|
+
'spacing-philosophy',
|
|
15
|
+
'animation-approach',
|
|
16
|
+
];
|
|
17
|
+
export async function handleDnaCheck(store, projectRoot, args) {
|
|
18
|
+
const builder = createResponseBuilder();
|
|
19
|
+
if (!args.code && !args.file) {
|
|
20
|
+
throw Errors.missingParameter('code or file');
|
|
21
|
+
}
|
|
22
|
+
// Validate genes
|
|
23
|
+
const genesToCheck = args.genes ?? VALID_GENES;
|
|
24
|
+
for (const gene of genesToCheck) {
|
|
25
|
+
if (!VALID_GENES.includes(gene)) {
|
|
26
|
+
throw Errors.invalidParameter('genes', `Invalid gene: ${gene}. Valid: ${VALID_GENES.join(', ')}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
await store.initialize();
|
|
30
|
+
// Get code to check
|
|
31
|
+
let code = args.code;
|
|
32
|
+
if (args.file) {
|
|
33
|
+
try {
|
|
34
|
+
code = await fs.readFile(`${projectRoot}/${args.file}`, 'utf-8');
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
throw Errors.notFound('file', args.file);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!code) {
|
|
41
|
+
throw Errors.missingParameter('code');
|
|
42
|
+
}
|
|
43
|
+
// Get DNA profile
|
|
44
|
+
const dna = store.getDNA();
|
|
45
|
+
if (!dna) {
|
|
46
|
+
return builder
|
|
47
|
+
.withSummary('No styling DNA profile found. Run drift scan with DNA analysis enabled.')
|
|
48
|
+
.withData({
|
|
49
|
+
passed: true,
|
|
50
|
+
score: 100,
|
|
51
|
+
violations: [],
|
|
52
|
+
genesChecked: [],
|
|
53
|
+
recommendations: ['Run drift scan to build DNA profile'],
|
|
54
|
+
})
|
|
55
|
+
.buildContent();
|
|
56
|
+
}
|
|
57
|
+
// Check code against DNA
|
|
58
|
+
const violations = [];
|
|
59
|
+
const recommendations = [];
|
|
60
|
+
for (const gene of genesToCheck) {
|
|
61
|
+
const geneProfile = dna.genes[gene];
|
|
62
|
+
if (!geneProfile)
|
|
63
|
+
continue;
|
|
64
|
+
const geneViolations = checkGene(code, gene, geneProfile);
|
|
65
|
+
violations.push(...geneViolations);
|
|
66
|
+
}
|
|
67
|
+
// Calculate score
|
|
68
|
+
const maxViolations = genesToCheck.length * 3; // Assume max 3 violations per gene
|
|
69
|
+
const score = Math.max(0, Math.round(100 - (violations.length / maxViolations) * 100));
|
|
70
|
+
const passed = violations.length === 0;
|
|
71
|
+
// Generate recommendations
|
|
72
|
+
if (violations.length > 0) {
|
|
73
|
+
const violatedGenes = [...new Set(violations.map(v => v.gene))];
|
|
74
|
+
for (const gene of violatedGenes) {
|
|
75
|
+
const geneViolations = violations.filter(v => v.gene === gene);
|
|
76
|
+
recommendations.push(`${gene}: ${geneViolations[0].suggestion}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const data = {
|
|
80
|
+
passed,
|
|
81
|
+
score,
|
|
82
|
+
violations,
|
|
83
|
+
genesChecked: genesToCheck,
|
|
84
|
+
recommendations,
|
|
85
|
+
};
|
|
86
|
+
// Build summary
|
|
87
|
+
let summary = passed
|
|
88
|
+
? `✓ Code follows styling DNA (${score}/100).`
|
|
89
|
+
: `⚠️ ${violations.length} DNA violations found (${score}/100).`;
|
|
90
|
+
return builder
|
|
91
|
+
.withSummary(summary)
|
|
92
|
+
.withData(data)
|
|
93
|
+
.withHints({
|
|
94
|
+
nextActions: passed
|
|
95
|
+
? ['Code is consistent with codebase styling patterns']
|
|
96
|
+
: [
|
|
97
|
+
'Fix violations before committing',
|
|
98
|
+
'Use drift_code_examples to see correct implementations',
|
|
99
|
+
],
|
|
100
|
+
warnings: violations.length > 0
|
|
101
|
+
? [`${violations.length} styling inconsistencies detected`]
|
|
102
|
+
: undefined,
|
|
103
|
+
relatedTools: ['drift_code_examples', 'drift_file_patterns'],
|
|
104
|
+
})
|
|
105
|
+
.buildContent();
|
|
106
|
+
}
|
|
107
|
+
function checkGene(code, gene, profile) {
|
|
108
|
+
const violations = [];
|
|
109
|
+
// Check for anti-patterns
|
|
110
|
+
if (profile.antiPatterns) {
|
|
111
|
+
for (const antiPattern of profile.antiPatterns) {
|
|
112
|
+
const regex = new RegExp(antiPattern, 'g');
|
|
113
|
+
const matches = code.match(regex);
|
|
114
|
+
if (matches) {
|
|
115
|
+
violations.push({
|
|
116
|
+
gene,
|
|
117
|
+
expected: profile.dominant,
|
|
118
|
+
found: antiPattern,
|
|
119
|
+
suggestion: `Use ${profile.dominant} instead of ${antiPattern}`,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Gene-specific checks
|
|
125
|
+
switch (gene) {
|
|
126
|
+
case 'variant-handling':
|
|
127
|
+
checkVariantHandling(code, profile, violations);
|
|
128
|
+
break;
|
|
129
|
+
case 'responsive-approach':
|
|
130
|
+
checkResponsiveApproach(code, profile, violations);
|
|
131
|
+
break;
|
|
132
|
+
case 'state-styling':
|
|
133
|
+
checkStateStyling(code, profile, violations);
|
|
134
|
+
break;
|
|
135
|
+
case 'theming':
|
|
136
|
+
checkTheming(code, profile, violations);
|
|
137
|
+
break;
|
|
138
|
+
case 'spacing-philosophy':
|
|
139
|
+
checkSpacing(code, profile, violations);
|
|
140
|
+
break;
|
|
141
|
+
case 'animation-approach':
|
|
142
|
+
checkAnimation(code, profile, violations);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
return violations;
|
|
146
|
+
}
|
|
147
|
+
function checkVariantHandling(code, profile, violations) {
|
|
148
|
+
// Check for inline conditionals when cva/variants expected
|
|
149
|
+
if (profile.dominant === 'cva' || profile.dominant === 'variants') {
|
|
150
|
+
const inlineConditionals = code.match(/className=\{.*\?.*:.*\}/g);
|
|
151
|
+
if (inlineConditionals && inlineConditionals.length > 2) {
|
|
152
|
+
violations.push({
|
|
153
|
+
gene: 'variant-handling',
|
|
154
|
+
expected: profile.dominant,
|
|
155
|
+
found: 'inline-conditionals',
|
|
156
|
+
suggestion: `Use ${profile.dominant} for variant handling instead of inline conditionals`,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function checkResponsiveApproach(code, profile, violations) {
|
|
162
|
+
// Check for media queries when tailwind breakpoints expected
|
|
163
|
+
if (profile.dominant === 'tailwind-breakpoints') {
|
|
164
|
+
const mediaQueries = code.match(/@media\s*\(/g);
|
|
165
|
+
if (mediaQueries && mediaQueries.length > 1) {
|
|
166
|
+
violations.push({
|
|
167
|
+
gene: 'responsive-approach',
|
|
168
|
+
expected: 'tailwind-breakpoints',
|
|
169
|
+
found: 'media-queries',
|
|
170
|
+
suggestion: 'Use Tailwind responsive prefixes (sm:, md:, lg:) instead of @media queries',
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function checkStateStyling(code, profile, violations) {
|
|
176
|
+
// Check for inline state handling when data-attributes expected
|
|
177
|
+
if (profile.dominant === 'data-attributes') {
|
|
178
|
+
const inlineStates = code.match(/\{.*isActive.*\?/g);
|
|
179
|
+
if (inlineStates) {
|
|
180
|
+
violations.push({
|
|
181
|
+
gene: 'state-styling',
|
|
182
|
+
expected: 'data-attributes',
|
|
183
|
+
found: 'inline-state-conditionals',
|
|
184
|
+
suggestion: 'Use data-[state=active] attributes for state styling',
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function checkTheming(code, profile, violations) {
|
|
190
|
+
// Check for hardcoded colors when CSS variables expected
|
|
191
|
+
if (profile.dominant === 'css-variables') {
|
|
192
|
+
const hardcodedColors = code.match(/#[0-9a-fA-F]{3,6}|rgb\(|rgba\(/g);
|
|
193
|
+
if (hardcodedColors && hardcodedColors.length > 3) {
|
|
194
|
+
violations.push({
|
|
195
|
+
gene: 'theming',
|
|
196
|
+
expected: 'css-variables',
|
|
197
|
+
found: 'hardcoded-colors',
|
|
198
|
+
suggestion: 'Use CSS variables (var(--color-*)) instead of hardcoded colors',
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function checkSpacing(code, profile, violations) {
|
|
204
|
+
// Check for arbitrary spacing when design tokens expected
|
|
205
|
+
if (profile.dominant === 'design-tokens') {
|
|
206
|
+
const arbitrarySpacing = code.match(/\[(\d+)px\]/g);
|
|
207
|
+
if (arbitrarySpacing && arbitrarySpacing.length > 2) {
|
|
208
|
+
violations.push({
|
|
209
|
+
gene: 'spacing-philosophy',
|
|
210
|
+
expected: 'design-tokens',
|
|
211
|
+
found: 'arbitrary-values',
|
|
212
|
+
suggestion: 'Use spacing tokens (p-4, m-2) instead of arbitrary pixel values',
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
function checkAnimation(code, profile, violations) {
|
|
218
|
+
// Check for inline transitions when Tailwind animations expected
|
|
219
|
+
if (profile.dominant === 'tailwind-animations') {
|
|
220
|
+
const inlineTransitions = code.match(/transition:\s*[^;]+;/g);
|
|
221
|
+
if (inlineTransitions && inlineTransitions.length > 1) {
|
|
222
|
+
violations.push({
|
|
223
|
+
gene: 'animation-approach',
|
|
224
|
+
expected: 'tailwind-animations',
|
|
225
|
+
found: 'inline-transitions',
|
|
226
|
+
suggestion: 'Use Tailwind transition utilities (transition-all, duration-200)',
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=dna-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dna-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,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC9D,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtD,UAAU,CAAC,IAAI,CAAC;gBACd,IAAI,EAAE,oBAAoB;gBAC1B,QAAQ,EAAE,qBAAqB;gBAC/B,KAAK,EAAE,oBAAoB;gBAC3B,UAAU,EAAE,kEAAkE;aAC/E,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* drift_dna_profile - Styling DNA Profile
|
|
3
|
+
*
|
|
4
|
+
* Detail tool that returns the complete styling DNA profile for the codebase.
|
|
5
|
+
* Shows how components are styled with confidence scores and exemplar files.
|
|
6
|
+
*/
|
|
7
|
+
import type { DNAStore } from 'driftdetect-core';
|
|
8
|
+
export interface GeneProfile {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
dominantApproach: string;
|
|
12
|
+
confidence: number;
|
|
13
|
+
alternatives: Array<{
|
|
14
|
+
approach: string;
|
|
15
|
+
frequency: number;
|
|
16
|
+
}>;
|
|
17
|
+
exemplarFiles: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface DNAProfileData {
|
|
20
|
+
healthScore: number;
|
|
21
|
+
geneticDiversity: number;
|
|
22
|
+
genes: GeneProfile[];
|
|
23
|
+
summary: {
|
|
24
|
+
totalGenes: number;
|
|
25
|
+
highConfidenceGenes: number;
|
|
26
|
+
lowConfidenceGenes: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare function handleDNAProfile(store: DNAStore, args: {
|
|
30
|
+
gene?: string;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
content: Array<{
|
|
33
|
+
type: string;
|
|
34
|
+
text: string;
|
|
35
|
+
}>;
|
|
36
|
+
}>;
|
|
37
|
+
//# sourceMappingURL=dna-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dna-profile.d.ts","sourceRoot":"","sources":["../../../src/tools/detail/dna-profile.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AAGzD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,KAAK,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;IACH,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,kBAAkB,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH;AAWD,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE;IACJ,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GACA,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAqG7D"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* drift_dna_profile - Styling DNA Profile
|
|
3
|
+
*
|
|
4
|
+
* Detail tool that returns the complete styling DNA profile for the codebase.
|
|
5
|
+
* Shows how components are styled with confidence scores and exemplar files.
|
|
6
|
+
*/
|
|
7
|
+
import { createResponseBuilder, Errors } from '../../infrastructure/index.js';
|
|
8
|
+
const GENE_NAMES = {
|
|
9
|
+
'variant-handling': 'Variant Handling',
|
|
10
|
+
'responsive-approach': 'Responsive Approach',
|
|
11
|
+
'state-styling': 'State Styling',
|
|
12
|
+
'theming': 'Theming',
|
|
13
|
+
'spacing-philosophy': 'Spacing Philosophy',
|
|
14
|
+
'animation-approach': 'Animation Approach',
|
|
15
|
+
};
|
|
16
|
+
export async function handleDNAProfile(store, args) {
|
|
17
|
+
const builder = createResponseBuilder();
|
|
18
|
+
await store.initialize();
|
|
19
|
+
const profile = store.getProfile();
|
|
20
|
+
if (!profile) {
|
|
21
|
+
throw Errors.custom('NO_DNA_PROFILE', 'No DNA profile found. Run drift dna scan first.', ['drift dna scan']);
|
|
22
|
+
}
|
|
23
|
+
// Filter by specific gene if requested
|
|
24
|
+
let geneIds = Object.keys(profile.genes);
|
|
25
|
+
if (args.gene) {
|
|
26
|
+
if (!profile.genes[args.gene]) {
|
|
27
|
+
throw Errors.notFound('gene', args.gene);
|
|
28
|
+
}
|
|
29
|
+
geneIds = [args.gene];
|
|
30
|
+
}
|
|
31
|
+
// Map genes to profile format
|
|
32
|
+
const genes = geneIds.map(geneId => {
|
|
33
|
+
const gene = profile.genes[geneId];
|
|
34
|
+
if (!gene) {
|
|
35
|
+
return {
|
|
36
|
+
id: geneId,
|
|
37
|
+
name: GENE_NAMES[geneId] ?? geneId,
|
|
38
|
+
dominantApproach: 'unknown',
|
|
39
|
+
confidence: 0,
|
|
40
|
+
alternatives: [],
|
|
41
|
+
exemplarFiles: [],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// Get dominant allele and alternatives
|
|
45
|
+
const dominant = gene.dominant;
|
|
46
|
+
const alternatives = gene.alleles
|
|
47
|
+
.filter(a => !a.isDominant)
|
|
48
|
+
.slice(0, 3)
|
|
49
|
+
.map(allele => ({
|
|
50
|
+
approach: allele.name,
|
|
51
|
+
frequency: Math.round(allele.frequency * 100) / 100,
|
|
52
|
+
}));
|
|
53
|
+
return {
|
|
54
|
+
id: geneId,
|
|
55
|
+
name: GENE_NAMES[geneId] ?? geneId,
|
|
56
|
+
dominantApproach: dominant?.name ?? 'unknown',
|
|
57
|
+
confidence: Math.round(gene.confidence * 100) / 100,
|
|
58
|
+
alternatives,
|
|
59
|
+
exemplarFiles: gene.exemplars.slice(0, 3),
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
// Calculate summary stats
|
|
63
|
+
const highConfidenceGenes = genes.filter(g => g.confidence >= 0.7).length;
|
|
64
|
+
const lowConfidenceGenes = genes.filter(g => g.confidence < 0.5).length;
|
|
65
|
+
const data = {
|
|
66
|
+
healthScore: Math.round(profile.summary.healthScore * 100) / 100,
|
|
67
|
+
geneticDiversity: Math.round(profile.summary.geneticDiversity * 100) / 100,
|
|
68
|
+
genes,
|
|
69
|
+
summary: {
|
|
70
|
+
totalGenes: genes.length,
|
|
71
|
+
highConfidenceGenes,
|
|
72
|
+
lowConfidenceGenes,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
// Build summary
|
|
76
|
+
const healthEmoji = profile.summary.healthScore >= 0.8 ? '🟢' :
|
|
77
|
+
profile.summary.healthScore >= 0.6 ? '🟡' : '🔴';
|
|
78
|
+
let summary = `${healthEmoji} Health: ${Math.round(profile.summary.healthScore * 100)}%. `;
|
|
79
|
+
summary += `${genes.length} genes analyzed, ${highConfidenceGenes} high confidence.`;
|
|
80
|
+
if (profile.summary.geneticDiversity > 0.5) {
|
|
81
|
+
summary += ` High diversity (${Math.round(profile.summary.geneticDiversity * 100)}%) - consider consolidating approaches.`;
|
|
82
|
+
}
|
|
83
|
+
const hints = {
|
|
84
|
+
nextActions: [
|
|
85
|
+
'Use drift_dna_check to validate new code against DNA',
|
|
86
|
+
'Use drift_mutations to find files that deviate from patterns',
|
|
87
|
+
],
|
|
88
|
+
relatedTools: ['drift_dna_check', 'drift_mutations', 'drift_playbook'],
|
|
89
|
+
};
|
|
90
|
+
if (lowConfidenceGenes > 0) {
|
|
91
|
+
hints.warnings = [
|
|
92
|
+
`${lowConfidenceGenes} gene(s) have low confidence - patterns may be inconsistent`,
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
return builder
|
|
96
|
+
.withSummary(summary)
|
|
97
|
+
.withData(data)
|
|
98
|
+
.withHints(hints)
|
|
99
|
+
.buildContent();
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=dna-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dna-profile.js","sourceRoot":"","sources":["../../../src/tools/detail/dna-profile.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAyB9E,MAAM,UAAU,GAA2B;IACzC,kBAAkB,EAAE,kBAAkB;IACtC,qBAAqB,EAAE,qBAAqB;IAC5C,eAAe,EAAE,eAAe;IAChC,SAAS,EAAE,SAAS;IACpB,oBAAoB,EAAE,oBAAoB;IAC1C,oBAAoB,EAAE,oBAAoB;CAC3C,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAe,EACf,IAEC;IAED,MAAM,OAAO,GAAG,qBAAqB,EAAkB,CAAC;IAExD,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;IAEnC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,MAAM,CAAC,MAAM,CACjB,gBAAgB,EAChB,iDAAiD,EACjD,CAAC,gBAAgB,CAAC,CACnB,CAAC;IACJ,CAAC;IAED,uCAAuC;IACvC,IAAI,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAa,CAAC;IACrD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAc,CAAC,EAAE,CAAC;YACxC,MAAM,MAAM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,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,GAAG,GAAG,CAAC,yCAAyC,CAAC;IAC7H,CAAC;IAED,MAAM,KAAK,GAA2E;QACpF,WAAW,EAAE;YACX,sDAAsD;YACtD,8DAA8D;SAC/D;QACD,YAAY,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,CAAC;KACvE,CAAC;IAEF,IAAI,kBAAkB,GAAG,CAAC,EAAE,CAAC;QAC3B,KAAK,CAAC,QAAQ,GAAG;YACf,GAAG,kBAAkB,6DAA6D;SACnF,CAAC;IACJ,CAAC;IAED,OAAO,OAAO;SACX,WAAW,CAAC,OAAO,CAAC;SACpB,QAAQ,CAAC,IAAI,CAAC;SACd,SAAS,CAAC,KAAK,CAAC;SAChB,YAAY,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* drift_file_patterns - Patterns in a Specific File
|
|
3
|
+
*
|
|
4
|
+
* Detail tool that returns all patterns found in a specific file.
|
|
5
|
+
* Shows pattern details, locations within the file, and outliers.
|
|
6
|
+
*/
|
|
7
|
+
import type { ManifestStore } from 'driftdetect-core';
|
|
8
|
+
export interface FilePatternLocation {
|
|
9
|
+
line: number;
|
|
10
|
+
column?: number;
|
|
11
|
+
snippet?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FilePattern {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
category: string;
|
|
17
|
+
subcategory: string;
|
|
18
|
+
confidence: number;
|
|
19
|
+
locations: FilePatternLocation[];
|
|
20
|
+
isOutlier: boolean;
|
|
21
|
+
outlierReason?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface FilePatternData {
|
|
24
|
+
file: string;
|
|
25
|
+
patterns: FilePattern[];
|
|
26
|
+
patternCount: number;
|
|
27
|
+
outlierCount: number;
|
|
28
|
+
categories: string[];
|
|
29
|
+
}
|
|
30
|
+
export declare function handleFilePatterns(store: ManifestStore, args: {
|
|
31
|
+
file: string;
|
|
32
|
+
category?: string;
|
|
33
|
+
}): Promise<{
|
|
34
|
+
content: Array<{
|
|
35
|
+
type: string;
|
|
36
|
+
text: string;
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
39
|
+
//# sourceMappingURL=file-patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-patterns.d.ts","sourceRoot":"","sources":["../../../src/tools/detail/file-patterns.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE;IACJ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACA,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA+G7D"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* drift_file_patterns - Patterns in a Specific File
|
|
3
|
+
*
|
|
4
|
+
* Detail tool that returns all patterns found in a specific file.
|
|
5
|
+
* Shows pattern details, locations within the file, and outliers.
|
|
6
|
+
*/
|
|
7
|
+
import { createResponseBuilder, Errors } from '../../infrastructure/index.js';
|
|
8
|
+
export async function handleFilePatterns(store, args) {
|
|
9
|
+
const builder = createResponseBuilder();
|
|
10
|
+
if (!args.file) {
|
|
11
|
+
throw Errors.missingParameter('file');
|
|
12
|
+
}
|
|
13
|
+
await store.load();
|
|
14
|
+
const manifest = await store.get();
|
|
15
|
+
// Normalize file path
|
|
16
|
+
const filePath = args.file.replace(/^\.\//, '');
|
|
17
|
+
// Check if file exists in manifest
|
|
18
|
+
const fileEntry = manifest.files[filePath];
|
|
19
|
+
if (!fileEntry) {
|
|
20
|
+
throw Errors.notFound('file', filePath);
|
|
21
|
+
}
|
|
22
|
+
// Get patterns for this file
|
|
23
|
+
const patterns = [];
|
|
24
|
+
const categories = new Set();
|
|
25
|
+
let outlierCount = 0;
|
|
26
|
+
for (const patternId of fileEntry.patterns) {
|
|
27
|
+
const pattern = manifest.patterns[patternId];
|
|
28
|
+
if (!pattern)
|
|
29
|
+
continue;
|
|
30
|
+
// Filter by category if specified
|
|
31
|
+
if (args.category && pattern.category !== args.category) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
categories.add(pattern.category);
|
|
35
|
+
// Get locations in this file
|
|
36
|
+
const fileLocations = pattern.locations
|
|
37
|
+
.filter(loc => loc.file === filePath)
|
|
38
|
+
.map(loc => {
|
|
39
|
+
const result = {
|
|
40
|
+
line: loc.range.start,
|
|
41
|
+
};
|
|
42
|
+
if (loc.snippet) {
|
|
43
|
+
result.snippet = loc.snippet;
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
});
|
|
47
|
+
// Check if this file is an outlier for this pattern
|
|
48
|
+
const outlier = pattern.outliers.find(o => o.file === filePath);
|
|
49
|
+
if (outlier) {
|
|
50
|
+
outlierCount++;
|
|
51
|
+
}
|
|
52
|
+
const patternEntry = {
|
|
53
|
+
id: pattern.id,
|
|
54
|
+
name: pattern.name,
|
|
55
|
+
category: pattern.category,
|
|
56
|
+
subcategory: pattern.subcategory ?? '',
|
|
57
|
+
confidence: Math.round(pattern.confidence * 100) / 100,
|
|
58
|
+
locations: fileLocations,
|
|
59
|
+
isOutlier: !!outlier,
|
|
60
|
+
};
|
|
61
|
+
if (outlier) {
|
|
62
|
+
patternEntry.outlierReason = 'Deviates from pattern';
|
|
63
|
+
}
|
|
64
|
+
patterns.push(patternEntry);
|
|
65
|
+
}
|
|
66
|
+
// Sort by category, then by name
|
|
67
|
+
patterns.sort((a, b) => {
|
|
68
|
+
if (a.category !== b.category)
|
|
69
|
+
return a.category.localeCompare(b.category);
|
|
70
|
+
return a.name.localeCompare(b.name);
|
|
71
|
+
});
|
|
72
|
+
const data = {
|
|
73
|
+
file: filePath,
|
|
74
|
+
patterns,
|
|
75
|
+
patternCount: patterns.length,
|
|
76
|
+
outlierCount,
|
|
77
|
+
categories: Array.from(categories).sort(),
|
|
78
|
+
};
|
|
79
|
+
// Build summary
|
|
80
|
+
let summary = `${filePath}: ${patterns.length} patterns`;
|
|
81
|
+
if (outlierCount > 0) {
|
|
82
|
+
summary += ` (${outlierCount} outliers)`;
|
|
83
|
+
}
|
|
84
|
+
summary += `. Categories: ${Array.from(categories).join(', ') || 'none'}.`;
|
|
85
|
+
const hints = {
|
|
86
|
+
nextActions: [
|
|
87
|
+
'Use drift_pattern_get for full pattern details',
|
|
88
|
+
'Use drift_code_examples to see implementations',
|
|
89
|
+
],
|
|
90
|
+
relatedTools: ['drift_pattern_get', 'drift_code_examples', 'drift_files_list'],
|
|
91
|
+
};
|
|
92
|
+
if (outlierCount > 0) {
|
|
93
|
+
hints.warnings = [
|
|
94
|
+
`${outlierCount} pattern(s) deviate from codebase conventions in this file`,
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
return builder
|
|
98
|
+
.withSummary(summary)
|
|
99
|
+
.withData(data)
|
|
100
|
+
.withHints(hints)
|
|
101
|
+
.buildContent();
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=file-patterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-patterns.js","sourceRoot":"","sources":["../../../src/tools/detail/file-patterns.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AA2B9E,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAAoB,EACpB,IAGC;IAED,MAAM,OAAO,GAAG,qBAAqB,EAAmB,CAAC;IAEzD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;IACnB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC;IAEnC,sBAAsB;IACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAEhD,mCAAmC;IACnC,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,6BAA6B;IAC7B,MAAM,QAAQ,GAAkB,EAAE,CAAC;IACnC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IACrC,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,KAAK,MAAM,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AG,CAAC,EAAE,CAAC;QACrB,KAAK,CAAC,QAAQ,GAAG;YACf,GAAG,YAAY,4DAA4D;SAC5E,CAAC;IACJ,CAAC;IAED,OAAO,OAAO;SACX,WAAW,CAAC,OAAO,CAAC;SACpB,QAAQ,CAAC,IAAI,CAAC;SACd,SAAS,CAAC,KAAK,CAAC;SAChB,YAAY,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* drift_files_list - List Files with Patterns
|
|
3
|
+
*
|
|
4
|
+
* Detail tool that lists files matching a glob pattern with their pattern counts.
|
|
5
|
+
* Supports pagination for large codebases.
|
|
6
|
+
*/
|
|
7
|
+
import type { ManifestStore } from 'driftdetect-core';
|
|
8
|
+
export interface FileEntry {
|
|
9
|
+
file: string;
|
|
10
|
+
patternCount: number;
|
|
11
|
+
categories: string[];
|
|
12
|
+
lastScanned?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FilesListData {
|
|
15
|
+
files: FileEntry[];
|
|
16
|
+
totalFiles: number;
|
|
17
|
+
totalPatterns: number;
|
|
18
|
+
}
|
|
19
|
+
export declare function handleFilesList(store: ManifestStore, args: {
|
|
20
|
+
path?: string;
|
|
21
|
+
category?: string;
|
|
22
|
+
limit?: number;
|
|
23
|
+
cursor?: string;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
content: Array<{
|
|
26
|
+
type: string;
|
|
27
|
+
text: string;
|
|
28
|
+
}>;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=files-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files-list.d.ts","sourceRoot":"","sources":["../../../src/tools/detail/files-list.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAID,wBAAsB,eAAe,CACnC,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE;IACJ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA2F7D"}
|