Skip to content

Versatility: standard-app defaults, configurable grouping, failure policy, GitHub Actions & programmatic API - #3

Merged
howdu merged 4 commits into
mainfrom
feat/versatility-v2
Jun 2, 2026
Merged

Versatility: standard-app defaults, configurable grouping, failure policy, GitHub Actions & programmatic API#3
howdu merged 4 commits into
mainfrom
feat/versatility-v2

Conversation

@howdu

@howdu howdu commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Makes the plugin useful beyond the package-heavy-monorepo shape it was built for, defaulting to a standard Laravel app first. (Re-opened against main; the previous PR landed on the already-merged #1 branch instead of main.)

Standard-app-first defaults

  • Zero-config DEFAULT_INCLUDE is just resources/views/**/*.blade.php, so it works out of the box on a normal Laravel app.
  • The package-per-directory monorepo layout is an opt-in extra (add the package glob to include), documented under a Monorepos section.

Configurable output grouping

  • group_by: auto (default — package name for packages/<name>/…, else containing directory), package, directory, flat. Extracted into BladeViewGrouper; the hardcoded packages/<name> grouping is gone.

Flexible failure policy

  • Inline {{-- blade-coverage:ignore --}} marker drops a view from targets (co-located, survives renames better than exclude globs).
  • mode: strict ignores the baseline and fails on any uncovered view.
  • min_coverage: N fails when the covered percentage drops below the threshold; combines with either mode.

Richer CI integration

  • Auto-detects GitHub Actions → inline ::error annotations for new/changed uncovered views (shown on the PR diff) + a coverage summary table appended to $GITHUB_STEP_SUMMARY. No flags; no-op elsewhere.

Programmatic use

  • BladeCoverage::capture(callable) returns the view paths a callback rendered; BladeCoverage::rendered($view, callable) for a boolean assertion — self-contained, no plugin run required.

Reporting

  • Console summary + JSON report gained a coverage percentage (JSON keeps it a float via JSON_PRESERVE_ZERO_FRACTION); JSON failed reflects the effective policy outcome, not just baseline state.

Backwards compatibility

All new config keys are optional with safe fallbacks (invalid group_by/mode → defaults; min_coverage clamped to 0–100). Existing baseline behaviour is unchanged when none are set.

Testing

  • vendor/bin/pest25 passed (+6 over baseline).
  • vendor/bin/pint --test passes; verified under both prefer-lowest and prefer-stable.

🤖 Generated with Claude Code

howdu and others added 4 commits June 2, 2026 08:16
…grammatic API

Generic project support (A):
- Default include now covers resources/views AND packages/*/resources/views, so
  the plugin is useful zero-config on a standard app or a monorepo.
- New 'group_by' option (auto|package|directory|flat) via BladeViewGrouper;
  output grouping is no longer hardcoded to the packages/<name> layout.

Flexible failure policy (C):
- Inline '{{-- blade-coverage:ignore --}}' marker drops a view from targets.
- 'mode' => 'strict' ignores the baseline and fails on any uncovered view.
- 'min_coverage' => N fails when covered percentage falls below the threshold.

Richer CI integration (B):
- GithubActionsReporter auto-emits ::error annotations for new/changed uncovered
  views and appends a summary table to $GITHUB_STEP_SUMMARY when in Actions.

Programmatic use (D):
- BladeCoverage::capture()/rendered() capture views rendered by a callback for
  single-test assertions, independent of the suite-wide run.

Reporting:
- Console summary and JSON report now include coverage percentage (JSON keeps the
  float via JSON_PRESERVE_ZERO_FRACTION); JSON 'failed' reflects the effective
  policy outcome.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ter and programmatic API

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Reorient the zero-config default to a standard Laravel app: DEFAULT_INCLUDE is
now just resources/views/**/*.blade.php. The package-per-directory monorepo
layout becomes an opt-in extra documented under a Monorepos section, rather than
part of the default include. README intro and examples lead with the standard
app shape.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@howdu
howdu merged commit 18bb7aa into main Jun 2, 2026
5 checks passed
@howdu
howdu deleted the feat/versatility-v2 branch June 2, 2026 07:20
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