Skip to content

--only: run a subset of the config's routes with their hooks - #118

Merged
tmashara merged 1 commit into
mainfrom
claude/only-flag
Nov 2, 2026
Merged

tmashara merged 1 commit into
mainfrom
claude/only-flag

Conversation

@tmashara

@tmashara tmashara commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Refs #113 (last item, "Run a config's hooks on a subset")
Refs #59 ("CLI routes lose their config hooks")

Change

--only <route|file> filters the config's routes and keeps each picked route's own before/beforeShot hooks and selector, plus the global hooks and masks. Routes given on the command line work as before: a plain renderdiff /a still replaces the config's routes.

renderdiff --only /pricing                  # every config route on /pricing, whatever its selector
renderdiff --only /pricing --only /a::/b    # repeatable; pairs and trailing slashes normalize
renderdiff --only '/pricing @.plans'        # only the /pricing route with that selector
renderdiff --only routes.txt                # a file in cwd: one route per line, blank lines skipped
  • A route matches on its path (or pair). With @sel, the selector must match too. Matching uses label() rather than name(), so --only /pricing finds a config route that has its own selector.
  • The routes keep config order and are never repeated.
  • A value naming an existing file (relative to cwd) is read as a route list.

Errors (exit 2)

  • Every value and every file line has to match. Otherwise: --only /x matches no config route; the config has: /a, /b [.card], … (up to 20 listed). A file line is named: --only routes.txt: "/x" (line 3) matches no config route; ….
    • A miss that looks like a file name adds (and no such file).
    • A config with no routes ends the config has no routes.
  • --only with routes on the command line, or with --sitemap, is a usage error. So is --only with no config file, an --only file with no routes, or renderdiff probe … --only.

--rerun-failed

No change. A rerun has to repeat the last run's routes, so rerun with the same --only. A different or missing --only gets the existing "routes … differ" error. The README says so.

Docs

  • --help, the README usage table, the exit-code row and the rerun paragraph.
  • The routes comment in renderdiff.config.example.ts.
  • One clause in the skill's baseline step.

Verification

  • npm run typecheck, npm run lint, npm run format:check: clean
  • npm test: 371 pass. New --dry-run tests cover:
    • picking a config route by path keeps its own selector (the fixture route also has a before hook);
    • a path picks each of its selector variants, and ' @sel' narrows to one;
    • repeated values and pairs come out in config order;
    • a route file works;
    • a miss beside a hit, a file-name typo, a bad file line and an all-blank file each error;
    • no config file, and a config with no routes, each error;
    • in cli-args: an empty value, --only with CLI routes or --sitemap, and probe --only.
  • Visual tests not run: the change stops at the route list, before run().

🤖 Generated with Claude Code

Routes given on the command line replace the config's, so they lose its
per-route before/beforeShot hooks and selectors. --only <route|file> filters
the config's routes instead: same path or pair, or the same selector with
'/a @sel'. A value naming a file in cwd lists one route per line. Each value
or line that matches no config route exits 2 with the routes the config has.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant