From 63cc35407c28b10ab91c58dd7dc5b6f9955a0b0a Mon Sep 17 00:00:00 2001 From: bntvllnt <32437578+bntvllnt@users.noreply.github.com> Date: Wed, 3 Jun 2026 21:22:33 +0200 Subject: [PATCH] chore(rules): enforce exhaustive CLI+MCP E2E tests and CI merge gate - E2E (CLI + MCP) BLOCKING: every command and MCP tool needs a real-process E2E (spawn built binary / real stdio), full lifecycle, no internal mocks; browser-E2E marked N/A (this package has no UI) - Coverage policy: every command/flag/MCP tool/metric maps to >=1 E2E scenario - Quality Gates: CI is the BLOCKING merge gate (full pipeline incl E2E + coverage); ban eslint-disable / @ts-ignore / skipped tests --- CLAUDE.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 3b3e262..1a49111 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -66,6 +66,8 @@ npm run test # vitest All four must pass before shipping. Run in order: lint -> typecheck -> build -> test. +**CI is the merge gate (BLOCKING).** The full pipeline (lint → typecheck → build → test incl. E2E → coverage) runs in `.github/workflows/ci.yml`. Red CI blocks merge. Never suppress to pass a gate — no `eslint-disable`, no `@ts-ignore`/`@ts-expect-error`, no skipped tests. Fix the cause. + ## Release Protocol ### Version Bumping @@ -161,6 +163,7 @@ LLM knowledge base for building this tool. Single source of truth per topic: - Every bug fix MUST include a regression test - Target: maximum coverage — if code exists, it should be tested - No feature or fix ships without corresponding tests +- Every CLI command, flag, MCP tool, and metric maps to at least one E2E scenario — a surface with no E2E is an incomplete feature (BLOCKING) ### Real Environment Tests (MANDATORY) @@ -178,7 +181,14 @@ LLM knowledge base for building this tool. Single source of truth per topic: | Graph | Real parsed files -> real graph builder, assert nodes/edges | | Analyzer | Real graph -> real metrics, assert values | | MCP | Real MCP server instance, assert tool responses | -| CLI | Real process execution where feasible | +| CLI | Real process execution — spawn built binary, assert stdout/stderr/exit + side-effects | + +### E2E (CLI + MCP) — BLOCKING + +- Every CLI command and every MCP tool MUST have an E2E test that exercises the REAL surface — spawn the built binary (`node dist/cli.js …` / `npx codebase-intelligence …`) or a real MCP stdio server — and asserts real output, exit code, and any files/side-effects. No internal mocks (see Anti-Patterns). +- Full lifecycle for stateful commands: e.g. `init` asserts the files it writes, idempotency (re-run is safe), and `--json` shape — not just exit 0. +- New command, new flag, or new MCP tool = new or updated E2E test in the same change. A behavior change with no E2E update fails the gate. +- "E2E" here means CLI/MCP real-process tests. Browser E2E (Playwright/Maestro) does NOT apply — this package has no UI. This project rule overrides the global ui-testing rule. ### Anti-Patterns (NEVER)