Skip to content

Commit 217d3c5

Browse files
Juan C. Guerreroclaude
authored andcommitted
feat: add pixelmatch pre-filter with tiered classification (Phase 2)
Implements the pre-filter layer that gates AI analysis: - SHA-256 hash check for instant SKIP (byte-identical screenshots) - pixelmatch comparison with configurable threshold (0.05 default) - Spatial cluster detection via 8-connectivity flood-fill - Three tiers: SKIP (0 cost), FAST_CHECK (scattered), FULL_ANALYSIS (clustered) - Diff overlay PNG generation for visual debugging - Standalone CLI with JSON report output Zero false-negative guarantee: only byte-identical or zero-diff screenshots skip analysis. Tiers control depth, not whether analysis occurs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9305118 commit 217d3c5

6 files changed

Lines changed: 512 additions & 3 deletions

File tree

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dojowatch",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "AI-native visual regression testing — capture, diff, and analyze UI changes with LLM vision",
55
"author": {
66
"name": "Dojo Coding LLC",

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# Changelog
22

3-
## [0.1.0] — Unreleased
3+
## [0.2.0] — Unreleased
4+
5+
### Added
6+
- **Pre-filter engine** (`scripts/prefilter.ts`): pixelmatch-based tiered classification
7+
- SHA-256 hash comparison for instant SKIP detection
8+
- pixelmatch with configurable threshold (default 0.05) and anti-alias filtering
9+
- Spatial cluster detection using 8-connectivity flood-fill
10+
- Three tiers: SKIP (0 tokens), FAST_CHECK (~600 tokens), FULL_ANALYSIS (~2400 tokens)
11+
- Diff overlay PNG generation for visual inspection
12+
- Standalone CLI entrypoint with JSON report output
13+
- **Type declaration** for pixelmatch v6 (`scripts/pixelmatch.d.ts`)
14+
- **Prefilter tests** with fixture PNG pairs covering all tier scenarios
15+
16+
## [0.1.0]
417

518
### Added
619
- Initial project structure as Claude Code plugin + standalone scripts

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dojowatch",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"private": true,
55
"type": "module",
66
"scripts": {

scripts/pixelmatch.d.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
declare module "pixelmatch" {
2+
interface PixelmatchOptions {
3+
threshold?: number;
4+
includeAA?: boolean;
5+
alpha?: number;
6+
aaColor?: [number, number, number];
7+
diffColor?: [number, number, number];
8+
diffColorAlt?: [number, number, number];
9+
diffMask?: boolean;
10+
}
11+
12+
function pixelmatch(
13+
img1: Buffer | Uint8Array | Uint8ClampedArray,
14+
img2: Buffer | Uint8Array | Uint8ClampedArray,
15+
output: Buffer | Uint8Array | Uint8ClampedArray | null,
16+
width: number,
17+
height: number,
18+
options?: PixelmatchOptions
19+
): number;
20+
21+
export default pixelmatch;
22+
}

0 commit comments

Comments
 (0)