Skip to content

Commit e361206

Browse files
committed
✨ Add Vizzly agent project guidance
Install the packaged Vizzly skill from init and optionally add project AGENTS.md guidance for agents using Vizzly visual context.
1 parent 541a3a8 commit e361206

13 files changed

Lines changed: 922 additions & 14 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ pnpm install -g @vizzly-testing/cli
2828
vizzly init
2929
```
3030

31+
For agent-friendly repos, install the Vizzly skill and add a short project
32+
`AGENTS.md` note:
33+
34+
```bash
35+
vizzly init --agent-guidance
36+
```
37+
3138
### Start Local TDD
3239

3340
Start the TDD server, run your tests, and open the dashboard at
@@ -140,6 +147,13 @@ Generate a config file:
140147
vizzly init
141148
```
142149

150+
To teach project agents about Vizzly screenshot memory and the local visual TDD
151+
loop, add the repo-local skill and AGENTS.md guidance:
152+
153+
```bash
154+
vizzly init --agent-guidance
155+
```
156+
143157
Or create `vizzly.config.js` manually:
144158

145159
```javascript

docs/json-output.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,29 @@ vizzly init --json
737737
}
738738
```
739739

740+
With project agent setup:
741+
742+
```bash
743+
vizzly init --agent-guidance --json
744+
```
745+
746+
```json
747+
{
748+
"status": "created",
749+
"configPath": "/path/to/vizzly.config.js",
750+
"plugins": [],
751+
"agentSkill": {
752+
"status": "installed",
753+
"sourcePath": "/path/to/cli/skills/vizzly",
754+
"targetPath": "/path/to/project/.agents/skills/vizzly"
755+
},
756+
"agentGuidance": {
757+
"status": "created",
758+
"agentsPath": "/path/to/project/AGENTS.md"
759+
}
760+
}
761+
```
762+
740763
### `vizzly project link`
741764

