Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/json-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,72 @@ When screenshots are captured, Vizzly also writes local review artifacts under
`.vizzly/report/index.html`. Use `contextCommand` when you want a stable
follow-up command for local review data.

### `vizzly tdd screenshots`

`tdd screenshots` reads the latest local comparison report directly from
`.vizzly/`. It works after `tdd run` exits and does not need a TDD server or
cloud credentials.

```bash
vizzly tdd screenshots list
vizzly tdd screenshots list --page 2 --page-size 20 --status failed
vizzly tdd screenshots latest
vizzly tdd screenshots show 1a2b3c4d5e6f7890
vizzly tdd screenshots show 1a2b3c4d5e6f7890 --image diff
vizzly tdd screenshots accept 1a2b3c4d5e6f7890
```

The list is ordered as the comparisons were recorded. Use the printed
comparison ID with `show`; a screenshot name also works when it identifies one
comparison. If the same name has multiple browser or viewport variants, use an
ID to select one.

`latest` prints only the absolute path to the most recently captured current
screenshot. Add a screenshot name to choose the latest variant with that name.
`show` prints comparison details and the current screenshot path by default.
Request `--image diff`, `--image baseline`, or `--image all` to include those
image paths.

JSON list output includes pagination and the current image path with
availability for each comparison:

```json
{
"status": "data",
"data": {
"page": 1,
"pageSize": 20,
"total": 1,
"totalPages": 1,
"hasPrevious": false,
"hasNext": false,
"screenshots": [
{
"id": "1a2b3c4d5e6f7890",
"name": "button-primary",
"status": "failed",
"diffPercentage": 4.2,
"browser": "chromium",
"viewport": { "width": 1920, "height": 1080 },
"currentImage": {
"path": "/project/.vizzly/current/button-primary.png",
"exists": true
}
}
]
}
}
```

`accept` copies the selected current screenshot into the matching local
baseline, updates baseline metadata, and marks that report entry as passed.
It does not need a running server or cloud credentials. Use
`vizzly tdd run "<command>" --set-baseline --no-open` to set baselines for every
screenshot captured by a run.

Open or read the printed local image paths with your image viewer when you want
to inspect a capture or diff.

### `vizzly tdd start`

```bash
Expand Down
25 changes: 25 additions & 0 deletions skills/vizzly/references/cli-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,31 @@ vizzly tdd stop --json
`tdd run` and `tdd start` are alternatives. Stop only a daemon started for the
current task.

## Review A Local TDD Run

After `tdd run` exits, inspect captures directly from `.vizzly`. These
commands don't need a running TDD daemon or cloud credentials:

```bash
vizzly tdd screenshots list --page 1 --page-size 20
vizzly tdd screenshots latest
vizzly tdd screenshots show <comparison-id>
```

`latest` prints the current screenshot path for the most recent capture. Use
`list` to find a comparison ID when you need a specific screenshot or browser
variant. During UI iteration, inspect the current image first; request
`--image diff` or `--image all` when comparison diagnostics help answer the
question. Open the printed image paths with the available image viewer.

`accept` replaces one local baseline and updates that report entry. Use it only
when the task explicitly authorizes accepting a baseline; don't accept a change
just to make a diff disappear:

```bash
vizzly tdd screenshots accept <comparison-id>
```

When a cloud build is in scope:

```bash
Expand Down
46 changes: 46 additions & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ import {
tddStopCommand,
validateTddStartOptions,
} from './commands/tdd-daemon.js';
import {
acceptTddScreenshot,
latestTddScreenshot,
listTddScreenshots,
showTddScreenshot,
} from './commands/tdd-screenshots.js';
import { uploadCommand, validateUploadOptions } from './commands/upload.js';
import { whoamiCommand } from './commands/whoami.js';
import { createPluginServices } from './plugin-api.js';
Expand Down Expand Up @@ -744,6 +750,46 @@ tddCmd
await tddListCommand(options, globalOptions);
});

let tddScreenshotsCmd = tddCmd
.command('screenshots')
.description('Browse local TDD screenshots without a server');

tddScreenshotsCmd
.command('list')
.description('List captured screenshots from the latest local TDD run')
.option('--page <number>', 'Page number', Number, 1)
.option('--page-size <number>', 'Screenshots per page (max 100)', Number, 20)
.option('--status <status>', 'Filter by comparison status')
.action(options => {
listTddScreenshots(options);
});

tddScreenshotsCmd
.command('latest [name]')
.description('Print the latest captured screenshot path')
.action(name => {
latestTddScreenshot(name);
});

tddScreenshotsCmd
.command('show <id-or-name>')
.description('Inspect a screenshot; print current image by default')
.option(
'--image <kind>',
'Print image path: current, baseline, diff, or all',
'current'
)
.action((idOrName, options) => {
showTddScreenshot(idOrName, options);
});

tddScreenshotsCmd
.command('accept <id-or-name>')
.description('Accept a captured screenshot as its new local baseline')
.action(async idOrName => {
await acceptTddScreenshot(idOrName);
});

// TDD Run - One-off test run with ephemeral server (generates static report)
tddCmd
.command('run <command>')
Expand Down
Loading
Loading