e2e-qa-pilot 0.0.0-stage → 0.4.5
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/CODE_OF_CONDUCT.md +126 -0
- package/CONTRIBUTING.md +37 -0
- package/LICENSE +21 -0
- package/README.md +88 -2
- package/SECURITY.md +13 -0
- package/assets/why-evidence.png +0 -0
- package/assets/why-pr.png +0 -0
- package/assets/why-result.png +0 -0
- package/assets/why-reuse.png +0 -0
- package/assets/workflow.jpg +0 -0
- package/bin/cli.mjs +37 -0
- package/docs/README.md +11 -0
- package/docs/install.md +148 -0
- package/docs/project.md +94 -0
- package/docs/scope-and-trust.md +19 -0
- package/docs/settings.md +48 -0
- package/mcp.md +174 -0
- package/package.json +47 -4
- package/processes/autofix-nightly/README.md +18 -0
- package/processes/create-e2e/README.md +43 -0
- package/processes/create-e2e/commands/add-from-design/SKILL.md +132 -0
- package/processes/create-e2e/commands/add-from-steps/SKILL.md +145 -0
- package/processes/create-e2e/commands/review-case/SKILL.md +131 -0
- package/processes/create-e2e/commands/setup-project/SKILL.md +64 -0
- package/processes/create-e2e/commands/shared/pr-evidence.md +217 -0
- package/processes/create-e2e/commands/shared/project-config.md +100 -0
- package/processes/create-e2e/commands/shared/ready-rules.md +42 -0
- package/processes/create-e2e/commands/shared/workflow.md +88 -0
- package/src/init.mjs +566 -0
- package/src/kit.mjs +111 -0
- package/src/manifest.mjs +70 -0
- package/src/mcp.mjs +272 -0
- package/templates/always-on.md +17 -0
- package/templates/project.md +89 -0
- package/templates/settings.md +28 -0
package/src/kit.mjs
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
|
|
5
|
+
// Shared facts for init and the MCP server.
|
|
6
|
+
// CATALOG must match the command folders under processes/create-e2e/commands/.
|
|
7
|
+
// Those Markdown files are the spec. The descriptions here are only the short MCP blurbs.
|
|
8
|
+
// EDITORS is the map from an editor name to its skill folder, MCP file, and label.
|
|
9
|
+
|
|
10
|
+
export const kitRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
11
|
+
export const MARKER = 'e2e-qa-pilot:managed';
|
|
12
|
+
export const MARKER_LINE = `<!-- ${MARKER} -->`;
|
|
13
|
+
export const SERVER_NAME = 'e2e-qa-pilot';
|
|
14
|
+
|
|
15
|
+
// One input object for every Create e2e tool. required is empty because the
|
|
16
|
+
// caller sends exactly one of the two fields. The handler rejects both and neither.
|
|
17
|
+
export const CASE_INPUT_SCHEMA = {
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
case_id: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
description:
|
|
23
|
+
'Id of an existing case in the configured case tool, such as a Qase id. Do not put test case text here. Mutually exclusive with case_text.',
|
|
24
|
+
},
|
|
25
|
+
case_text: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description:
|
|
28
|
+
'Complete test case text, including preconditions, steps, and expected results. Use a Title line when the title is known. Mutually exclusive with case_id. No case tool is required.',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
required: [],
|
|
32
|
+
additionalProperties: false,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// setup_project takes no case. It only helps the human fill .e2e-qa-pilot/project.md.
|
|
36
|
+
export const NO_INPUT_SCHEMA = {
|
|
37
|
+
type: 'object',
|
|
38
|
+
properties: {},
|
|
39
|
+
required: [],
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const CATALOG = [
|
|
44
|
+
{
|
|
45
|
+
command: 'review-case',
|
|
46
|
+
tool: 'review_case',
|
|
47
|
+
description:
|
|
48
|
+
'Resolve one case, either by case_id from the configured case tool or by case_text pasted in full. Check that the steps are specific enough to assert, ask one question per hole, update that same case only when it came from a case id, then route to add_from_steps or add_from_design. Returns the instructions to follow. Does not write a spec.',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
command: 'add-from-steps',
|
|
52
|
+
tool: 'add_from_steps',
|
|
53
|
+
description:
|
|
54
|
+
'Write the Playwright spec and open a pull request from a reviewed case supplied as case_id or case_text. Use this when the case has no Figma link, or figma is off. Steps and expected results are the oracle. Returns the instructions to follow.',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
command: 'add-from-design',
|
|
58
|
+
tool: 'add_from_design',
|
|
59
|
+
description:
|
|
60
|
+
'Write the Playwright spec for a reviewed case supplied as case_id or case_text that has a figma.com URL and figma: on. Compares each milestone with its frame. A narrow minor text difference is documented as e2e:minor-text-diff. Other differences follow pr_mode and can be a draft e2e:mismatch. Returns the instructions to follow.',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
command: 'setup-project',
|
|
64
|
+
tool: 'setup_project',
|
|
65
|
+
input: 'none',
|
|
66
|
+
description:
|
|
67
|
+
'Fill in .e2e-qa-pilot/project.md for this repository: ticket id, branch and commit format, case tool, Figma, feature flags, read-only context repositories, and test layout. Inspects the repo first and asks one batch of questions only for what it cannot detect. Takes no case. Returns the instructions to follow.',
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
export const COMMANDS = CATALOG.map((entry) => entry.command);
|
|
72
|
+
|
|
73
|
+
// Each editor gets the same skills and the same always-on text.
|
|
74
|
+
// alwaysOn is where that text goes: a Cursor rule file, or a managed block in CLAUDE.md.
|
|
75
|
+
export const EDITORS = {
|
|
76
|
+
cursor: {
|
|
77
|
+
skillsDir: '.cursor',
|
|
78
|
+
mcpFile: path.join('.cursor', 'mcp.json'),
|
|
79
|
+
label: 'Cursor',
|
|
80
|
+
alwaysOn: { kind: 'file', file: path.join('.cursor', 'rules', 'e2e-qa-pilot.mdc') },
|
|
81
|
+
},
|
|
82
|
+
claude: {
|
|
83
|
+
skillsDir: '.claude',
|
|
84
|
+
mcpFile: '.mcp.json',
|
|
85
|
+
label: 'Claude Code',
|
|
86
|
+
alwaysOn: { kind: 'block', file: 'CLAUDE.md' },
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const BLOCK_START = '<!-- e2e-qa-pilot:begin -->';
|
|
91
|
+
export const BLOCK_END = '<!-- e2e-qa-pilot:end -->';
|
|
92
|
+
|
|
93
|
+
export const commandsDir = path.join(kitRoot, 'processes', 'create-e2e', 'commands');
|
|
94
|
+
|
|
95
|
+
export function readPackageVersion() {
|
|
96
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(kitRoot, 'package.json'), 'utf8'));
|
|
97
|
+
return pkg.version;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function listFiles(dir) {
|
|
101
|
+
const found = [];
|
|
102
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
103
|
+
const full = path.join(dir, entry.name);
|
|
104
|
+
if (entry.isDirectory()) {
|
|
105
|
+
found.push(...listFiles(full));
|
|
106
|
+
} else if (entry.isFile()) {
|
|
107
|
+
found.push(full);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return found;
|
|
111
|
+
}
|
package/src/manifest.mjs
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import crypto from 'node:crypto';
|
|
4
|
+
|
|
5
|
+
// .e2e-qa-pilot/manifest.json records what init installed, so upgrade can tell a file
|
|
6
|
+
// the package wrote from a file the person edited.
|
|
7
|
+
//
|
|
8
|
+
// {
|
|
9
|
+
// "schema": 1, shape of this file; changes only with a migration
|
|
10
|
+
// "package_version": "0.5.0", the package that last wrote these files
|
|
11
|
+
// "integrations": ["cursor"], editors that were set up
|
|
12
|
+
// "files": { "<path>": "<sha256 of the text the package wrote>" },
|
|
13
|
+
// "templates": { "project_headings": [...], "settings_keys": [...] }
|
|
14
|
+
// what the templates held at install, so upgrade
|
|
15
|
+
// can name sections and keys added since
|
|
16
|
+
// }
|
|
17
|
+
//
|
|
18
|
+
// It lists only files the package manages. settings.md and project.md are the
|
|
19
|
+
// person's files and are never listed. It holds no secret.
|
|
20
|
+
|
|
21
|
+
export const MANIFEST_SCHEMA = 1;
|
|
22
|
+
export const MANIFEST_FILE = path.join('.e2e-qa-pilot', 'manifest.json');
|
|
23
|
+
|
|
24
|
+
// One entry per schema change: MIGRATIONS[n] turns a schema n manifest into schema n + 1.
|
|
25
|
+
export const MIGRATIONS = {};
|
|
26
|
+
|
|
27
|
+
export function hashText(text) {
|
|
28
|
+
return crypto.createHash('sha256').update(text).digest('hex');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function isRecord(value) {
|
|
32
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function manifestPath(project) {
|
|
36
|
+
return path.join(project, MANIFEST_FILE);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Returns the manifest, or null when it is missing or unusable.
|
|
40
|
+
export function readManifest(project) {
|
|
41
|
+
const file = manifestPath(project);
|
|
42
|
+
if (!fs.existsSync(file)) return null;
|
|
43
|
+
try {
|
|
44
|
+
const manifest = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
45
|
+
if (!isRecord(manifest) || !isRecord(manifest.files)) return null;
|
|
46
|
+
if (!Number.isInteger(manifest.schema)) return null;
|
|
47
|
+
return {
|
|
48
|
+
schema: manifest.schema,
|
|
49
|
+
package_version: String(manifest.package_version ?? ''),
|
|
50
|
+
integrations: Array.isArray(manifest.integrations) ? manifest.integrations : [],
|
|
51
|
+
files: manifest.files,
|
|
52
|
+
templates: isRecord(manifest.templates) ? manifest.templates : undefined,
|
|
53
|
+
};
|
|
54
|
+
} catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function writeManifest(project, manifest) {
|
|
60
|
+
const file = manifestPath(project);
|
|
61
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
62
|
+
fs.writeFileSync(file, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// One line for the top of a tool result when the project files came from another version.
|
|
66
|
+
export function versionNotice(project, packageVersion) {
|
|
67
|
+
const manifest = readManifest(project);
|
|
68
|
+
if (!manifest || manifest.package_version === packageVersion) return '';
|
|
69
|
+
return `Project files were installed by e2e-qa-pilot ${manifest.package_version || 'an unknown version'}; this server is ${packageVersion}. Tell the person to run \`npx e2e-qa-pilot upgrade\`.`;
|
|
70
|
+
}
|
package/src/mcp.mjs
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import readline from 'node:readline';
|
|
4
|
+
import {
|
|
5
|
+
commandsDir,
|
|
6
|
+
CATALOG,
|
|
7
|
+
CASE_INPUT_SCHEMA,
|
|
8
|
+
NO_INPUT_SCHEMA,
|
|
9
|
+
kitRoot,
|
|
10
|
+
SERVER_NAME,
|
|
11
|
+
readPackageVersion,
|
|
12
|
+
} from './kit.mjs';
|
|
13
|
+
import { versionNotice } from './manifest.mjs';
|
|
14
|
+
|
|
15
|
+
// A small stdio MCP server with no dependencies, so every line it runs can be read.
|
|
16
|
+
// Tool names, descriptions, and the input schema come from kit.mjs.
|
|
17
|
+
// It never contacts a case tool, never calls a network, and never reads a secret.
|
|
18
|
+
// Case text in a tool call is the text the client sent.
|
|
19
|
+
// It hands the assistant the command file, the shared rules, and the project settings.
|
|
20
|
+
// Stdout is JSON-RPC only. Faults go to stderr.
|
|
21
|
+
|
|
22
|
+
const TOOLS = Object.fromEntries(
|
|
23
|
+
CATALOG.map((entry) => [
|
|
24
|
+
entry.tool,
|
|
25
|
+
{ command: entry.command, description: entry.description, input: entry.input ?? 'case' },
|
|
26
|
+
]),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const INPUT_KEYS = ['case_id', 'case_text'];
|
|
30
|
+
|
|
31
|
+
function read(file) {
|
|
32
|
+
return fs.readFileSync(file, 'utf8');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function isRecord(value) {
|
|
36
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function presentText(value) {
|
|
40
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function resolveCaseInput(args) {
|
|
44
|
+
if (args === undefined || args === null) {
|
|
45
|
+
return { error: 'Provide case_id or case_text. Ask the human for one of them.' };
|
|
46
|
+
}
|
|
47
|
+
if (!isRecord(args)) {
|
|
48
|
+
return { error: 'Tool arguments must be an object.' };
|
|
49
|
+
}
|
|
50
|
+
const unknown = Object.keys(args).filter((key) => !INPUT_KEYS.includes(key));
|
|
51
|
+
if (unknown.length > 0) {
|
|
52
|
+
return { error: `Unknown input: ${unknown.join(', ')}.` };
|
|
53
|
+
}
|
|
54
|
+
for (const key of INPUT_KEYS) {
|
|
55
|
+
if (args[key] !== undefined && typeof args[key] !== 'string') {
|
|
56
|
+
return { error: `${key} must be a string.` };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const caseId = presentText(args.case_id);
|
|
60
|
+
const caseText = presentText(args.case_text);
|
|
61
|
+
if (caseId && caseText) {
|
|
62
|
+
return { error: 'Provide either case_id or case_text, not both.' };
|
|
63
|
+
}
|
|
64
|
+
if (!caseId && !caseText) {
|
|
65
|
+
return { error: 'Provide case_id or case_text. Ask the human for one of them.' };
|
|
66
|
+
}
|
|
67
|
+
if (caseId) return { mode: 'case_id', caseId };
|
|
68
|
+
return { mode: 'case_text', caseText };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function sourceBlock(source) {
|
|
72
|
+
if (source.mode === 'case_id') {
|
|
73
|
+
return [
|
|
74
|
+
'Input mode: case_id',
|
|
75
|
+
'',
|
|
76
|
+
`Case id: ${source.caseId}`,
|
|
77
|
+
'',
|
|
78
|
+
'Fetch this id with fetch_case from settings.',
|
|
79
|
+
'If the case tool errors or the case does not exist, stop and report that.',
|
|
80
|
+
'Do not invent the case. Do not treat this id as test case text.',
|
|
81
|
+
].join('\n');
|
|
82
|
+
}
|
|
83
|
+
return [
|
|
84
|
+
'Input mode: case_text',
|
|
85
|
+
'',
|
|
86
|
+
'Case text:',
|
|
87
|
+
'',
|
|
88
|
+
source.caseText,
|
|
89
|
+
'',
|
|
90
|
+
'This text is the case. Do not call fetch_case or update_case. A case tool is not required.',
|
|
91
|
+
].join('\n');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function projectFiles(projectDir, { forSetup = false } = {}) {
|
|
95
|
+
const settingsPath = path.join(projectDir, '.e2e-qa-pilot', 'settings.md');
|
|
96
|
+
const projectPath = path.join(projectDir, '.e2e-qa-pilot', 'project.md');
|
|
97
|
+
return {
|
|
98
|
+
settings: fs.existsSync(settingsPath)
|
|
99
|
+
? read(settingsPath)
|
|
100
|
+
: `(missing: ${settingsPath}. Run \`npx e2e-qa-pilot init\` in the project.)`,
|
|
101
|
+
project: fs.existsSync(projectPath)
|
|
102
|
+
? read(projectPath)
|
|
103
|
+
: forSetup
|
|
104
|
+
? `(missing: .e2e-qa-pilot/project.md. Write it from this template.)\n\n${read(path.join(kitRoot, 'templates', 'project.md'))}`
|
|
105
|
+
: '(missing: .e2e-qa-pilot/project.md. Optional for a case run. If it would help, ask the person to run setup_project.)',
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const CASE_INTRO = [
|
|
110
|
+
'You do the work yourself with the tools you already have (your case tool, Playwright, GitHub, and any',
|
|
111
|
+
'MCP server or CLI that .e2e-qa-pilot/project.md names).',
|
|
112
|
+
'This server fetched nothing. Ask the human when a step is vague, read every screenshot yourself,',
|
|
113
|
+
'and never paste a secret into the chat.',
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
const SETUP_INTRO = [
|
|
117
|
+
'No case is needed. You do the work yourself with the tools you already have',
|
|
118
|
+
'(file reads, git, gh, and the MCP servers connected in this editor).',
|
|
119
|
+
'This server detected nothing. Never paste a secret into the chat or into these files.',
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
export function buildToolText(toolName, source, projectDir) {
|
|
123
|
+
const tool = TOOLS[toolName];
|
|
124
|
+
const setup = tool.input === 'none';
|
|
125
|
+
const shared = (name) => read(path.join(commandsDir, 'shared', name));
|
|
126
|
+
const { settings, project } = projectFiles(projectDir, { forSetup: setup });
|
|
127
|
+
|
|
128
|
+
const sections = [
|
|
129
|
+
['Settings (.e2e-qa-pilot/settings.md)', settings],
|
|
130
|
+
['Project file (.e2e-qa-pilot/project.md)', project],
|
|
131
|
+
['Instructions', read(path.join(commandsDir, tool.command, 'SKILL.md'))],
|
|
132
|
+
['Shared: project-config.md', shared('project-config.md')],
|
|
133
|
+
];
|
|
134
|
+
if (!setup) {
|
|
135
|
+
sections.push(
|
|
136
|
+
['Shared: workflow.md', shared('workflow.md')],
|
|
137
|
+
['Shared: ready-rules.md', shared('ready-rules.md')],
|
|
138
|
+
['Shared: pr-evidence.md', shared('pr-evidence.md')],
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const notice = versionNotice(projectDir, readPackageVersion());
|
|
143
|
+
|
|
144
|
+
return [
|
|
145
|
+
`# ${SERVER_NAME}: ${toolName}`,
|
|
146
|
+
...(notice ? ['', notice] : []),
|
|
147
|
+
'',
|
|
148
|
+
...(setup ? SETUP_INTRO : [sourceBlock(source), '', ...CASE_INTRO]),
|
|
149
|
+
...sections.flatMap(([title, body]) => ['', `## ${title}`, '', body]),
|
|
150
|
+
].join('\n');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function reply(id, result) {
|
|
154
|
+
process.stdout.write(`${JSON.stringify({ jsonrpc: '2.0', id, result })}\n`);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function fail(id, code, message) {
|
|
158
|
+
process.stdout.write(`${JSON.stringify({ jsonrpc: '2.0', id, error: { code, message } })}\n`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function handleMessage(message, projectDir) {
|
|
162
|
+
if (!isRecord(message)) {
|
|
163
|
+
return { error: { code: -32700, message: 'Parse error' } };
|
|
164
|
+
}
|
|
165
|
+
const { id, method, params } = message;
|
|
166
|
+
const isNotification = id === undefined || id === null;
|
|
167
|
+
|
|
168
|
+
switch (method) {
|
|
169
|
+
case 'initialize':
|
|
170
|
+
return {
|
|
171
|
+
result: {
|
|
172
|
+
protocolVersion: params?.protocolVersion ?? '2025-03-26',
|
|
173
|
+
capabilities: { tools: {} },
|
|
174
|
+
serverInfo: { name: SERVER_NAME, version: readPackageVersion() },
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
case 'ping':
|
|
178
|
+
return { result: {} };
|
|
179
|
+
case 'tools/list':
|
|
180
|
+
return {
|
|
181
|
+
result: {
|
|
182
|
+
tools: Object.entries(TOOLS).map(([name, tool]) => ({
|
|
183
|
+
name,
|
|
184
|
+
description: tool.description,
|
|
185
|
+
inputSchema: tool.input === 'none' ? NO_INPUT_SCHEMA : CASE_INPUT_SCHEMA,
|
|
186
|
+
})),
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
case 'tools/call': {
|
|
190
|
+
const name = params?.name;
|
|
191
|
+
if (!TOOLS[name]) {
|
|
192
|
+
return { error: { code: -32602, message: `Unknown tool: ${name}` } };
|
|
193
|
+
}
|
|
194
|
+
if (TOOLS[name].input === 'none') {
|
|
195
|
+
const args = params?.arguments;
|
|
196
|
+
const empty = args === undefined || args === null || (isRecord(args) && Object.keys(args).length === 0);
|
|
197
|
+
if (!empty) {
|
|
198
|
+
return {
|
|
199
|
+
result: {
|
|
200
|
+
isError: true,
|
|
201
|
+
content: [{ type: 'text', text: `${name} takes no input.` }],
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
result: { content: [{ type: 'text', text: buildToolText(name, null, projectDir) }] },
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
const source = resolveCaseInput(params?.arguments);
|
|
210
|
+
if (source.error) {
|
|
211
|
+
return {
|
|
212
|
+
result: {
|
|
213
|
+
isError: true,
|
|
214
|
+
content: [{ type: 'text', text: source.error }],
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
result: {
|
|
220
|
+
content: [{ type: 'text', text: buildToolText(name, source, projectDir) }],
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
default:
|
|
225
|
+
if (isNotification) return null;
|
|
226
|
+
return { error: { code: -32601, message: `Method not found: ${method}` } };
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function respond(message, outcome) {
|
|
231
|
+
if (!outcome) return;
|
|
232
|
+
const id = isRecord(message) ? message.id : undefined;
|
|
233
|
+
if (id === undefined || id === null) {
|
|
234
|
+
if (outcome.error) {
|
|
235
|
+
process.stderr.write(`${outcome.error.message}\n`);
|
|
236
|
+
fail(null, outcome.error.code, outcome.error.message);
|
|
237
|
+
}
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (outcome.error) fail(id, outcome.error.code, outcome.error.message);
|
|
241
|
+
else reply(id, outcome.result);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function runMcp({ projectDir = process.cwd() } = {}) {
|
|
245
|
+
const rl = readline.createInterface({ input: process.stdin });
|
|
246
|
+
rl.on('line', (line) => {
|
|
247
|
+
if (!line.trim()) return;
|
|
248
|
+
let message;
|
|
249
|
+
try {
|
|
250
|
+
message = JSON.parse(line);
|
|
251
|
+
} catch {
|
|
252
|
+
process.stderr.write('Parse error\n');
|
|
253
|
+
fail(null, -32700, 'Parse error');
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
let outcome;
|
|
257
|
+
try {
|
|
258
|
+
outcome = handleMessage(message, projectDir);
|
|
259
|
+
} catch (error) {
|
|
260
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
261
|
+
const id = isRecord(message) ? message.id : undefined;
|
|
262
|
+
if (id !== undefined && id !== null) {
|
|
263
|
+
fail(id, -32603, text);
|
|
264
|
+
} else {
|
|
265
|
+
process.stderr.write(`${text}\n`);
|
|
266
|
+
fail(null, -32603, text);
|
|
267
|
+
}
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
respond(message, outcome);
|
|
271
|
+
});
|
|
272
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## e2e-qa-pilot
|
|
2
|
+
|
|
3
|
+
When asked to work on a manual test case:
|
|
4
|
+
|
|
5
|
+
1. Read `.e2e-qa-pilot/settings.md`.
|
|
6
|
+
2. Read `.e2e-qa-pilot/project.md`.
|
|
7
|
+
3. Follow the matching command in `.e2e-qa-pilot/processes/create-e2e/commands/`:
|
|
8
|
+
- `review-case`: check that a case is specific enough to assert.
|
|
9
|
+
- `add-from-steps` and `add-from-design`: write the spec and open the pull request.
|
|
10
|
+
- `setup-project`: fill in `project.md`.
|
|
11
|
+
|
|
12
|
+
Rules that always apply:
|
|
13
|
+
|
|
14
|
+
- Do not ask what those two files answer.
|
|
15
|
+
- Feature flags and other repositories are read-only.
|
|
16
|
+
- Never put a token in a file, a commit, or the chat.
|
|
17
|
+
- Never edit an expected result to make a test pass. A person reviews every pull request.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Project
|
|
2
|
+
|
|
3
|
+
> Everything on this page is optional. Fill in only what your project needs and delete the rest.
|
|
4
|
+
> The easiest way: ask your assistant "Set up e2e-qa-pilot for this project." It reads the repository and your MCP servers and fills this file.
|
|
5
|
+
> Block quotes and code blocks are explanation and examples. They are not read. Write your own lines as plain text under the heading.
|
|
6
|
+
> Never put a token or secret here. Credentials belong in your editor's MCP configuration.
|
|
7
|
+
> More examples: `examples/project-files/` in the e2e-qa-pilot repository. Reference: `docs/project.md`.
|
|
8
|
+
|
|
9
|
+
## Ticket
|
|
10
|
+
|
|
11
|
+
> Use this if your branch or commit names a ticket. Without it, the assistant never asks for an id.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
Tracker: Jira
|
|
15
|
+
Required: yes
|
|
16
|
+
{ticket_id} is the full key, for example PROJ-123.
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Branch & commit
|
|
20
|
+
|
|
21
|
+
> Use this if your branches or commits follow a format, or you do not start from `main`.
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
Start from `develop`. Open the pull request against `develop`.
|
|
25
|
+
Branch: `{ticket_id}[_{case_id}]_{title_slug}`
|
|
26
|
+
Commit subject: `test({ticket_id}): {explanation}`
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
> `[ ... ]` is an optional group. It is dropped, with its separator, when the placeholder inside has no value.
|
|
30
|
+
|
|
31
|
+
## Case tool
|
|
32
|
+
|
|
33
|
+
> Use this if you pass a case id and the case lives in a tool such as Qase, TestRail, Xray, or Zephyr.
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
Tool: TestRail, through the `testrail` MCP server.
|
|
37
|
+
Fetch: use the `testrail` tool that gets a case by id.
|
|
38
|
+
Update: use the `testrail` tool that updates a case. Always pass the id.
|
|
39
|
+
The case id is optional. A pasted case has none.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Design
|
|
43
|
+
|
|
44
|
+
> Use this if cases link to Figma frames.
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
Figma: on
|
|
48
|
+
Read a frame: use the `figma` tool that returns a frame for a node id.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
> With `Figma: on`, the design command runs only for a case that contains a figma.com URL.
|
|
52
|
+
|
|
53
|
+
## Feature flags
|
|
54
|
+
|
|
55
|
+
> Use this if a feature can be switched off by a flag (GrowthBook, LaunchDarkly, Unleash, Statsig). The assistant only reads flags.
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
Tool: LaunchDarkly, through the `launchdarkly` MCP server. Read only.
|
|
59
|
+
Environment: staging.
|
|
60
|
+
If a flag the case needs is off, say so and stop.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Context repos
|
|
64
|
+
|
|
65
|
+
> Use this if another repository, such as your frontend, holds the routes and test ids. The assistant reads it through `gh` and never writes to it.
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
Repository: `my-org/frontend`, default branch `main`. Read only.
|
|
69
|
+
Read routes, test ids, labels, and flag keys.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Test layout
|
|
73
|
+
|
|
74
|
+
> Use this if the assistant cannot find your tests on its own.
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
Specs: `tests/e2e`
|
|
78
|
+
Fixture: `tests/fixture.ts`
|
|
79
|
+
Screenshots: `tests/screenshots`
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Rules
|
|
83
|
+
|
|
84
|
+
> Use this for anything else, in plain sentences. These cannot weaken the ready checks, the word rule, the screenshot gate, the labels, or `pr_mode`.
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
Locate elements by data-testid when it exists.
|
|
88
|
+
Name every spec file after the feature, in kebab-case.
|
|
89
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Settings
|
|
2
|
+
|
|
3
|
+
> The keys every project shares. An empty value is unset: the first run asks once for the ones it needs and writes your answers here. Everything specific to this repository (ticket id, branch and commit format, case tool, Figma, feature flags, other repositories) goes in `.e2e-qa-pilot/project.md`, and a section there wins over the matching key here. Never put a token here.
|
|
4
|
+
|
|
5
|
+
## Context
|
|
6
|
+
|
|
7
|
+
`case_tool`, `fetch_case`, and `update_case` are only for a case id. Pasted case text does not use them. Leave them empty if you have no case tool. `figma` is `on` or `off`. `read_figma` is needed only with `figma: on`.
|
|
8
|
+
|
|
9
|
+
case_tool:
|
|
10
|
+
fetch_case:
|
|
11
|
+
update_case:
|
|
12
|
+
figma:
|
|
13
|
+
read_figma:
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
test_command:
|
|
18
|
+
png_dir:
|
|
19
|
+
|
|
20
|
+
## Goal
|
|
21
|
+
|
|
22
|
+
`branch_pattern` names the branch. `{title_slug}` is the case title in kebab-case. `{case_id}` is filled in only for a case id. A value without a placeholder is a literal name and puts every case on that one branch. With no value, the branch is `e2e/{title_slug}`, or `e2e/{case_id}-{title_slug}` for a case id. `pr_mode` is `create_pr_for_review` or `ask_before_pr`. A missing `pr_mode` or label uses the value shown here, without a question.
|
|
23
|
+
|
|
24
|
+
branch_pattern: e2e/{title_slug}
|
|
25
|
+
pr_mode: create_pr_for_review
|
|
26
|
+
pr_label_ready: e2e:ready
|
|
27
|
+
pr_label_minor_text_diff: e2e:minor-text-diff
|
|
28
|
+
pr_label_mismatch: e2e:mismatch
|