Skip to content

Modernize html-tidy CLI#16

Merged
andiwand merged 1 commit into
mainfrom
modernize-html-tidy
Jul 5, 2026
Merged

Modernize html-tidy CLI#16
andiwand merged 1 commit into
mainfrom
modernize-html-tidy

Conversation

@andiwand

@andiwand andiwand commented Jul 5, 2026

Copy link
Copy Markdown
Member

Applies the same modernization the compare-html CLI got in #14/#15 to the html-tidy entry point (tidy_output).

What changed

  • Rich-based UI: live, transient progress bar that shows in-flight files and keeps only findings on screen, plus a Summary rule at the end — replacing the ASCII tree view and raw bcolors prints.
  • Flat full-path output matching the compare CLI.
  • Parallel workers via -j/--max-workers; tidy/JSON validation now runs in a ThreadPoolExecutor instead of a recursive serial walk.
  • CI / non-TTY degradation: no live region, periodic heartbeat, and GitHub Actions ::error:: / ::warning:: annotations so findings surface in the Actions UI.
  • Logging options -v/--verbose, --log-file, --log-file-verbosity via the shared setup_logging.
  • --details prints the full tidy / validator output per finding (this is what the old --verbose did).
  • Split collect_tasks (walk) from execution so live and plain runners share one path, mirroring compare_output_cli.
  • The tidy_json / tidy_html / tidy_file helpers now return (status, detail) instead of printing from worker threads, so parallel output no longer interleaves.

Behavior change

  • Invalid JSON is now reported as an error (fails the run) rather than a warning — a broken JSON file isn't a benign warning. Warnings still don't fail the run; only errors set a non-zero exit code.

Testing

  • Existing pytest suite passes (3 passed).
  • Exercised locally against a tree with clean/warning/error HTML and valid/invalid JSON: plain output, --details, -j 4, empty dir, non-dir argument, clean-only (exit 0), and GITHUB_ACTIONS=true annotations all verified.

🤖 Generated with Claude Code

Bring tidy_output in line with the recently modernized compare-html CLI
(compare_output_cli):

- Rich-based CLI: live progress bar showing in-flight files transiently,
  keeping only findings visible, with a summary at the end.
- Flat full-path output instead of the ASCII tree view.
- Parallel tidy workers (-j/--max-workers); tidy/JSON validation runs in a
  ThreadPoolExecutor instead of a recursive, serial walk.
- Degrade gracefully in CI / non-TTY: no live region, periodic heartbeat,
  and GitHub Actions ::error:: / ::warning:: annotations for findings.
- Add -v/--verbose, --log-file, --log-file-verbosity logging options via the
  shared setup_logging helper, replacing the ad-hoc bcolors prints.
- Add --details to print the full tidy / validator output per finding
  (previously tied to the old --verbose flag).
- Split collection (collect_tasks) from execution so both live and plain
  runners share one code path, mirroring the compare CLI.
- The tidy/JSON helpers now return (status, detail) instead of printing from
  inside worker threads, so parallel output no longer interleaves.

Behavior change: invalid JSON is now reported as an error (fails the run)
instead of a warning; a broken JSON file is not a benign warning.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AY3gNLvnBJNYEzhb8nNeqV
@andiwand andiwand merged commit 39cff59 into main Jul 5, 2026
5 checks passed
@andiwand andiwand deleted the modernize-html-tidy branch July 5, 2026 09:09
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