wiggum-cli 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/LICENSE +21 -0
- package/README.md +341 -0
- package/bin/ralph.js +8 -0
- package/dist/ai/enhancer.d.ts +100 -0
- package/dist/ai/enhancer.d.ts.map +1 -0
- package/dist/ai/enhancer.js +233 -0
- package/dist/ai/enhancer.js.map +1 -0
- package/dist/ai/index.d.ts +8 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +11 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/prompts.d.ts +26 -0
- package/dist/ai/prompts.d.ts.map +1 -0
- package/dist/ai/prompts.js +201 -0
- package/dist/ai/prompts.js.map +1 -0
- package/dist/ai/providers.d.ts +35 -0
- package/dist/ai/providers.d.ts.map +1 -0
- package/dist/ai/providers.js +104 -0
- package/dist/ai/providers.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +196 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/init.d.ts +16 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +124 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/monitor.d.ts +17 -0
- package/dist/commands/monitor.d.ts.map +1 -0
- package/dist/commands/monitor.js +342 -0
- package/dist/commands/monitor.js.map +1 -0
- package/dist/commands/new.d.ts +19 -0
- package/dist/commands/new.d.ts.map +1 -0
- package/dist/commands/new.js +272 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/run.d.ts +16 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +175 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/generator/config.d.ts +59 -0
- package/dist/generator/config.d.ts.map +1 -0
- package/dist/generator/config.js +68 -0
- package/dist/generator/config.js.map +1 -0
- package/dist/generator/index.d.ts +64 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +147 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/templates.d.ts +70 -0
- package/dist/generator/templates.d.ts.map +1 -0
- package/dist/generator/templates.js +296 -0
- package/dist/generator/templates.js.map +1 -0
- package/dist/generator/writer.d.ts +93 -0
- package/dist/generator/writer.d.ts.map +1 -0
- package/dist/generator/writer.js +213 -0
- package/dist/generator/writer.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/scanner/detectors/core/framework.d.ts +11 -0
- package/dist/scanner/detectors/core/framework.d.ts.map +1 -0
- package/dist/scanner/detectors/core/framework.js +275 -0
- package/dist/scanner/detectors/core/framework.js.map +1 -0
- package/dist/scanner/detectors/core/packageManager.d.ts +11 -0
- package/dist/scanner/detectors/core/packageManager.d.ts.map +1 -0
- package/dist/scanner/detectors/core/packageManager.js +74 -0
- package/dist/scanner/detectors/core/packageManager.js.map +1 -0
- package/dist/scanner/detectors/core/styling.d.ts +12 -0
- package/dist/scanner/detectors/core/styling.d.ts.map +1 -0
- package/dist/scanner/detectors/core/styling.js +230 -0
- package/dist/scanner/detectors/core/styling.js.map +1 -0
- package/dist/scanner/detectors/core/testing.d.ts +12 -0
- package/dist/scanner/detectors/core/testing.d.ts.map +1 -0
- package/dist/scanner/detectors/core/testing.js +190 -0
- package/dist/scanner/detectors/core/testing.js.map +1 -0
- package/dist/scanner/detectors/data/api.d.ts +12 -0
- package/dist/scanner/detectors/data/api.d.ts.map +1 -0
- package/dist/scanner/detectors/data/api.js +261 -0
- package/dist/scanner/detectors/data/api.js.map +1 -0
- package/dist/scanner/detectors/data/database.d.ts +12 -0
- package/dist/scanner/detectors/data/database.d.ts.map +1 -0
- package/dist/scanner/detectors/data/database.js +213 -0
- package/dist/scanner/detectors/data/database.js.map +1 -0
- package/dist/scanner/detectors/data/orm.d.ts +12 -0
- package/dist/scanner/detectors/data/orm.d.ts.map +1 -0
- package/dist/scanner/detectors/data/orm.js +160 -0
- package/dist/scanner/detectors/data/orm.js.map +1 -0
- package/dist/scanner/detectors/frontend/formHandling.d.ts +12 -0
- package/dist/scanner/detectors/frontend/formHandling.d.ts.map +1 -0
- package/dist/scanner/detectors/frontend/formHandling.js +211 -0
- package/dist/scanner/detectors/frontend/formHandling.js.map +1 -0
- package/dist/scanner/detectors/frontend/stateManagement.d.ts +12 -0
- package/dist/scanner/detectors/frontend/stateManagement.d.ts.map +1 -0
- package/dist/scanner/detectors/frontend/stateManagement.js +221 -0
- package/dist/scanner/detectors/frontend/stateManagement.js.map +1 -0
- package/dist/scanner/detectors/frontend/uiComponents.d.ts +12 -0
- package/dist/scanner/detectors/frontend/uiComponents.d.ts.map +1 -0
- package/dist/scanner/detectors/frontend/uiComponents.js +285 -0
- package/dist/scanner/detectors/frontend/uiComponents.js.map +1 -0
- package/dist/scanner/detectors/infra/deployment.d.ts +12 -0
- package/dist/scanner/detectors/infra/deployment.d.ts.map +1 -0
- package/dist/scanner/detectors/infra/deployment.js +301 -0
- package/dist/scanner/detectors/infra/deployment.js.map +1 -0
- package/dist/scanner/detectors/infra/monorepo.d.ts +12 -0
- package/dist/scanner/detectors/infra/monorepo.d.ts.map +1 -0
- package/dist/scanner/detectors/infra/monorepo.js +219 -0
- package/dist/scanner/detectors/infra/monorepo.js.map +1 -0
- package/dist/scanner/detectors/mcp/mcpProject.d.ts +12 -0
- package/dist/scanner/detectors/mcp/mcpProject.d.ts.map +1 -0
- package/dist/scanner/detectors/mcp/mcpProject.js +154 -0
- package/dist/scanner/detectors/mcp/mcpProject.js.map +1 -0
- package/dist/scanner/detectors/mcp/mcpServers.d.ts +17 -0
- package/dist/scanner/detectors/mcp/mcpServers.d.ts.map +1 -0
- package/dist/scanner/detectors/mcp/mcpServers.js +193 -0
- package/dist/scanner/detectors/mcp/mcpServers.js.map +1 -0
- package/dist/scanner/detectors/services/analytics.d.ts +12 -0
- package/dist/scanner/detectors/services/analytics.d.ts.map +1 -0
- package/dist/scanner/detectors/services/analytics.js +236 -0
- package/dist/scanner/detectors/services/analytics.js.map +1 -0
- package/dist/scanner/detectors/services/auth.d.ts +12 -0
- package/dist/scanner/detectors/services/auth.d.ts.map +1 -0
- package/dist/scanner/detectors/services/auth.js +217 -0
- package/dist/scanner/detectors/services/auth.js.map +1 -0
- package/dist/scanner/detectors/services/email.d.ts +12 -0
- package/dist/scanner/detectors/services/email.d.ts.map +1 -0
- package/dist/scanner/detectors/services/email.js +211 -0
- package/dist/scanner/detectors/services/email.js.map +1 -0
- package/dist/scanner/detectors/services/payments.d.ts +12 -0
- package/dist/scanner/detectors/services/payments.d.ts.map +1 -0
- package/dist/scanner/detectors/services/payments.js +185 -0
- package/dist/scanner/detectors/services/payments.js.map +1 -0
- package/dist/scanner/detectors/utils.d.ts +160 -0
- package/dist/scanner/detectors/utils.d.ts.map +1 -0
- package/dist/scanner/detectors/utils.js +222 -0
- package/dist/scanner/detectors/utils.js.map +1 -0
- package/dist/scanner/index.d.ts +42 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +282 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/scanner/registry.d.ts +43 -0
- package/dist/scanner/registry.d.ts.map +1 -0
- package/dist/scanner/registry.js +243 -0
- package/dist/scanner/registry.js.map +1 -0
- package/dist/scanner/types.d.ts +112 -0
- package/dist/scanner/types.d.ts.map +1 -0
- package/dist/scanner/types.js +6 -0
- package/dist/scanner/types.js.map +1 -0
- package/dist/templates/config/ralph.config.js.tmpl +38 -0
- package/dist/templates/guides/AGENTS.md.tmpl +100 -0
- package/dist/templates/guides/FRONTEND.md.tmpl +523 -0
- package/dist/templates/guides/PERFORMANCE.md.tmpl +264 -0
- package/dist/templates/guides/SECURITY.md.tmpl +100 -0
- package/dist/templates/prompts/PROMPT.md.tmpl +77 -0
- package/dist/templates/prompts/PROMPT_e2e.md.tmpl +234 -0
- package/dist/templates/prompts/PROMPT_feature.md.tmpl +83 -0
- package/dist/templates/prompts/PROMPT_review.md.tmpl +167 -0
- package/dist/templates/prompts/PROMPT_verify.md.tmpl +72 -0
- package/dist/templates/root/.gitignore.tmpl +5 -0
- package/dist/templates/root/LEARNINGS.md.tmpl +24 -0
- package/dist/templates/root/README.md.tmpl +61 -0
- package/dist/templates/scripts/feature-loop.sh.tmpl +267 -0
- package/dist/templates/scripts/loop.sh.tmpl +59 -0
- package/dist/templates/scripts/ralph-monitor.sh.tmpl +244 -0
- package/dist/templates/specs/README.md.tmpl +57 -0
- package/dist/templates/specs/_example.md.tmpl +71 -0
- package/dist/utils/config.d.ts +95 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +148 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/header.d.ts +5 -0
- package/dist/utils/header.d.ts.map +1 -0
- package/dist/utils/header.js +15 -0
- package/dist/utils/header.js.map +1 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +24 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +44 -0
- package/src/ai/enhancer.ts +350 -0
- package/src/ai/index.ts +38 -0
- package/src/ai/prompts.ts +217 -0
- package/src/ai/providers.ts +136 -0
- package/src/cli.ts +255 -0
- package/src/commands/init.ts +149 -0
- package/src/commands/monitor.ts +412 -0
- package/src/commands/new.ts +312 -0
- package/src/commands/run.ts +214 -0
- package/src/generator/config.ts +116 -0
- package/src/generator/index.ts +227 -0
- package/src/generator/templates.ts +412 -0
- package/src/generator/writer.ts +293 -0
- package/src/index.ts +41 -0
- package/src/scanner/detectors/core/framework.ts +332 -0
- package/src/scanner/detectors/core/packageManager.ts +91 -0
- package/src/scanner/detectors/core/styling.ts +261 -0
- package/src/scanner/detectors/core/testing.ts +221 -0
- package/src/scanner/detectors/data/api.ts +303 -0
- package/src/scanner/detectors/data/database.ts +245 -0
- package/src/scanner/detectors/data/orm.ts +180 -0
- package/src/scanner/detectors/frontend/formHandling.ts +244 -0
- package/src/scanner/detectors/frontend/stateManagement.ts +261 -0
- package/src/scanner/detectors/frontend/uiComponents.ts +328 -0
- package/src/scanner/detectors/infra/deployment.ts +343 -0
- package/src/scanner/detectors/infra/monorepo.ts +251 -0
- package/src/scanner/detectors/mcp/mcpProject.ts +176 -0
- package/src/scanner/detectors/mcp/mcpServers.ts +237 -0
- package/src/scanner/detectors/services/analytics.ts +273 -0
- package/src/scanner/detectors/services/auth.ts +254 -0
- package/src/scanner/detectors/services/email.ts +244 -0
- package/src/scanner/detectors/services/payments.ts +213 -0
- package/src/scanner/detectors/utils.ts +251 -0
- package/src/scanner/index.ts +354 -0
- package/src/scanner/registry.ts +301 -0
- package/src/scanner/types.ts +152 -0
- package/src/templates/config/ralph.config.js.tmpl +38 -0
- package/src/templates/guides/AGENTS.md.tmpl +100 -0
- package/src/templates/guides/FRONTEND.md.tmpl +523 -0
- package/src/templates/guides/PERFORMANCE.md.tmpl +264 -0
- package/src/templates/guides/SECURITY.md.tmpl +100 -0
- package/src/templates/prompts/PROMPT.md.tmpl +77 -0
- package/src/templates/prompts/PROMPT_e2e.md.tmpl +234 -0
- package/src/templates/prompts/PROMPT_feature.md.tmpl +83 -0
- package/src/templates/prompts/PROMPT_review.md.tmpl +167 -0
- package/src/templates/prompts/PROMPT_verify.md.tmpl +72 -0
- package/src/templates/root/.gitignore.tmpl +5 -0
- package/src/templates/root/LEARNINGS.md.tmpl +24 -0
- package/src/templates/root/README.md.tmpl +61 -0
- package/src/templates/scripts/feature-loop.sh.tmpl +267 -0
- package/src/templates/scripts/loop.sh.tmpl +59 -0
- package/src/templates/scripts/ralph-monitor.sh.tmpl +244 -0
- package/src/templates/specs/README.md.tmpl +57 -0
- package/src/templates/specs/_example.md.tmpl +71 -0
- package/src/utils/config.ts +221 -0
- package/src/utils/header.ts +15 -0
- package/src/utils/logger.ts +28 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Utilities for Detectors
|
|
3
|
+
* Common functions used across multiple detector files
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
/**
|
|
8
|
+
* Read and parse package.json from a directory
|
|
9
|
+
*
|
|
10
|
+
* @param projectRoot - The root directory of the project
|
|
11
|
+
* @returns Parsed package.json object or null if not found/invalid
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const pkg = readPackageJson('/path/to/project');
|
|
15
|
+
* if (pkg) {
|
|
16
|
+
* console.log(pkg.name);
|
|
17
|
+
* }
|
|
18
|
+
*/
|
|
19
|
+
export function readPackageJson(projectRoot) {
|
|
20
|
+
const packageJsonPath = join(projectRoot, 'package.json');
|
|
21
|
+
if (!existsSync(packageJsonPath)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const content = readFileSync(packageJsonPath, 'utf-8');
|
|
26
|
+
return JSON.parse(content);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get all dependencies from package.json (deps + devDeps combined)
|
|
34
|
+
*
|
|
35
|
+
* @param pkg - Parsed package.json object
|
|
36
|
+
* @returns Combined dependencies and devDependencies map
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* const pkg = readPackageJson(projectRoot);
|
|
40
|
+
* const deps = getDependencies(pkg);
|
|
41
|
+
* if (deps.react) {
|
|
42
|
+
* console.log(`React version: ${deps.react}`);
|
|
43
|
+
* }
|
|
44
|
+
*/
|
|
45
|
+
export function getDependencies(pkg) {
|
|
46
|
+
if (!pkg)
|
|
47
|
+
return {};
|
|
48
|
+
const deps = pkg.dependencies || {};
|
|
49
|
+
const devDeps = pkg.devDependencies || {};
|
|
50
|
+
return { ...deps, ...devDeps };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Find a config file with various possible extensions
|
|
54
|
+
*
|
|
55
|
+
* @param projectRoot - The root directory of the project
|
|
56
|
+
* @param baseName - The base name of the config file (e.g., 'next.config')
|
|
57
|
+
* @param extensions - Array of extensions to try (e.g., ['.js', '.ts', '.mjs'])
|
|
58
|
+
* @returns The full filename if found, or null
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* const configFile = findConfigFile(projectRoot, 'next.config', ['.js', '.mjs', '.ts']);
|
|
62
|
+
* if (configFile) {
|
|
63
|
+
* console.log(`Found: ${configFile}`);
|
|
64
|
+
* }
|
|
65
|
+
*/
|
|
66
|
+
export function findConfigFile(projectRoot, baseName, extensions) {
|
|
67
|
+
for (const ext of extensions) {
|
|
68
|
+
const filePath = join(projectRoot, `${baseName}${ext}`);
|
|
69
|
+
if (existsSync(filePath)) {
|
|
70
|
+
return `${baseName}${ext}`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Check if a directory exists
|
|
77
|
+
*
|
|
78
|
+
* @param projectRoot - The root directory of the project
|
|
79
|
+
* @param dirName - The directory name to check
|
|
80
|
+
* @returns True if the directory exists
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* if (checkDirectoryExists(projectRoot, 'src')) {
|
|
84
|
+
* console.log('Source directory found');
|
|
85
|
+
* }
|
|
86
|
+
*/
|
|
87
|
+
export function checkDirectoryExists(projectRoot, dirName) {
|
|
88
|
+
return existsSync(join(projectRoot, dirName));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Check if a file exists
|
|
92
|
+
*
|
|
93
|
+
* @param projectRoot - The root directory of the project
|
|
94
|
+
* @param fileName - The file name to check
|
|
95
|
+
* @returns True if the file exists
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* if (checkFileExists(projectRoot, 'vercel.json')) {
|
|
99
|
+
* console.log('Vercel config found');
|
|
100
|
+
* }
|
|
101
|
+
*/
|
|
102
|
+
export function checkFileExists(projectRoot, fileName) {
|
|
103
|
+
return existsSync(join(projectRoot, fileName));
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Find all dependencies matching a prefix pattern
|
|
107
|
+
*
|
|
108
|
+
* @param deps - Dependencies map
|
|
109
|
+
* @param pattern - Prefix pattern to match (e.g., '@supabase/')
|
|
110
|
+
* @returns Array of matching dependency names
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* const supabasePackages = findMatchingDeps(deps, '@supabase/');
|
|
114
|
+
* // Returns: ['@supabase/supabase-js', '@supabase/ssr', ...]
|
|
115
|
+
*/
|
|
116
|
+
export function findMatchingDeps(deps, pattern) {
|
|
117
|
+
return Object.keys(deps).filter((name) => name.startsWith(pattern) || name === pattern);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Check if any dependency matches a pattern and return its version
|
|
121
|
+
*
|
|
122
|
+
* @param deps - Dependencies map
|
|
123
|
+
* @param pattern - Prefix pattern to match
|
|
124
|
+
* @returns Version string if found, undefined otherwise
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* const version = hasDependencyPattern(deps, '@supabase/');
|
|
128
|
+
* if (version) {
|
|
129
|
+
* console.log(`Found supabase package: ${version}`);
|
|
130
|
+
* }
|
|
131
|
+
*/
|
|
132
|
+
export function hasDependencyPattern(deps, pattern) {
|
|
133
|
+
for (const [name, version] of Object.entries(deps)) {
|
|
134
|
+
if (name.startsWith(pattern) || name === pattern) {
|
|
135
|
+
return version;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Read file content safely
|
|
142
|
+
*
|
|
143
|
+
* @param filePath - Full path to the file
|
|
144
|
+
* @returns File content as string, or null if read fails
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* const content = readFileSafe('/path/to/config.json');
|
|
148
|
+
* if (content) {
|
|
149
|
+
* const config = JSON.parse(content);
|
|
150
|
+
* }
|
|
151
|
+
*/
|
|
152
|
+
export function readFileSafe(filePath) {
|
|
153
|
+
try {
|
|
154
|
+
if (!existsSync(filePath)) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
return readFileSync(filePath, 'utf-8');
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Parse JSON file safely
|
|
165
|
+
*
|
|
166
|
+
* @param projectRoot - The root directory of the project
|
|
167
|
+
* @param fileName - The JSON file name
|
|
168
|
+
* @returns Parsed JSON object or null if invalid
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* const config = parseJsonFile(projectRoot, 'tsconfig.json');
|
|
172
|
+
* if (config?.compilerOptions) {
|
|
173
|
+
* console.log('TypeScript config found');
|
|
174
|
+
* }
|
|
175
|
+
*/
|
|
176
|
+
export function parseJsonFile(projectRoot, fileName) {
|
|
177
|
+
try {
|
|
178
|
+
const filePath = join(projectRoot, fileName);
|
|
179
|
+
if (!existsSync(filePath)) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
183
|
+
return JSON.parse(content);
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Common config file extensions
|
|
191
|
+
*/
|
|
192
|
+
export const CONFIG_EXTENSIONS = {
|
|
193
|
+
/** JavaScript/TypeScript config extensions */
|
|
194
|
+
JS_TS: ['.js', '.ts', '.mjs', '.cjs'],
|
|
195
|
+
/** JSON/YAML config extensions */
|
|
196
|
+
DATA: ['.json', '.yaml', '.yml', '.toml'],
|
|
197
|
+
/** All common config extensions */
|
|
198
|
+
ALL: ['.js', '.ts', '.mjs', '.cjs', '.json', '.yaml', '.yml', '.toml'],
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Get npm scripts from package.json
|
|
202
|
+
*
|
|
203
|
+
* @param pkg - Parsed package.json object
|
|
204
|
+
* @returns Scripts object or empty object
|
|
205
|
+
*/
|
|
206
|
+
export function getScripts(pkg) {
|
|
207
|
+
if (!pkg)
|
|
208
|
+
return {};
|
|
209
|
+
return pkg.scripts || {};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Check if a specific npm script exists
|
|
213
|
+
*
|
|
214
|
+
* @param pkg - Parsed package.json object
|
|
215
|
+
* @param scriptName - Name of the script to check
|
|
216
|
+
* @returns True if the script exists
|
|
217
|
+
*/
|
|
218
|
+
export function hasScript(pkg, scriptName) {
|
|
219
|
+
const scripts = getScripts(pkg);
|
|
220
|
+
return scriptName in scripts;
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/scanner/detectors/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAYjC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAC1D,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,e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AClC,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;IACzC,mCAAmC;IACnC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;CACvE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAuB;IAChD,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,OAAQ,GAAG,CAAC,OAAkC,IAAI,EAAE,CAAC;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,GAAuB,EAAE,UAAkB;IACnE,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAChC,OAAO,UAAU,IAAI,OAAO,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scanner Orchestrator
|
|
3
|
+
* Main entry point for project scanning
|
|
4
|
+
*/
|
|
5
|
+
import { DetectorRegistry } from './registry.js';
|
|
6
|
+
import type { ScanResult, ScannerOptions } from './types.js';
|
|
7
|
+
export type { DetectionResult, DetectedStack, MCPStack, DetectorCategory, Detector, ScannerOptions, ScanResult, } from './types.js';
|
|
8
|
+
export { DetectorRegistry, createDefaultRegistry } from './registry.js';
|
|
9
|
+
/**
|
|
10
|
+
* Scanner class
|
|
11
|
+
* Orchestrates detection of project tech stack
|
|
12
|
+
*/
|
|
13
|
+
export declare class Scanner {
|
|
14
|
+
private registry;
|
|
15
|
+
private options;
|
|
16
|
+
constructor(options?: ScannerOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Scan a project directory and detect its tech stack
|
|
19
|
+
*/
|
|
20
|
+
scan(projectRoot: string): Promise<ScanResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Filter array of detection results by confidence
|
|
23
|
+
*/
|
|
24
|
+
private filterArrayByConfidence;
|
|
25
|
+
/**
|
|
26
|
+
* Filter stack results by minimum confidence
|
|
27
|
+
*/
|
|
28
|
+
private filterByConfidence;
|
|
29
|
+
/**
|
|
30
|
+
* Get the detector registry for custom detector registration
|
|
31
|
+
*/
|
|
32
|
+
getRegistry(): DetectorRegistry;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Convenience function to scan a project
|
|
36
|
+
*/
|
|
37
|
+
export declare function scanProject(projectRoot: string, options?: ScannerOptions): Promise<ScanResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Format a scan result for display
|
|
40
|
+
*/
|
|
41
|
+
export declare function formatScanResult(result: ScanResult): string;
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scanner/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAyB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAkC,MAAM,YAAY,CAAC;AAG7F,YAAY,EACV,eAAe,EACf,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,UAAU,GACX,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAExE;;;GAGG;AACH,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAmB;IACnC,OAAO,CAAC,OAAO,CAAiB;gBAEpB,OAAO,GAAE,cAAmB;IASxC;;OAEG;IACG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAoCpD;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAS/B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA8E1B;;OAEG;IACH,WAAW,IAAI,gBAAgB;CAGhC;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAGpG;AAgCD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAmI3D"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scanner Orchestrator
|
|
3
|
+
* Main entry point for project scanning
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync } from 'node:fs';
|
|
6
|
+
import { resolve } from 'node:path';
|
|
7
|
+
import { createDefaultRegistry } from './registry.js';
|
|
8
|
+
// Re-export registry
|
|
9
|
+
export { DetectorRegistry, createDefaultRegistry } from './registry.js';
|
|
10
|
+
/**
|
|
11
|
+
* Scanner class
|
|
12
|
+
* Orchestrates detection of project tech stack
|
|
13
|
+
*/
|
|
14
|
+
export class Scanner {
|
|
15
|
+
registry;
|
|
16
|
+
options;
|
|
17
|
+
constructor(options = {}) {
|
|
18
|
+
this.registry = createDefaultRegistry();
|
|
19
|
+
this.options = {
|
|
20
|
+
includeLowConfidence: false,
|
|
21
|
+
minConfidence: 40,
|
|
22
|
+
...options,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Scan a project directory and detect its tech stack
|
|
27
|
+
*/
|
|
28
|
+
async scan(projectRoot) {
|
|
29
|
+
const startTime = Date.now();
|
|
30
|
+
const errors = [];
|
|
31
|
+
// Resolve to absolute path
|
|
32
|
+
const absolutePath = resolve(projectRoot);
|
|
33
|
+
// Validate project root exists
|
|
34
|
+
if (!existsSync(absolutePath)) {
|
|
35
|
+
throw new Error(`Project root does not exist: ${absolutePath}`);
|
|
36
|
+
}
|
|
37
|
+
// Run all detectors
|
|
38
|
+
let stack;
|
|
39
|
+
try {
|
|
40
|
+
stack = await this.registry.runAllDetectors(absolutePath);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
errors.push(`Detection error: ${error instanceof Error ? error.message : String(error)}`);
|
|
44
|
+
stack = {};
|
|
45
|
+
}
|
|
46
|
+
// Filter by confidence threshold if configured
|
|
47
|
+
if (!this.options.includeLowConfidence && this.options.minConfidence) {
|
|
48
|
+
stack = this.filterByConfidence(stack, this.options.minConfidence);
|
|
49
|
+
}
|
|
50
|
+
const scanTime = Date.now() - startTime;
|
|
51
|
+
return {
|
|
52
|
+
projectRoot: absolutePath,
|
|
53
|
+
stack,
|
|
54
|
+
scanTime,
|
|
55
|
+
errors: errors.length > 0 ? errors : undefined,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Filter array of detection results by confidence
|
|
60
|
+
*/
|
|
61
|
+
filterArrayByConfidence(results, minConfidence) {
|
|
62
|
+
if (!results)
|
|
63
|
+
return undefined;
|
|
64
|
+
const filtered = results.filter(r => r.confidence >= minConfidence);
|
|
65
|
+
return filtered.length > 0 ? filtered : undefined;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Filter stack results by minimum confidence
|
|
69
|
+
*/
|
|
70
|
+
filterByConfidence(stack, minConfidence) {
|
|
71
|
+
const filtered = {};
|
|
72
|
+
// Core
|
|
73
|
+
if (stack.framework && stack.framework.confidence >= minConfidence) {
|
|
74
|
+
filtered.framework = stack.framework;
|
|
75
|
+
}
|
|
76
|
+
if (stack.packageManager && stack.packageManager.confidence >= minConfidence) {
|
|
77
|
+
filtered.packageManager = stack.packageManager;
|
|
78
|
+
}
|
|
79
|
+
if (stack.testing) {
|
|
80
|
+
const testing = {};
|
|
81
|
+
if (stack.testing.unit && stack.testing.unit.confidence >= minConfidence) {
|
|
82
|
+
testing.unit = stack.testing.unit;
|
|
83
|
+
}
|
|
84
|
+
if (stack.testing.e2e && stack.testing.e2e.confidence >= minConfidence) {
|
|
85
|
+
testing.e2e = stack.testing.e2e;
|
|
86
|
+
}
|
|
87
|
+
if (testing.unit || testing.e2e) {
|
|
88
|
+
filtered.testing = testing;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (stack.styling && stack.styling.confidence >= minConfidence) {
|
|
92
|
+
filtered.styling = stack.styling;
|
|
93
|
+
}
|
|
94
|
+
// Data Layer
|
|
95
|
+
if (stack.database && stack.database.confidence >= minConfidence) {
|
|
96
|
+
filtered.database = stack.database;
|
|
97
|
+
}
|
|
98
|
+
if (stack.orm && stack.orm.confidence >= minConfidence) {
|
|
99
|
+
filtered.orm = stack.orm;
|
|
100
|
+
}
|
|
101
|
+
filtered.api = this.filterArrayByConfidence(stack.api, minConfidence);
|
|
102
|
+
// Frontend
|
|
103
|
+
if (stack.stateManagement && stack.stateManagement.confidence >= minConfidence) {
|
|
104
|
+
filtered.stateManagement = stack.stateManagement;
|
|
105
|
+
}
|
|
106
|
+
filtered.uiComponents = this.filterArrayByConfidence(stack.uiComponents, minConfidence);
|
|
107
|
+
filtered.formHandling = this.filterArrayByConfidence(stack.formHandling, minConfidence);
|
|
108
|
+
// Services
|
|
109
|
+
if (stack.auth && stack.auth.confidence >= minConfidence) {
|
|
110
|
+
filtered.auth = stack.auth;
|
|
111
|
+
}
|
|
112
|
+
filtered.analytics = this.filterArrayByConfidence(stack.analytics, minConfidence);
|
|
113
|
+
if (stack.payments && stack.payments.confidence >= minConfidence) {
|
|
114
|
+
filtered.payments = stack.payments;
|
|
115
|
+
}
|
|
116
|
+
if (stack.email && stack.email.confidence >= minConfidence) {
|
|
117
|
+
filtered.email = stack.email;
|
|
118
|
+
}
|
|
119
|
+
// Infrastructure
|
|
120
|
+
filtered.deployment = this.filterArrayByConfidence(stack.deployment, minConfidence);
|
|
121
|
+
if (stack.monorepo && stack.monorepo.confidence >= minConfidence) {
|
|
122
|
+
filtered.monorepo = stack.monorepo;
|
|
123
|
+
}
|
|
124
|
+
// MCP (keep as-is since it has its own structure)
|
|
125
|
+
if (stack.mcp) {
|
|
126
|
+
filtered.mcp = stack.mcp;
|
|
127
|
+
}
|
|
128
|
+
return filtered;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get the detector registry for custom detector registration
|
|
132
|
+
*/
|
|
133
|
+
getRegistry() {
|
|
134
|
+
return this.registry;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Convenience function to scan a project
|
|
139
|
+
*/
|
|
140
|
+
export async function scanProject(projectRoot, options) {
|
|
141
|
+
const scanner = new Scanner(options);
|
|
142
|
+
return scanner.scan(projectRoot);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Helper to format a single detection result
|
|
146
|
+
*/
|
|
147
|
+
function formatDetection(label, result, indent = '') {
|
|
148
|
+
const lines = [];
|
|
149
|
+
if (result) {
|
|
150
|
+
const version = result.version ? `@${result.version}` : '';
|
|
151
|
+
const variant = result.variant ? ` (${result.variant})` : '';
|
|
152
|
+
lines.push(`${indent}${label}: ${result.name}${version}${variant} [${result.confidence}%]`);
|
|
153
|
+
lines.push(`${indent} Evidence: ${result.evidence.join(', ')}`);
|
|
154
|
+
}
|
|
155
|
+
return lines;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Helper to format an array of detection results
|
|
159
|
+
*/
|
|
160
|
+
function formatDetectionArray(label, results, indent = '') {
|
|
161
|
+
const lines = [];
|
|
162
|
+
if (results && results.length > 0) {
|
|
163
|
+
lines.push(`${indent}${label}:`);
|
|
164
|
+
for (const result of results) {
|
|
165
|
+
const version = result.version ? `@${result.version}` : '';
|
|
166
|
+
const variant = result.variant ? ` (${result.variant})` : '';
|
|
167
|
+
lines.push(`${indent} - ${result.name}${version}${variant} [${result.confidence}%]`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return lines;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Format a scan result for display
|
|
174
|
+
*/
|
|
175
|
+
export function formatScanResult(result) {
|
|
176
|
+
const lines = [];
|
|
177
|
+
const { stack } = result;
|
|
178
|
+
lines.push(`Project: ${result.projectRoot}`);
|
|
179
|
+
lines.push(`Scan time: ${result.scanTime}ms`);
|
|
180
|
+
lines.push('');
|
|
181
|
+
// ============ Core ============
|
|
182
|
+
lines.push('=== Core ===');
|
|
183
|
+
if (stack.framework) {
|
|
184
|
+
lines.push(...formatDetection('Framework', stack.framework));
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
lines.push('Framework: Not detected');
|
|
188
|
+
}
|
|
189
|
+
if (stack.packageManager) {
|
|
190
|
+
lines.push(...formatDetection('Package Manager', stack.packageManager));
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
lines.push('Package Manager: Not detected');
|
|
194
|
+
}
|
|
195
|
+
if (stack.testing) {
|
|
196
|
+
if (stack.testing.unit) {
|
|
197
|
+
lines.push(...formatDetection('Unit Testing', stack.testing.unit));
|
|
198
|
+
}
|
|
199
|
+
if (stack.testing.e2e) {
|
|
200
|
+
lines.push(...formatDetection('E2E Testing', stack.testing.e2e));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (stack.styling) {
|
|
204
|
+
lines.push(...formatDetection('Styling', stack.styling));
|
|
205
|
+
}
|
|
206
|
+
// ============ Data Layer ============
|
|
207
|
+
if (stack.database || stack.orm || stack.api) {
|
|
208
|
+
lines.push('');
|
|
209
|
+
lines.push('=== Data Layer ===');
|
|
210
|
+
if (stack.database) {
|
|
211
|
+
lines.push(...formatDetection('Database', stack.database));
|
|
212
|
+
}
|
|
213
|
+
if (stack.orm) {
|
|
214
|
+
lines.push(...formatDetection('ORM', stack.orm));
|
|
215
|
+
}
|
|
216
|
+
lines.push(...formatDetectionArray('API Patterns', stack.api));
|
|
217
|
+
}
|
|
218
|
+
// ============ Frontend ============
|
|
219
|
+
if (stack.stateManagement || stack.uiComponents || stack.formHandling) {
|
|
220
|
+
lines.push('');
|
|
221
|
+
lines.push('=== Frontend ===');
|
|
222
|
+
if (stack.stateManagement) {
|
|
223
|
+
lines.push(...formatDetection('State Management', stack.stateManagement));
|
|
224
|
+
}
|
|
225
|
+
lines.push(...formatDetectionArray('UI Components', stack.uiComponents));
|
|
226
|
+
lines.push(...formatDetectionArray('Form Handling', stack.formHandling));
|
|
227
|
+
}
|
|
228
|
+
// ============ Services ============
|
|
229
|
+
if (stack.auth || stack.analytics || stack.payments || stack.email) {
|
|
230
|
+
lines.push('');
|
|
231
|
+
lines.push('=== Services ===');
|
|
232
|
+
if (stack.auth) {
|
|
233
|
+
lines.push(...formatDetection('Auth', stack.auth));
|
|
234
|
+
}
|
|
235
|
+
lines.push(...formatDetectionArray('Analytics', stack.analytics));
|
|
236
|
+
if (stack.payments) {
|
|
237
|
+
lines.push(...formatDetection('Payments', stack.payments));
|
|
238
|
+
}
|
|
239
|
+
if (stack.email) {
|
|
240
|
+
lines.push(...formatDetection('Email', stack.email));
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// ============ Infrastructure ============
|
|
244
|
+
if (stack.deployment || stack.monorepo) {
|
|
245
|
+
lines.push('');
|
|
246
|
+
lines.push('=== Infrastructure ===');
|
|
247
|
+
lines.push(...formatDetectionArray('Deployment', stack.deployment));
|
|
248
|
+
if (stack.monorepo) {
|
|
249
|
+
lines.push(...formatDetection('Monorepo', stack.monorepo));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
// ============ MCP ============
|
|
253
|
+
if (stack.mcp) {
|
|
254
|
+
lines.push('');
|
|
255
|
+
lines.push('=== MCP ===');
|
|
256
|
+
if (stack.mcp.isProject) {
|
|
257
|
+
lines.push('Type: MCP Server Project');
|
|
258
|
+
if (stack.mcp.projectInfo) {
|
|
259
|
+
lines.push(...formatDetection('Project Info', stack.mcp.projectInfo, ' '));
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (stack.mcp.detected && stack.mcp.detected.length > 0) {
|
|
263
|
+
lines.push('Configured MCP Servers:');
|
|
264
|
+
for (const server of stack.mcp.detected) {
|
|
265
|
+
lines.push(` - ${server.name}`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (stack.mcp.recommended && stack.mcp.recommended.length > 0) {
|
|
269
|
+
lines.push(`Recommended MCP Servers: ${stack.mcp.recommended.join(', ')}`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// ============ Errors ============
|
|
273
|
+
if (result.errors && result.errors.length > 0) {
|
|
274
|
+
lines.push('');
|
|
275
|
+
lines.push('Errors:');
|
|
276
|
+
for (const error of result.errors) {
|
|
277
|
+
lines.push(` - ${error}`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return lines.join('\n');
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scanner/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAoB,MAAM,eAAe,CAAC;AAcxE,qBAAqB;AACrB,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAExE;;;GAGG;AACH,MAAM,OAAO,OAAO;IACV,QAAQ,CAAmB;IAC3B,OAAO,CAAiB;IAEhC,YAAY,UAA0B,EAAE;QACtC,IAAI,CAAC,QAAQ,GAAG,qBAAqB,EAAE,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG;YACb,oBAAoB,EAAE,KAAK;YAC3B,aAAa,EAAE,EAAE;YACjB,GAAG,OAAO;SACX,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,WAAmB;QAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,2BAA2B;QAC3B,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;QAE1C,+BAA+B;QAC/B,IAAI,CAA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AAC,MAAM,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detector Registry
|
|
3
|
+
* Registers and manages all detectors for the scanner
|
|
4
|
+
*/
|
|
5
|
+
import type { Detector, DetectorCategory, DetectedStack } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Detector Registry class
|
|
8
|
+
* Manages registration and execution of detectors
|
|
9
|
+
*/
|
|
10
|
+
export declare class DetectorRegistry {
|
|
11
|
+
private detectors;
|
|
12
|
+
constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Register a detector
|
|
15
|
+
*/
|
|
16
|
+
register(detector: Detector): void;
|
|
17
|
+
/**
|
|
18
|
+
* Get all detectors for a category
|
|
19
|
+
*/
|
|
20
|
+
getDetectors(category: DetectorCategory): Detector[];
|
|
21
|
+
/**
|
|
22
|
+
* Get all registered detectors
|
|
23
|
+
*/
|
|
24
|
+
getAllDetectors(): Detector[];
|
|
25
|
+
/**
|
|
26
|
+
* Run a single-result detector category
|
|
27
|
+
*/
|
|
28
|
+
private runSingleDetector;
|
|
29
|
+
/**
|
|
30
|
+
* Run a multi-result detector category
|
|
31
|
+
*/
|
|
32
|
+
private runMultiDetector;
|
|
33
|
+
/**
|
|
34
|
+
* Run all detectors for a project
|
|
35
|
+
*/
|
|
36
|
+
runAllDetectors(projectRoot: string): Promise<DetectedStack>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Create a registry with all core detectors pre-registered
|
|
40
|
+
*/
|
|
41
|
+
export declare function createDefaultRegistry(): DetectorRegistry;
|
|
42
|
+
export { DetectorRegistry as Registry };
|
|
43
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/scanner/registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAmB,aAAa,EAAY,MAAM,YAAY,CAAC;AA6DvG;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAgD;;IASjE;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAOlC;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,gBAAgB,GAAG,QAAQ,EAAE;IAIpD;;OAEG;IACH,eAAe,IAAI,QAAQ,EAAE;IAQ7B;;OAEG;YACW,iBAAiB;IAa/B;;OAEG;YACW,gBAAgB;IAa9B;;OAEG;IACG,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAoHnE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,gBAAgB,CAkCxD;AAED,OAAO,EAAE,gBAAgB,IAAI,QAAQ,EAAE,CAAC"}
|