How dsolisp/gavel works
Purpose and Entry Points
Gavel is a Node.js, agent-oriented QA discipline layer for test-automation repositories. It statically audits multi-framework test code, produces CI-consumable reports, and ships skills/plugins for many AI IDEs. Primary executable entry point: scripts/cli.js; direct CI gates include scripts/self-check.js, scripts/audit-report.js, and scripts/to-sarif.js. Agent-facing behavior is defined through skills/gavel/SKILL.md, specialized skills under skills/, and the shared rules in AGENTS.md.
Command Dispatch and Agent Integration
scripts/cli.js is the unified command router for audit, review, detection, CI analysis, affected-test discovery, and companion commands. IDE integrations package the same Gavel instruction set in platform-specific plugin manifests, while hooks activate/configure runtime behavior.
• scripts/cli.js
• plugin.yaml
• hooks/gavel-runtime.js
Static Constitution Enforcement
The core quality boundary is the multi-framework constitution scanner. It detects violations such as selector leakage, manual waits, assertion leakage, skipped tests, direct page-object construction, hardcoded environment values, and unsafe suppressions. It consumes a target automation repository and config/suppression context, then emits findings suitable for human review or downstream report formats.
• scripts/self-check.js
• scripts/review.js
• docs/rules/manual-wait.md is not present; rule documentation available includes docs/rules/brittle-assert.md
Audit, Dead-Code, and Safe Refactoring Pipeline
Audit combines constitution findings with structural analysis: unused pages/locators/factories, suite-health counts, area ranking, and autofix candidates. The refactoring path scores changes and can identify safe dead-code removal based on evidence; this is deliberately separate from general-purpose code modification.
• scripts/audit-report.js
• scripts/audit-autofix.js
• scripts/refactor-score.js
Machine Contracts and CI Output
Gavel’s automation boundary is schema-backed output. Result envelopes support piping between agents and scripts; SARIF supports GitHub Code Scanning and other CI dashboards. Configuration, baselines, area maps, and corpus labels are validated against JSON schemas rather than treated as implicit conventions.
• schemas/result-envelope.schema.json
• schemas/gavel-config.schema.json
• schemas/gavel-baseline.schema.json
• scripts/to-sarif.js
• scripts/validate-envelope.js
Test Impact, Area Modeling, and Evidence
Change-oriented analysis maps code/test structure into areas, resolves affected tests transitively, and supports evidence gates before a task is declared complete. Area maps can be generated and manually validated, creating a boundary between repository topology and policy decisions.
• scripts/affected-tests.js
• scripts/generate-area-map.js
• scripts/area-map.js
• scripts/validate-area-map.js
CI Failure Intelligence
CI analysis ingests external report artifacts through format adapters, normalizes failures, clusters related failures, and supports flake-oriented diagnosis. Supported report boundaries include JUnit XML, Allure JSON, Playwright/HTML reports, Cypress, and Cucumber.
• scripts/analyze-ci.js
• scripts/cluster-failures.js
• scripts/flakiness.js
• scripts/parsers/index.js
Distribution, Validation, and Scope Boundary
The repository distributes Gavel as npm/plugin assets and verifies its own governance in GitHub Actions. The Gavel/Bailiff separation is mechanically guarded, with Bailiff-related material documented rather than embedded as a runtime dependency. Fixtures provide representative external automation repositories and report inputs for regression validation.
• package.json
• .github/workflows/gavel-verify.yml
• scripts/verify-boundary.js
• docs/ARCHITECTURE.md
• fixtures/sample-repos/
Main entry points: cli.js Unified CLI · self-check.js Constitution scanner · audit-report.js Audit report · analyze-ci.js CI failure analysis
Components 20
Entry & Integration
- Unified CLI · Dispatches audit, review, detection, CI, and impact commands.
scripts/cli.js - Agent skills
skills/gavel/SKILL.md - Plugin manifest
plugin.yaml - Runtime hook
hooks/gavel-runtime.js
Analysis Pipelines
- Constitution scanner · Detects cross-framework test-governance violations.
scripts/self-check.js - Review analysis
scripts/review.js - Audit report · Combines findings, dead-code evidence, suite health, and area ranking.
scripts/audit-report.js - Audit autofix
scripts/audit-autofix.js - Refactor scoring
scripts/refactor-score.js - Affected tests · Resolves tests affected by changes transitively.
scripts/affected-tests.js - Area map tooling · Generates and validates repository area boundaries.
scripts/area-map.js - CI failure analysis · Normalizes external reports for clustering and flake diagnosis.
scripts/analyze-ci.js - Report adapters · Ingests JUnit, Allure, Playwright, Cypress, and Cucumber reports.
scripts/parsers/index.js
Contracts & Policy
- Result envelope schema · Machine contract for piped agent and script results.
schemas/result-envelope.schema.json - Config & baseline schemas · Validates Gavel configuration and baselines.
schemas/gavel-config.schema.json - SARIF exporter
scripts/to-sarif.js
Delivery & Verification
- Bailiff boundary check · Mechanically prevents Bailiff material becoming a runtime dependency.
scripts/verify-boundary.js - npm package
package.json - GitHub verification · Verifies Gavel governance and distribution assets.
.github/workflows/gavel-verify.yml - External fixtures · Representative target repositories and report inputs.
Connections 22
- Agent skills → Unified CLI: guides use of
- Plugin manifest → Agent skills: packages
- Runtime hook → Unified CLI: activates
- Unified CLI → Constitution scanner: runs
- Unified CLI → Audit report: runs
- Unified CLI → Affected tests: runs
- Unified CLI → CI failure analysis: runs
- Review analysis → Constitution scanner: uses findings
- Constitution scanner → Audit report: supplies violations
- Audit report → Audit autofix: identifies candidates
- Audit autofix → Refactor scoring: requires evidence
- Area map tooling → Affected tests: provides topology
- Report adapters → CI failure analysis: normalizes reports
- Constitution scanner → Result envelope schema: emits envelope
- Audit report → Result envelope schema: emits envelope
- CI failure analysis → Result envelope schema: emits envelope
- Result envelope schema → SARIF exporter: converts
- Config & baseline schemas → Constitution scanner: validates config
- External fixtures → Constitution scanner: test targets
- External fixtures → CI failure analysis: report inputs
- GitHub verification → Bailiff boundary check: runs
- GitHub verification → npm package: verifies release assets