@democratize-quality/mcp-server 1.1.9 → 1.2.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/dist/server.d.ts +41 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +225 -0
- package/dist/server.js.map +1 -0
- package/package.json +23 -24
- package/browserControl.js +0 -113
- package/cli.js +0 -228
- package/mcpServer.js +0 -335
- package/run-server.js +0 -140
- package/src/chatmodes//360/237/214/220 api-generator.chatmode.md" +0 -409
- package/src/chatmodes//360/237/214/220 api-healer.chatmode.md" +0 -494
- package/src/chatmodes//360/237/214/220 api-planner.chatmode.md" +0 -954
- package/src/config/environments/api-only.js +0 -53
- package/src/config/environments/development.js +0 -54
- package/src/config/environments/production.js +0 -69
- package/src/config/index.js +0 -341
- package/src/config/server.js +0 -41
- package/src/config/tools/api.js +0 -67
- package/src/config/tools/browser.js +0 -90
- package/src/config/tools/default.js +0 -32
- package/src/docs/Agent_README.md +0 -310
- package/src/docs/QUICK_REFERENCE.md +0 -111
- package/src/services/browserService.js +0 -325
- package/src/skills/api-planning/SKILL.md +0 -224
- package/src/skills/test-execution/SKILL.md +0 -777
- package/src/skills/test-generation/SKILL.md +0 -309
- package/src/skills/test-healing/SKILL.md +0 -405
- package/src/tools/api/api-generator.js +0 -1865
- package/src/tools/api/api-healer.js +0 -617
- package/src/tools/api/api-planner.js +0 -2598
- package/src/tools/api/api-project-setup.js +0 -313
- package/src/tools/api/api-request.js +0 -641
- package/src/tools/api/api-session-report.js +0 -1278
- package/src/tools/api/api-session-status.js +0 -395
- package/src/tools/api/prompts/README.md +0 -293
- package/src/tools/api/prompts/generation-prompts.js +0 -703
- package/src/tools/api/prompts/healing-prompts.js +0 -195
- package/src/tools/api/prompts/index.js +0 -25
- package/src/tools/api/prompts/orchestrator.js +0 -334
- package/src/tools/api/prompts/validation-rules.js +0 -339
- package/src/tools/base/ToolBase.js +0 -230
- package/src/tools/base/ToolRegistry.js +0 -269
- package/src/tools/browser/advanced/browser-console.js +0 -384
- package/src/tools/browser/advanced/browser-dialog.js +0 -319
- package/src/tools/browser/advanced/browser-evaluate.js +0 -337
- package/src/tools/browser/advanced/browser-file.js +0 -480
- package/src/tools/browser/advanced/browser-keyboard.js +0 -343
- package/src/tools/browser/advanced/browser-mouse.js +0 -332
- package/src/tools/browser/advanced/browser-network.js +0 -421
- package/src/tools/browser/advanced/browser-pdf.js +0 -407
- package/src/tools/browser/advanced/browser-tabs.js +0 -497
- package/src/tools/browser/advanced/browser-wait.js +0 -378
- package/src/tools/browser/click.js +0 -168
- package/src/tools/browser/close.js +0 -60
- package/src/tools/browser/dom.js +0 -70
- package/src/tools/browser/launch.js +0 -67
- package/src/tools/browser/navigate.js +0 -270
- package/src/tools/browser/screenshot.js +0 -351
- package/src/tools/browser/type.js +0 -174
- package/src/tools/index.js +0 -95
- package/src/utils/agentInstaller.js +0 -418
- package/src/utils/browserHelpers.js +0 -83
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
const ToolBase = require('../base/ToolBase');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
let z;
|
|
6
|
-
try {
|
|
7
|
-
const zod = require('zod');
|
|
8
|
-
z = zod.z || zod.default?.z || zod;
|
|
9
|
-
if (!z || typeof z.object !== 'function') {
|
|
10
|
-
throw new Error('Zod not properly loaded');
|
|
11
|
-
}
|
|
12
|
-
} catch (error) {
|
|
13
|
-
console.error('Failed to load Zod:', error.message);
|
|
14
|
-
// Fallback: create a simple validation function
|
|
15
|
-
z = {
|
|
16
|
-
object: (schema) => ({ parse: (data) => data }),
|
|
17
|
-
string: () => ({ optional: () => ({}) }),
|
|
18
|
-
boolean: () => ({ optional: () => ({}) })
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Input schema for the API project setup tool
|
|
23
|
-
const apiProjectSetupInputSchema = z.object({
|
|
24
|
-
outputDir: z.string().optional(),
|
|
25
|
-
promptUser: z.boolean().optional()
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* API Project Setup Tool - Detect project configuration for API test generation
|
|
30
|
-
*
|
|
31
|
-
* This tool performs smart detection of project configuration (TypeScript, Playwright, Jest)
|
|
32
|
-
* and prompts users when configuration is ambiguous or missing.
|
|
33
|
-
*
|
|
34
|
-
* Detection Logic (Option C - Smart Detection):
|
|
35
|
-
* 1. Has playwright.config.ts → Playwright + TypeScript
|
|
36
|
-
* 2. Has playwright.config.js → Playwright + JavaScript
|
|
37
|
-
* 3. Has jest.config.ts → Jest + TypeScript
|
|
38
|
-
* 4. Has jest.config.js → Jest + JavaScript
|
|
39
|
-
* 5. Has tsconfig.json only → Ask framework, use TypeScript
|
|
40
|
-
* 6. No config → Ask both framework and language
|
|
41
|
-
*/
|
|
42
|
-
class ApiProjectSetupTool extends ToolBase {
|
|
43
|
-
static definition = {
|
|
44
|
-
name: "api_project_setup",
|
|
45
|
-
description: "Detect project configuration and setup preferences for API test generation. MUST be called BEFORE api_generator to determine framework (Playwright/Jest/Postman) and language (TypeScript/JavaScript). Uses smart detection: auto-detects from config files when possible, prompts user only when needed.",
|
|
46
|
-
input_schema: {
|
|
47
|
-
type: "object",
|
|
48
|
-
properties: {
|
|
49
|
-
outputDir: {
|
|
50
|
-
type: "string",
|
|
51
|
-
description: "Directory where tests will be generated (default: ./tests). Used to locate project root for config detection."
|
|
52
|
-
},
|
|
53
|
-
promptUser: {
|
|
54
|
-
type: "boolean",
|
|
55
|
-
description: "If true, always prompt user for preferences even if config detected. Use for overriding auto-detection. (default: false)"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
constructor() {
|
|
62
|
-
super();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
async execute(parameters) {
|
|
66
|
-
try {
|
|
67
|
-
const params = apiProjectSetupInputSchema.parse(parameters);
|
|
68
|
-
|
|
69
|
-
const outputDir = params.outputDir || './tests';
|
|
70
|
-
const forcePrompt = params.promptUser || false;
|
|
71
|
-
|
|
72
|
-
// Detect project configuration
|
|
73
|
-
const detection = this._detectProjectConfiguration(outputDir);
|
|
74
|
-
|
|
75
|
-
// If user wants to override auto-detection, force prompts
|
|
76
|
-
if (forcePrompt) {
|
|
77
|
-
return this._buildUserPromptResponse(detection, true);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Apply Smart Detection Logic (Option C)
|
|
81
|
-
const result = this._applySmartDetection(detection);
|
|
82
|
-
|
|
83
|
-
return result;
|
|
84
|
-
|
|
85
|
-
} catch (error) {
|
|
86
|
-
return {
|
|
87
|
-
success: false,
|
|
88
|
-
error: error.message,
|
|
89
|
-
details: error.stack
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Detect project configuration by scanning for config files
|
|
96
|
-
*/
|
|
97
|
-
_detectProjectConfiguration(outputDir) {
|
|
98
|
-
const projectRoot = path.resolve(outputDir, '..');
|
|
99
|
-
|
|
100
|
-
// Check for config files
|
|
101
|
-
const configFiles = {
|
|
102
|
-
tsconfig: fs.existsSync(path.join(projectRoot, 'tsconfig.json')),
|
|
103
|
-
playwrightTS: fs.existsSync(path.join(projectRoot, 'playwright.config.ts')),
|
|
104
|
-
playwrightJS: fs.existsSync(path.join(projectRoot, 'playwright.config.js')),
|
|
105
|
-
jestTS: fs.existsSync(path.join(projectRoot, 'jest.config.ts')),
|
|
106
|
-
jestJS: fs.existsSync(path.join(projectRoot, 'jest.config.js')),
|
|
107
|
-
packageJson: fs.existsSync(path.join(projectRoot, 'package.json'))
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
// Check package.json for TypeScript dependency
|
|
111
|
-
let hasTypeScriptDep = false;
|
|
112
|
-
let hasPlaywrightDep = false;
|
|
113
|
-
let hasJestDep = false;
|
|
114
|
-
|
|
115
|
-
if (configFiles.packageJson) {
|
|
116
|
-
try {
|
|
117
|
-
const packageJson = JSON.parse(fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
|
|
118
|
-
const allDeps = {
|
|
119
|
-
...(packageJson.dependencies || {}),
|
|
120
|
-
...(packageJson.devDependencies || {})
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
hasTypeScriptDep = !!allDeps.typescript;
|
|
124
|
-
hasPlaywrightDep = !!allDeps['@playwright/test'];
|
|
125
|
-
hasJestDep = !!allDeps.jest;
|
|
126
|
-
} catch (err) {
|
|
127
|
-
// Ignore parse errors
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return {
|
|
132
|
-
projectRoot,
|
|
133
|
-
configFiles,
|
|
134
|
-
hasTypeScript: configFiles.tsconfig || hasTypeScriptDep,
|
|
135
|
-
hasPlaywrightConfig: configFiles.playwrightTS || configFiles.playwrightJS,
|
|
136
|
-
hasJestConfig: configFiles.jestTS || configFiles.jestJS,
|
|
137
|
-
hasPlaywrightDep,
|
|
138
|
-
hasJestDep,
|
|
139
|
-
detectedFiles: Object.entries(configFiles)
|
|
140
|
-
.filter(([key, exists]) => exists && key !== 'packageJson')
|
|
141
|
-
.map(([key]) => this._getConfigFileName(key))
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Apply Smart Detection Logic (Option C)
|
|
147
|
-
*/
|
|
148
|
-
_applySmartDetection(detection) {
|
|
149
|
-
const { configFiles } = detection;
|
|
150
|
-
|
|
151
|
-
// Scenario 1: Playwright with TypeScript
|
|
152
|
-
if (configFiles.playwrightTS) {
|
|
153
|
-
return this._buildAutoDetectedResponse(detection, 'playwright', 'typescript',
|
|
154
|
-
'Detected Playwright project with TypeScript configuration');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Scenario 2: Playwright with JavaScript
|
|
158
|
-
if (configFiles.playwrightJS) {
|
|
159
|
-
return this._buildAutoDetectedResponse(detection, 'playwright', 'javascript',
|
|
160
|
-
'Detected Playwright project with JavaScript configuration');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Scenario 3: Jest with TypeScript
|
|
164
|
-
if (configFiles.jestTS) {
|
|
165
|
-
return this._buildAutoDetectedResponse(detection, 'jest', 'typescript',
|
|
166
|
-
'Detected Jest project with TypeScript configuration');
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Scenario 4: Jest with JavaScript
|
|
170
|
-
if (configFiles.jestJS) {
|
|
171
|
-
return this._buildAutoDetectedResponse(detection, 'jest', 'javascript',
|
|
172
|
-
'Detected Jest project with JavaScript configuration');
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Scenario 5: Only TypeScript config (no framework config)
|
|
176
|
-
if (configFiles.tsconfig && !detection.hasPlaywrightConfig && !detection.hasJestConfig) {
|
|
177
|
-
return this._buildUserPromptResponse(detection, true, false);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Scenario 6: No config files (empty folder) - Ask both framework and language
|
|
181
|
-
if (!detection.hasTypeScript && !detection.hasPlaywrightConfig && !detection.hasJestConfig) {
|
|
182
|
-
return this._buildUserPromptResponse(detection, true, true);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Fallback: Has some config but ambiguous - ask user
|
|
186
|
-
return this._buildUserPromptResponse(detection, true, true);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Build auto-detected response (no user input needed)
|
|
191
|
-
*/
|
|
192
|
-
_buildAutoDetectedResponse(detection, framework, language, message) {
|
|
193
|
-
return {
|
|
194
|
-
success: true,
|
|
195
|
-
autoDetected: true,
|
|
196
|
-
config: {
|
|
197
|
-
framework: framework,
|
|
198
|
-
language: language,
|
|
199
|
-
hasTypeScript: language === 'typescript',
|
|
200
|
-
hasPlaywrightConfig: framework === 'playwright',
|
|
201
|
-
hasJestConfig: framework === 'jest',
|
|
202
|
-
configFiles: detection.detectedFiles
|
|
203
|
-
},
|
|
204
|
-
message: message,
|
|
205
|
-
detectedFiles: detection.detectedFiles,
|
|
206
|
-
nextStep: `Call api_generator with outputFormat: '${framework}' and language: '${language}'`
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Build user prompt response (needs user input)
|
|
212
|
-
*/
|
|
213
|
-
_buildUserPromptResponse(detection, askFramework = true, askLanguage = true) {
|
|
214
|
-
const prompts = [];
|
|
215
|
-
|
|
216
|
-
// Framework prompt
|
|
217
|
-
if (askFramework) {
|
|
218
|
-
prompts.push({
|
|
219
|
-
name: "framework",
|
|
220
|
-
question: "Which test framework would you like to use?",
|
|
221
|
-
choices: [
|
|
222
|
-
{
|
|
223
|
-
value: "playwright",
|
|
224
|
-
label: "Playwright",
|
|
225
|
-
description: "Recommended for API testing with request fixture"
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
value: "jest",
|
|
229
|
-
label: "Jest",
|
|
230
|
-
description: "Popular testing framework with axios for API calls"
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
value: "postman",
|
|
234
|
-
label: "Postman Collection",
|
|
235
|
-
description: "Generate Postman collection JSON format"
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
value: "all",
|
|
239
|
-
label: "All Formats",
|
|
240
|
-
description: "Generate tests in all supported formats"
|
|
241
|
-
}
|
|
242
|
-
],
|
|
243
|
-
default: "playwright"
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// Language prompt
|
|
248
|
-
if (askLanguage) {
|
|
249
|
-
prompts.push({
|
|
250
|
-
name: "language",
|
|
251
|
-
question: "Which language would you like to use?",
|
|
252
|
-
choices: [
|
|
253
|
-
{
|
|
254
|
-
value: "typescript",
|
|
255
|
-
label: "TypeScript",
|
|
256
|
-
description: "Recommended for better type safety and IDE support"
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
value: "javascript",
|
|
260
|
-
label: "JavaScript",
|
|
261
|
-
description: "Simpler setup, no compilation needed"
|
|
262
|
-
}
|
|
263
|
-
],
|
|
264
|
-
default: "typescript"
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return {
|
|
269
|
-
success: true,
|
|
270
|
-
needsUserInput: true,
|
|
271
|
-
detected: {
|
|
272
|
-
hasTypeScript: detection.hasTypeScript,
|
|
273
|
-
hasPlaywrightConfig: detection.hasPlaywrightConfig,
|
|
274
|
-
hasJestConfig: detection.hasJestConfig,
|
|
275
|
-
configFiles: detection.detectedFiles
|
|
276
|
-
},
|
|
277
|
-
prompts: prompts,
|
|
278
|
-
message: this._buildPromptMessage(detection, askFramework, askLanguage),
|
|
279
|
-
nextStep: "Get user preferences, then call api_generator with chosen framework and language"
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Build appropriate message based on what's being asked
|
|
285
|
-
*/
|
|
286
|
-
_buildPromptMessage(detection, askFramework, askLanguage) {
|
|
287
|
-
if (detection.detectedFiles.length === 0) {
|
|
288
|
-
return "No project configuration detected. Please specify your preferences for test generation.";
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (!askFramework && askLanguage) {
|
|
292
|
-
return `Detected TypeScript configuration (${detection.detectedFiles.join(', ')}). Please choose a test framework.`;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return `Found partial configuration (${detection.detectedFiles.join(', ')}). Please specify your preferences.`;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Get human-readable config file name from key
|
|
300
|
-
*/
|
|
301
|
-
_getConfigFileName(key) {
|
|
302
|
-
const mapping = {
|
|
303
|
-
'tsconfig': 'tsconfig.json',
|
|
304
|
-
'playwrightTS': 'playwright.config.ts',
|
|
305
|
-
'playwrightJS': 'playwright.config.js',
|
|
306
|
-
'jestTS': 'jest.config.ts',
|
|
307
|
-
'jestJS': 'jest.config.js'
|
|
308
|
-
};
|
|
309
|
-
return mapping[key] || key;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
module.exports = ApiProjectSetupTool;
|