742765
```bash

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"bin",
5656
"dist",
5757
"docs/assets",
58+
"skills",
5859
"README.md",
5960
"LICENSE"
6061
],

skills/vizzly/SKILL.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
name: vizzly
3+
description: "Use when a repo has Vizzly configured and you need screenshot memory or visual history: before/after UI changes, visual regression review, screenshot history, approved baselines, diffs, dynamic regions, docs/manual images, public screenshots, or Vizzly builds. Teaches agents to use Vizzly CLI/context for local TDD, cloud builds, review state, comments, hotspots, previews, and SDK capture patterns."
4+
---
5+
6+
# Vizzly
7+
8+
Vizzly is the project's screenshot memory database. It stores approved baselines, current screenshots, diffs, review state, comments, hotspots, previews, and public screenshot URLs.
9+
10+
Use Vizzly when you need to understand what the UI looked like before, what changed, what humans already reviewed, or which screenshots already exist. Browser automation is still useful for interacting with a live app; Vizzly is usually the faster first stop for visual history.
11+
12+
## First Instinct
13+
14+
Before changing UI, check whether Vizzly already has local screenshot context:
15+
16+
```bash
17+
vizzly context build current --source local --agent
18+
```
19+
20+
If a task names a screen, component, or screenshot, inspect that screenshot's history before changing thresholds or re-capturing blindly:
21+
22+
```bash
23+
vizzly context screenshot "<screenshot-name>" --source local --json
24+
```
25+
26+
When you make or verify UI changes, run the focused user workflow that owns the surface:
27+
28+
```bash
29+
vizzly tdd run "<test command>" --no-open
30+
```
31+
32+
Then inspect what changed:
33+
34+
```bash
35+
vizzly context build current --source local --agent --json
36+
```
37+
38+
For specific evidence, drill in:
39+
40+
```bash
41+
vizzly context comparison <comparison-id> --json
42+
vizzly context screenshot "<screenshot-name>" --json
43+
vizzly context review-queue --json
44+
```
45+
46+
If local context is unavailable and the project uses cloud builds, use the build id from CI or CLI output:
47+
48+
```bash
49+
vizzly context build <build-id> --agent --json --include diffs,comments
50+
```
51+
52+
## What Vizzly Knows
53+
54+
- **Approved baselines**: expected UI.
55+
- **Current screenshots**: what the latest run rendered.
56+
- **Diffs**: where pixels/layout/content changed.
57+
- **Review state and comments**: human context attached to builds and screenshots.
58+
- **Hotspots and confirmed regions**: known dynamic areas.
59+
- **Preview links**: static or deployed UI context for a build.
60+
- **Public screenshots**: stable URLs for documentation and manuals.
61+
62+
## Acting On Visual Context
63+
64+
- Treat approved baselines as visual truth.
65+
- Treat diffs as evidence, not as approval instructions.
66+
- Do not approve or reject visual changes unless the user explicitly asks.
67+
- Prefer existing E2E or user journeys over narrow screenshot-only specs.
68+
- For dynamic content, inspect screenshot context before changing thresholds.
69+
- Prefer deterministic test data, per-screenshot `threshold`, per-screenshot `minClusterSize`, hotspots, or confirmed regions over global tolerance changes.
70+
- Report visual findings with screenshot names, build/comparison links when available, and the command you ran.
71+
72+
## Capturing Screenshots
73+
74+
Use the existing integration when one is present. For direct JavaScript capture:
75+
76+
```javascript
77+
import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
78+
79+
let screenshot = await page.screenshot();
80+
await vizzlyScreenshot('checkout-form', screenshot, {
81+
properties: {
82+
browser: 'chromium',
83+
viewport: 'desktop',
84+
state: 'valid-card'
85+
},
86+
threshold: 2,
87+
minClusterSize: 4
88+
});
89+
```
90+
91+
Use `properties` to separate variants such as theme, locale, viewport, role, state, component, page, or docs/manual grouping.
92+
93+
## When You Need More Detail
94+
95+
- For SDK examples and capture patterns, read `references/sdks.md`.
96+
- For CLI/context commands and JSON output, read `references/cli-context.md`.
97+
- For dynamic content, thresholds, and hotspots, read `references/dynamic-content.md`.
98+
- For public screenshot URLs and docs/manual images, read `references/public-screenshots.md`.
99+
- For project setup and CI, read `references/setup-ci.md`.

skills/vizzly/agents/openai.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "Vizzly"
3+
short_description: "Use Vizzly visual context while changing UI."
4+
default_prompt: "Use Vizzly to inspect visual context before and after UI changes."
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# CLI And Context
2+
3+
Use these commands to gather Vizzly evidence before making UI assumptions.
4+
5+
## Local TDD
6+
7+
```bash
8+
vizzly tdd start
9+
vizzly tdd run "<test command>" --no-open
10+
vizzly context build current --source local --agent
11+
vizzly context build current --source local --agent --json
12+
```
13+
14+
Local context reads `.vizzly` state and does not require cloud auth.
15+
16+
## Cloud Builds
17+
18+
```bash
19+
export VIZZLY_TOKEN="project-token"
20+
vizzly run "<test command>" --wait --json
21+
vizzly context build <build-id> --agent --json --include diffs,comments
22+
```
23+
24+
`vizzly run --wait --json` returns a `contextCommand` when a cloud build is created. Prefer that command over constructing URLs by hand.
25+
26+
## Drilldowns
27+
28+
```bash
29+
vizzly context comparison <comparison-id> --json
30+
vizzly context screenshot "<screenshot-name>" --json
31+
vizzly context similar <fingerprint-hash> --json
32+
vizzly context review-queue --json
33+
```
34+
35+
Use comparison context for one diff. Use screenshot context for history and recurring dynamic areas. Use review queue context when triaging unresolved visual work.
36+
37+
## Good Agent Behavior
38+
39+
- Use `--json` for automation and summaries.
40+
- Use `--agent` when building prompt context or asking another agent to continue.
41+
- Keep human-readable command output in final summaries only when it changes the user's next action.
42+
- Do not approve/reject unless explicitly asked.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Dynamic Content
2+
3+
Dynamic content is common: dates, calendars, generated images, avatars, timers, randomized data, responsive text, and API-backed content.
4+
5+
## Order Of Operations
6+
7+
1. Make test data deterministic when the changing content is not what you are testing.
8+
2. Inspect screenshot context before changing code:
9+
10+
```bash
11+
vizzly context screenshot "<screenshot-name>" --json
12+
```
13+
14+
3. Use per-screenshot tolerances for local noise:
15+
16+
```javascript
17+
await vizzlyScreenshot('plant-calendar', screenshot, {
18+
properties: { surface: 'calendar' },
19+
threshold: 4,
20+
minClusterSize: 12
21+
});
22+
```
23+
24+
4. Use hotspots or confirmed regions for recurring valid dynamic regions.
25+
26+
## Avoid
27+
28+
- Raising global project thresholds for one dynamic area.
29+
- Masking a whole page when a small region changes.
30+
- Treating every daily diff as product breakage.
31+
- Ignoring structural changes because a region is known to be dynamic.
32+
33+
## How To Explain Findings
34+
35+
Say whether the diff looks like:
36+
37+
- expected dynamic content
38+
- deterministic fixture drift
39+
- real content disappearance
40+
- layout shift
41+
- screenshot timing/capture instability
42+
- baseline mismatch
43+
44+
Then name the screenshot and include the relevant context command or link.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Public Screenshots
2+
3+
Public screenshots are Vizzly's path for stable image URLs in docs and manuals.
4+
5+
Use this when a user asks for hotlinked UI screenshots, generated manual images, docs that stay current with UI, or CDN-like screenshot URLs.
6+
7+
## Mental Model
8+
9+
Do not use arbitrary build screenshot URLs as stable docs assets. Use Public Properties.
10+
11+
The flow:
12+
13+
1. Capture screenshots with stable metadata.
14+
2. Configure project Public Properties in Vizzly.
15+
3. Approve/publish the baseline build.
16+
4. Use the Public URLs tab to copy the stable URL.
17+
18+
Example capture:
19+
20+
```javascript
21+
await vizzlyScreenshot('watering-widget', screenshot, {
22+
properties: {
23+
manual: 'plant-care',
24+
component: 'watering-widget',
25+
viewport: 'desktop'
26+
}
27+
});
28+
```
29+
30+
Configure a Public Property like `manual=plant-care`. Vizzly publishes matching approved baseline screenshots and keeps stable URLs for each screenshot/property identity.
31+
32+
## Good Uses
33+
34+
- Product manuals
35+
- User docs
36+
- Component catalogs
37+
- In-app UI examples
38+
- Screenshots that should update when approved UI changes
39+
40+
## Cautions
41+
42+
- Public screenshots are public. Do not publish private user data, secrets, or internal-only UI.
43+
- A new unapproved build does not automatically become the public docs image.
44+
- Use stable names and properties so URLs do not churn.

skills/vizzly/references/sdks.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SDK Capture Patterns
2+
3+
Vizzly works best when screenshots are attached to real user journeys and stable names.
4+
5+
## JavaScript Client
6+
7+
```javascript
8+
import { vizzlyScreenshot } from '@vizzly-testing/cli/client';
9+
10+
let screenshot = await page.screenshot();
11+
await vizzlyScreenshot('settings-profile-edit-mode', screenshot, {
12+
properties: {
13+
browser: 'chromium',
14+
viewport: 'desktop',
15+
state: 'edit'
16+
},
17+
threshold: 2,
18+
minClusterSize: 4
19+
});
20+
```
21+
22+
`vizzlyScreenshot(name, image, options)` accepts a PNG buffer or file path.
23+
24+
Important options:
25+
26+
- `properties`: metadata used for baseline identity and filtering.
27+
- `threshold`: per-screenshot CIEDE2000 Delta E tolerance.
28+
- `minClusterSize`: minimum changed-pixel cluster size.
29+
- `fullPage`: marks full-page captures.
30+
31+
## Vitest
32+
33+
Use the Vizzly Vitest plugin when present. It keeps the native `toMatchScreenshot` style:
34+
35+
```javascript
36+
await expect(page.getByRole('heading')).toMatchScreenshot('hero-section.png', {
37+
properties: {
38+
theme: 'dark',
39+
viewport: 'desktop'
40+
},
41+
threshold: 2,
42+
fullPage: true
43+
});
44+
```
45+
46+
## Storybook And Static Sites
47+
48+
If the repo uses Vizzly Storybook or static-site clients, prefer those existing flows over adding custom Playwright screenshots. They already know how to crawl stories/pages, name screenshots, and attach viewport metadata.
49+
50+
## Swift
51+
52+
Swift/XCTest projects use `VizzlyXCTest` helpers such as `app.vizzlyScreenshot(name:properties:threshold:minClusterSize:)`. For iOS work, verify against the Swift package docs in the repo before changing examples.
53+
54+
## Naming
55+
56+
Use stable, descriptive screenshot names:
57+
58+
- Good: `checkout-payment-form-valid-card`
59+
- Good: `settings-profile-edit-mode`
60+
- Avoid: `screenshot1`, `test`, names with slashes
61+
62+
Use properties for variants instead of stuffing every variant into the name.

0 commit comments

Comments
 (0)