deep-slop 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.deep-slop/.deep-slop-ignore +13 -0
- package/LICENSE +21 -0
- package/README.md +1170 -0
- package/dist/arch-constraints-C7s1E_bc.js +450 -0
- package/dist/arch-rules-DI1SYPqu.js +358 -0
- package/dist/ast-slop-BGdr58wZ.js +1839 -0
- package/dist/config-lint-ph3vMUbg.js +371 -0
- package/dist/dead-flow-DHRkyxZT.js +1422 -0
- package/dist/deep-slop-bundled.js +33140 -0
- package/dist/discover-B_S_Fy2S.js +164 -0
- package/dist/dup-detect-DKRXM04q.js +709 -0
- package/dist/file-utils-B_HFXhCs.js +93 -0
- package/dist/format-lint-DeElllNm.js +445 -0
- package/dist/framework-lint-CqdlF9hX.js +782 -0
- package/dist/i18n-lint-CPzx7V8Q.js +605 -0
- package/dist/import-intelligence-SK4F7XpL.js +966 -0
- package/dist/index.d.ts +233 -0
- package/dist/index.js +1030 -0
- package/dist/knip-CgxnnTBZ.js +93 -0
- package/dist/lint-external-ZbW3jGvB.js +326 -0
- package/dist/markup-lint-DKVEDz9M.js +805 -0
- package/dist/mcp.js +35939 -0
- package/dist/meta-quality-Dai1W5iC.js +224 -0
- package/dist/perf-hints-BnWFMFff.js +500 -0
- package/dist/security-deep-DJRINs10.js +1198 -0
- package/dist/syntax-deep-ZQYMutky.js +624 -0
- package/dist/tree-sitter-CM-cP0nl.js +661 -0
- package/dist/type-safety-Dboj2C1t.js +519 -0
- package/package.json +92 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/config/schema.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Full DeepSlop configuration schema — the final validated shape
|
|
6
|
+
* after merging with defaults. All sections are required.
|
|
7
|
+
*/
|
|
8
|
+
declare const DeepSlopConfigSchema: z.ZodObject<{
|
|
9
|
+
engines: z.ZodRecord<z.ZodString, z.ZodBoolean>;
|
|
10
|
+
quality: z.ZodObject<{
|
|
11
|
+
maxFunctionLoc: z.ZodNumber;
|
|
12
|
+
maxFileLoc: z.ZodNumber;
|
|
13
|
+
maxNesting: z.ZodNumber;
|
|
14
|
+
maxParams: z.ZodNumber;
|
|
15
|
+
maxCyclomatic: z.ZodNumber;
|
|
16
|
+
maxCoupling: z.ZodNumber;
|
|
17
|
+
}, z.core.$loose>;
|
|
18
|
+
security: z.ZodObject<{
|
|
19
|
+
audit: z.ZodBoolean;
|
|
20
|
+
auditTimeout: z.ZodNumber;
|
|
21
|
+
owasp: z.ZodBoolean;
|
|
22
|
+
}, z.core.$loose>;
|
|
23
|
+
imports: z.ZodObject<{
|
|
24
|
+
suggestAlternatives: z.ZodBoolean;
|
|
25
|
+
optimizeBarrels: z.ZodBoolean;
|
|
26
|
+
validateAliases: z.ZodBoolean;
|
|
27
|
+
buildGraph: z.ZodBoolean;
|
|
28
|
+
maxCircularDepth: z.ZodNumber;
|
|
29
|
+
}, z.core.$loose>;
|
|
30
|
+
types: z.ZodObject<{
|
|
31
|
+
flagAsAny: z.ZodBoolean;
|
|
32
|
+
suggestTypes: z.ZodBoolean;
|
|
33
|
+
flagDoubleAssertion: z.ZodBoolean;
|
|
34
|
+
}, z.core.$loose>;
|
|
35
|
+
deadCode: z.ZodObject<{
|
|
36
|
+
unreachableBranches: z.ZodBoolean;
|
|
37
|
+
unusedExports: z.ZodBoolean;
|
|
38
|
+
unusedVariables: z.ZodBoolean;
|
|
39
|
+
}, z.core.$loose>;
|
|
40
|
+
i18n: z.ZodObject<{
|
|
41
|
+
hardcodedStrings: z.ZodBoolean;
|
|
42
|
+
validateKeys: z.ZodBoolean;
|
|
43
|
+
}, z.core.$loose>;
|
|
44
|
+
scoring: z.ZodDefault<z.ZodObject<{
|
|
45
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
46
|
+
logarithmic: "logarithmic";
|
|
47
|
+
linear: "linear";
|
|
48
|
+
}>>;
|
|
49
|
+
smoothing: z.ZodDefault<z.ZodNumber>;
|
|
50
|
+
maxPerRule: z.ZodDefault<z.ZodNumber>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
telemetry: z.ZodDefault<z.ZodObject<{
|
|
53
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
exclude: z.ZodArray<z.ZodString>;
|
|
56
|
+
ignore: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
57
|
+
ci: z.ZodDefault<z.ZodObject<{
|
|
58
|
+
failBelow: z.ZodDefault<z.ZodNumber>;
|
|
59
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
60
|
+
json: "json";
|
|
61
|
+
human: "human";
|
|
62
|
+
sarif: "sarif";
|
|
63
|
+
}>>;
|
|
64
|
+
failOnErrors: z.ZodDefault<z.ZodBoolean>;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEnum<{
|
|
67
|
+
error: "error";
|
|
68
|
+
warning: "warning";
|
|
69
|
+
info: "info";
|
|
70
|
+
off: "off";
|
|
71
|
+
}>>>;
|
|
72
|
+
}, z.core.$loose>;
|
|
73
|
+
/** Inferred TypeScript type from the Zod schema */
|
|
74
|
+
type DeepSlopConfig = z.infer<typeof DeepSlopConfigSchema>;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/config/defaults.d.ts
|
|
77
|
+
/** Default configuration matching the canonical values */
|
|
78
|
+
declare const DEFAULT_CONFIG: DeepSlopConfig;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/types/index.d.ts
|
|
81
|
+
/** All built-in engine identifiers (18 built-in) */
|
|
82
|
+
type BuiltinEngineName = "ast-slop" | "import-intelligence" | "dead-flow" | "type-safety" | "syntax-deep" | "security-deep" | "arch-constraints" | "dup-detect" | "perf-hints" | "i18n-lint" | "config-lint" | "meta-quality" | "arch-rules" | "lint-external" | "knip" | "format-lint" | "framework-lint" | "markup-lint";
|
|
83
|
+
/** Engine name — built-in or plugin-provided */
|
|
84
|
+
type EngineName = BuiltinEngineName | (string & {});
|
|
85
|
+
/** Runtime list of all 18 built-in engine names */
|
|
86
|
+
declare const ALL_ENGINE_NAMES: readonly EngineName[];
|
|
87
|
+
/** Diagnostic severity levels */
|
|
88
|
+
type Severity = "error" | "warning" | "info" | "suggestion";
|
|
89
|
+
/** Language targets */
|
|
90
|
+
type Language = "typescript" | "javascript" | "python" | "go" | "rust" | "ruby" | "php" | "java" | "tsx" | "jsx" | "csharp" | "swift";
|
|
91
|
+
/** Framework hints detected from project */
|
|
92
|
+
type Framework = "react" | "next.js" | "vue" | "svelte" | "angular" | "express" | "fastify" | "nestjs" | "django" | "flask" | "fastapi" | "rails" | "laravel" | "none";
|
|
93
|
+
/** Category grouping for diagnostics */
|
|
94
|
+
type Category = "ai-slop" | "imports" | "dead-code" | "types" | "syntax" | "security" | "architecture" | "duplication" | "performance" | "i18n" | "config" | "style";
|
|
95
|
+
interface Diagnostic {
|
|
96
|
+
/** File path relative to root */
|
|
97
|
+
filePath: string;
|
|
98
|
+
/** Engine that produced this diagnostic */
|
|
99
|
+
engine: EngineName;
|
|
100
|
+
/** Rule identifier (e.g. "ai-slop/narrative-comment") */
|
|
101
|
+
rule: string;
|
|
102
|
+
/** Severity level */
|
|
103
|
+
severity: Severity;
|
|
104
|
+
/** Human-readable message */
|
|
105
|
+
message: string;
|
|
106
|
+
/** Help text / fix suggestion */
|
|
107
|
+
help: string;
|
|
108
|
+
/** Line number (1-based) */
|
|
109
|
+
line: number;
|
|
110
|
+
/** Column number (1-based) */
|
|
111
|
+
column: number;
|
|
112
|
+
/** Category for grouping */
|
|
113
|
+
category: Category;
|
|
114
|
+
/** Whether this can be auto-fixed */
|
|
115
|
+
fixable: boolean;
|
|
116
|
+
/** Suggested fix (code diff or replacement) */
|
|
117
|
+
suggestion?: Suggestion;
|
|
118
|
+
/** Additional structured detail */
|
|
119
|
+
detail?: Record<string, unknown>;
|
|
120
|
+
}
|
|
121
|
+
interface Suggestion {
|
|
122
|
+
/** Type of suggestion */
|
|
123
|
+
type: "replace" | "insert" | "delete" | "refactor";
|
|
124
|
+
/** The replacement text (for replace/insert) */
|
|
125
|
+
text: string;
|
|
126
|
+
/** Range to replace */
|
|
127
|
+
range?: {
|
|
128
|
+
startLine: number;
|
|
129
|
+
startCol: number;
|
|
130
|
+
endLine: number;
|
|
131
|
+
endCol: number;
|
|
132
|
+
};
|
|
133
|
+
/** Confidence level 0-1 */
|
|
134
|
+
confidence: number;
|
|
135
|
+
/** Why this suggestion is better */
|
|
136
|
+
reason: string;
|
|
137
|
+
}
|
|
138
|
+
interface EngineResult {
|
|
139
|
+
/** Engine name */
|
|
140
|
+
engine: EngineName;
|
|
141
|
+
/** Diagnostics found */
|
|
142
|
+
diagnostics: Diagnostic[];
|
|
143
|
+
/** Time taken in ms */
|
|
144
|
+
elapsed: number;
|
|
145
|
+
/** Whether engine was skipped */
|
|
146
|
+
skipped: boolean;
|
|
147
|
+
/** Why it was skipped */
|
|
148
|
+
skipReason?: string;
|
|
149
|
+
}
|
|
150
|
+
interface EngineContext {
|
|
151
|
+
/** Root directory of the project */
|
|
152
|
+
rootDirectory: string;
|
|
153
|
+
/** Detected languages */
|
|
154
|
+
languages: Language[];
|
|
155
|
+
/** Detected frameworks */
|
|
156
|
+
frameworks: Framework[];
|
|
157
|
+
/** Specific files to scan (if --include or --changes) */
|
|
158
|
+
files?: string[];
|
|
159
|
+
/** Which tools are installed (keyed by name) */
|
|
160
|
+
installedTools: Record<string, string | boolean>;
|
|
161
|
+
/** Engine configuration */
|
|
162
|
+
config: DeepSlopConfig;
|
|
163
|
+
/** Diff scope description, e.g. "3 changed vs origin/main" */
|
|
164
|
+
diffScope?: string;
|
|
165
|
+
}
|
|
166
|
+
interface Engine {
|
|
167
|
+
/** Engine identifier */
|
|
168
|
+
name: EngineName;
|
|
169
|
+
/** Human-readable description */
|
|
170
|
+
description: string;
|
|
171
|
+
/** Languages this engine supports */
|
|
172
|
+
supportedLanguages: Language[];
|
|
173
|
+
/** Run the engine and produce diagnostics */
|
|
174
|
+
run(context: EngineContext): Promise<EngineResult>;
|
|
175
|
+
/** Auto-fix diagnostics (optional) */
|
|
176
|
+
fix?(diagnostics: Diagnostic[], context: EngineContext): Promise<FixResult>;
|
|
177
|
+
}
|
|
178
|
+
interface FixResult {
|
|
179
|
+
/** Number of diagnostics fixed */
|
|
180
|
+
fixed: number;
|
|
181
|
+
/** Diagnostics that couldn't be fixed */
|
|
182
|
+
remaining: Diagnostic[];
|
|
183
|
+
/** Files that were modified */
|
|
184
|
+
modifiedFiles: string[];
|
|
185
|
+
}
|
|
186
|
+
interface ScanResult {
|
|
187
|
+
/** Per-engine results */
|
|
188
|
+
engines: EngineResult[];
|
|
189
|
+
/** Aggregate score 0-100, or null if majority of files are in unsupported languages */
|
|
190
|
+
score: number | null;
|
|
191
|
+
/** Whether the score is meaningful (false if >80% of files are in unsupported languages) */
|
|
192
|
+
scoreable: boolean;
|
|
193
|
+
/** Per-category breakdown */
|
|
194
|
+
categoryScores: Record<Category, number>;
|
|
195
|
+
/** Total diagnostics */
|
|
196
|
+
totalDiagnostics: number;
|
|
197
|
+
/** By severity */
|
|
198
|
+
bySeverity: Record<Severity, number>;
|
|
199
|
+
/** By engine */
|
|
200
|
+
byEngine: Record<EngineName, number>;
|
|
201
|
+
/** Number of diagnostics suppressed by deep-slop-ignore directives */
|
|
202
|
+
suppressedCount: number;
|
|
203
|
+
/** Project metadata */
|
|
204
|
+
meta: {
|
|
205
|
+
rootDirectory: string;
|
|
206
|
+
languages: Language[];
|
|
207
|
+
frameworks: Framework[];
|
|
208
|
+
filesScanned: number;
|
|
209
|
+
elapsed: number; /** Diff scope description, e.g. "3 changed vs origin/main" */
|
|
210
|
+
diffScope?: string;
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/engines/orchestrator.d.ts
|
|
215
|
+
interface OrchestratorCallbacks {
|
|
216
|
+
onEngineStart?: (name: EngineName) => void;
|
|
217
|
+
onEngineComplete?: (result: EngineResult) => void;
|
|
218
|
+
onProgress?: (completed: number, total: number) => void;
|
|
219
|
+
}
|
|
220
|
+
/** Run selected engines and produce aggregated scan result */
|
|
221
|
+
declare function runScan(context: EngineContext, callbacks?: OrchestratorCallbacks): Promise<ScanResult>;
|
|
222
|
+
/** Run auto-fix for a specific engine */
|
|
223
|
+
declare function runFix(engineName: EngineName, diagnostics: Diagnostic[], context: EngineContext): Promise<FixResult | null>;
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/utils/discover.d.ts
|
|
226
|
+
/** Detect languages from file extensions in the project */
|
|
227
|
+
declare function detectLanguages(rootDir: string): Promise<Language[]>;
|
|
228
|
+
/** Detect frameworks from config files and dependencies */
|
|
229
|
+
declare function detectFrameworks(rootDir: string): Promise<Framework[]>;
|
|
230
|
+
/** Collect all source files to scan */
|
|
231
|
+
declare function collectFiles(rootDir: string, languages: Language[], excludePatterns?: string[], includeFiles?: string[], ignorePatterns?: string[], includePatterns?: string[]): Promise<string[]>;
|
|
232
|
+
//#endregion
|
|
233
|
+
export { ALL_ENGINE_NAMES, type BuiltinEngineName, type Category, DEFAULT_CONFIG, type DeepSlopConfig, type Diagnostic, type Engine, type EngineContext, type EngineName, type EngineResult, type FixResult, type Framework, type Language, type ScanResult, type Severity, type Suggestion, collectFiles, detectFrameworks, detectLanguages, runFix, runScan };
|