code-sentinel-mcp 0.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.
- package/README.md +149 -0
- package/build/analyzers/deceptive.d.ts +2 -0
- package/build/analyzers/deceptive.js +200 -0
- package/build/analyzers/errors.d.ts +2 -0
- package/build/analyzers/errors.js +214 -0
- package/build/analyzers/patterns.d.ts +138 -0
- package/build/analyzers/patterns.js +801 -0
- package/build/analyzers/placeholders.d.ts +2 -0
- package/build/analyzers/placeholders.js +216 -0
- package/build/analyzers/security.d.ts +2 -0
- package/build/analyzers/security.js +238 -0
- package/build/analyzers/strengths.d.ts +2 -0
- package/build/analyzers/strengths.js +169 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +366 -0
- package/build/report.d.ts +2 -0
- package/build/report.js +228 -0
- package/build/types.d.ts +54 -0
- package/build/types.js +2 -0
- package/package.json +38 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Severity } from '../types.js';
|
|
2
|
+
export type PatternLevel = 'architectural' | 'design' | 'code' | 'all';
|
|
3
|
+
export interface DetectedPattern {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
level: PatternLevel;
|
|
7
|
+
confidence: 'high' | 'medium' | 'low';
|
|
8
|
+
description: string;
|
|
9
|
+
locations: Array<{
|
|
10
|
+
line: number;
|
|
11
|
+
code: string;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
export interface PatternInconsistency {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
level: PatternLevel;
|
|
18
|
+
severity: Severity;
|
|
19
|
+
description: string;
|
|
20
|
+
variants: Array<{
|
|
21
|
+
approach: string;
|
|
22
|
+
locations: Array<{
|
|
23
|
+
line: number;
|
|
24
|
+
code: string;
|
|
25
|
+
}>;
|
|
26
|
+
count: number;
|
|
27
|
+
}>;
|
|
28
|
+
recommendation: string;
|
|
29
|
+
}
|
|
30
|
+
export interface PatternSuggestion {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
level: PatternLevel;
|
|
34
|
+
priority: 'high' | 'medium' | 'low';
|
|
35
|
+
currentApproach: {
|
|
36
|
+
name: string;
|
|
37
|
+
description: string;
|
|
38
|
+
example: string;
|
|
39
|
+
line?: number;
|
|
40
|
+
};
|
|
41
|
+
suggestedApproach: {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
why: string;
|
|
45
|
+
benefits: string[];
|
|
46
|
+
tradeoffs: string[];
|
|
47
|
+
example: string;
|
|
48
|
+
};
|
|
49
|
+
action: {
|
|
50
|
+
type: 'refactor' | 'add' | 'replace' | 'consider';
|
|
51
|
+
description: string;
|
|
52
|
+
steps: string[];
|
|
53
|
+
codeChange?: {
|
|
54
|
+
before: string;
|
|
55
|
+
after: string;
|
|
56
|
+
file?: string;
|
|
57
|
+
line?: number;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface PatternAnalysisResult {
|
|
62
|
+
level: PatternLevel;
|
|
63
|
+
summary: {
|
|
64
|
+
patternsDetected: number;
|
|
65
|
+
inconsistencies: number;
|
|
66
|
+
suggestions: number;
|
|
67
|
+
overallConsistency: 'high' | 'medium' | 'low';
|
|
68
|
+
};
|
|
69
|
+
detectedPatterns: DetectedPattern[];
|
|
70
|
+
inconsistencies: PatternInconsistency[];
|
|
71
|
+
suggestions: PatternSuggestion[];
|
|
72
|
+
actionItems: ActionItem[];
|
|
73
|
+
}
|
|
74
|
+
export interface ActionItem {
|
|
75
|
+
id: string;
|
|
76
|
+
priority: 1 | 2 | 3;
|
|
77
|
+
type: 'fix_inconsistency' | 'implement_pattern' | 'refactor';
|
|
78
|
+
title: string;
|
|
79
|
+
reason: string;
|
|
80
|
+
effort: 'low' | 'medium' | 'high';
|
|
81
|
+
steps: Array<{
|
|
82
|
+
order: number;
|
|
83
|
+
instruction: string;
|
|
84
|
+
code?: {
|
|
85
|
+
action: 'insert' | 'replace' | 'delete';
|
|
86
|
+
target: string;
|
|
87
|
+
content: string;
|
|
88
|
+
};
|
|
89
|
+
}>;
|
|
90
|
+
acceptPrompt: string;
|
|
91
|
+
}
|
|
92
|
+
export declare function analyzePatterns(code: string, filename: string, level?: PatternLevel): PatternAnalysisResult;
|
|
93
|
+
export declare function inferLevelFromQuery(query: string): PatternLevel | null;
|
|
94
|
+
export interface DesignPatternResult {
|
|
95
|
+
patterns: Array<{
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
confidence: 'high' | 'medium' | 'low';
|
|
99
|
+
description: string;
|
|
100
|
+
locations: Array<{
|
|
101
|
+
line: number;
|
|
102
|
+
code: string;
|
|
103
|
+
}>;
|
|
104
|
+
relatedPatterns?: string[];
|
|
105
|
+
}>;
|
|
106
|
+
suggestions: Array<{
|
|
107
|
+
id: string;
|
|
108
|
+
title: string;
|
|
109
|
+
priority: 'high' | 'medium' | 'low';
|
|
110
|
+
currentApproach: string;
|
|
111
|
+
suggestedPattern: string;
|
|
112
|
+
why: string;
|
|
113
|
+
benefits: string[];
|
|
114
|
+
tradeoffs: string[];
|
|
115
|
+
example: string;
|
|
116
|
+
}>;
|
|
117
|
+
actionItems: Array<{
|
|
118
|
+
id: string;
|
|
119
|
+
priority: 1 | 2 | 3;
|
|
120
|
+
type: 'implement_pattern' | 'refactor' | 'consider';
|
|
121
|
+
title: string;
|
|
122
|
+
reason: string;
|
|
123
|
+
effort: 'low' | 'medium' | 'high';
|
|
124
|
+
steps: Array<{
|
|
125
|
+
order: number;
|
|
126
|
+
instruction: string;
|
|
127
|
+
}>;
|
|
128
|
+
acceptPrompt: string;
|
|
129
|
+
}>;
|
|
130
|
+
summary: {
|
|
131
|
+
patternsDetected: number;
|
|
132
|
+
suggestionsCount: number;
|
|
133
|
+
dominantPatterns: string[];
|
|
134
|
+
missingPatterns: string[];
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export declare function analyzeDesignPatterns(code: string, filename: string): DesignPatternResult;
|
|
138
|
+
export declare function formatDesignAnalysis(result: DesignPatternResult): string;
|