Skip to content

Versatility: configurable grouping, failure policy, GitHub Actions & programmatic API - #2

Merged
howdu merged 3 commits into
fix/config-defaults-and-drift-detectionfrom
feat/versatility
Jun 2, 2026
Merged

Versatility: configurable grouping, failure policy, GitHub Actions & programmatic API#2
howdu merged 3 commits into
fix/config-defaults-and-drift-detectionfrom
feat/versatility

Conversation

@howdu

@howdu howdu commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #1 that makes the plugin useful beyond the package-heavy-monorepo shape it was built for. Implements all four agreed directions. Stacked on #1 — base it on main once #1 merges, or merge #1 first.

A — Generic project support

  • Zero-config defaults now cover both resources/views/**/*.blade.php and packages/*/resources/views/**/*.blade.php, so a standard app works without a config file.
  • Configurable output grouping via group_by: auto (default — package name for packages/<name>/…, else containing directory), package, directory, flat. The hardcoded packages/<name> grouping (everything else fell into "other") is gone, extracted into BladeViewGrouper.

B — Richer CI integration

  • Auto-detects GitHub Actions and emits ::error file=…,line=1 inline annotations for each new/changed uncovered view (they show on the PR diff), plus a coverage summary table appended to $GITHUB_STEP_SUMMARY. No flags; no-op elsewhere.

C — Flexible failure policy

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

D — Programmatic / standalone use

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

Reporting niceties

  • Console summary and JSON report gained a coverage percentage (JSON keeps it a float via JSON_PRESERVE_ZERO_FRACTION); JSON failed now reflects the effective policy outcome (e.g. a min-coverage breach), not just baseline state.

Backwards compatibility

All new config keys are optional with safe fallbacks (invalid group_by/mode → defaults; out-of-range min_coverage clamped to 0–100). Existing baseline behaviour is unchanged when none of the new keys are set. Note: the broadened default include only affects projects running with no include configured.

Testing

  • vendor/bin/pest25 passed (was 19; +6 covering grouping, config parsing, ignore marker, coverage %/JSON failed threading, GH Actions annotations+summary, and the programmatic helper).
  • vendor/bin/pint --test passes; verified under both prefer-lowest and prefer-stable.

🤖 Generated with Claude Code

howdu and others added 3 commits June 2, 2026 08:02
…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]>
@howdu
howdu merged commit ca2dd1b into fix/config-defaults-and-drift-detection Jun 2, 2026
5 checks passed
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