Skip to content

Modernize compare-html CLI#14

Merged
andiwand merged 2 commits into
mainfrom
improve-cli
Jul 4, 2026
Merged

Modernize compare-html CLI#14
andiwand merged 2 commits into
mainfrom
improve-cli

Conversation

@andiwand

@andiwand andiwand commented Jul 4, 2026

Copy link
Copy Markdown
Member

Reworks the compare-html CLI (formerly compare_output.py) into a modern, CI-friendly tool.

Changes

Rename & structure

  • compare_output.pycompare_output_cli.py; entry point compare-html repointed in pyproject.toml.
  • Shared comparison primitives (compare_files, compare_html, compare_json, comparable_file, parse_json) and logging helpers (setup_logging, verbosity_to_level) moved into common.py. The server now imports from common instead of importing from a CLI module.

CLI UX (rich)

  • Live progress bar with a transient in-flight line showing which file is being processed — only failures stay visible.
  • Failures are summarized at the end (counts + full list), grouped by kind (different / missing / error).
  • Flat full-path output instead of the old tree view, matching the server's style.

Parallelism

  • -j/--max-workers runs comparisons across a thread pool with one browser per worker thread (same model as the server).

CI / GitHub

  • Auto-detects non-TTY / CI and drops the live region, printing failures inline plus a periodic heartbeat.
  • Emits GitHub Actions ::error file=…:: annotations for failures so they surface in the PR UI.

Logging & misc

  • -v/--verbose, --log-file, --log-file-verbosity (shared with the server).
  • --driver none compares only JSON / byte-identical files without launching a browser.
  • Exit codes: 0 all match, 1 differences/missing, 2 bad arguments.
  • Rich markup escaping for arbitrary file names (e.g. weird[name].json).

Verification

Exercised end-to-end against a fixture (matches, differing JSON, missing files, missing dirs, bracketed names) in plain, GitHub-annotation, and forced-TTY live modes; verified exit codes and that the existing browser-free test still passes. Browser-dependent comparisons were not run here (no Selenium browser in this environment).

🤖 Generated with Claude Code

https://claude.ai/code/session_01SujCMUVctCunqAft7ttLFd

andiwand and others added 2 commits July 4, 2026 22:31
- Rename compare_output.py to compare_output_cli.py
- Move shared comparison primitives (compare_files, comparable_file, ...)
  and logging helpers into common.py so the CLI and server share them
  instead of the server importing from a CLI module
- Rich-based CLI: live progress bar showing in-flight files transiently,
  keeping only failures visible, with a failure summary at the end
- Flat full-path output instead of a tree view, matching the server
- Parallel comparison workers (-j/--max-workers) with one browser per
  worker thread, as in the server
- Degrade gracefully in CI / non-TTY: no live region, periodic heartbeat,
  and GitHub Actions ::error:: annotations for failures
- Add -v/--verbose, --log-file, --log-file-verbosity logging options
- Add --driver none to compare only JSON / byte-identical files (no browser)
- Add rich dependency and repoint the compare-html entry point

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SujCMUVctCunqAft7ttLFd
@andiwand andiwand merged commit 300ec20 into main Jul 4, 2026
6 checks passed
@andiwand andiwand deleted the improve-cli branch July 4, 2026 20:44
@andiwand andiwand mentioned this pull request Jul 5, 2026
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