Skip to content

feat(dev-tools): refactor pre-commit output and runtime profile#1773

Merged
josecelano merged 7 commits into
torrust:developfrom
josecelano:1769-refactor-pre-commit-checks-performance-and-verbosity
May 13, 2026
Merged

feat(dev-tools): refactor pre-commit output and runtime profile#1773
josecelano merged 7 commits into
torrust:developfrom
josecelano:1769-refactor-pre-commit-checks-performance-and-verbosity

Conversation

@josecelano
Copy link
Copy Markdown
Member

Summary

  • refactor pre-commit hook for faster default feedback and lower output noise
  • add output modes: --format=<text|json>, --verbosity=<concise|verbose>, and --verbose alias
  • make concise mode default with per-step pass/fail timing and failure log pointers
  • support structured JSON output for automation
  • tune pre-commit profile to fast local gate (cargo machete, linter all, cargo test --doc --workspace)
  • add configurable log directory via PRE_COMMIT_LOG_DIR (default /tmp, workspace option .tmp)
  • update docs and skill guidance
  • add follow-up open spec for pre-push parity in docs/issues/open/1770-refactor-pre-push-checks-performance-and-verbosity.md

Validation

  • linter all
  • ./contrib/dev-tools/git/hooks/pre-commit.sh
  • ./contrib/dev-tools/git/hooks/pre-commit.sh --format=json
  • argument validation checks for invalid/unknown flags (exit code 2)
  • failure-path smoke checks for text/json payload behavior

Context

Implements issue spec:

  • docs/issues/open/1769-refactor-pre-commit-checks-performance-and-verbosity.md

@josecelano josecelano requested a review from a team as a code owner May 13, 2026 10:48
@josecelano josecelano self-assigned this May 13, 2026
@josecelano josecelano requested a review from Copilot May 13, 2026 10:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the developer pre-commit hook experience to reduce noise and improve latency by default, while adding structured output modes intended for both humans and automation. It also updates workflow documentation/specs and adds a follow-up “open issue” spec for bringing pre-push behavior to parity.

Changes:

  • Refactor pre-commit.sh to default to a faster 3-step profile and add --format=<text|json> + --verbosity=<concise|verbose> (plus --verbose alias) with per-step log capture.
  • Update agent/skill documentation to describe the new output modes, log directory override via PRE_COMMIT_LOG_DIR, and tier ownership (pre-commit vs pre-push vs CI).
  • Add a new open spec describing a future pre-push refactor for output-mode parity.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
contrib/dev-tools/git/hooks/pre-commit.sh Implements new output modes, concise-by-default summaries, and per-step log capture; updates runtime profile.
docs/issues/open/1769-refactor-pre-commit-checks-performance-and-verbosity.md Updates the issue spec to reflect implemented pre-commit contract, timings, and completion status.
docs/issues/open/1770-refactor-pre-push-checks-performance-and-verbosity.md Adds a follow-up open spec for pre-push output/logging parity.
AGENTS.md Documents the new pre-commit profile, output modes, and log directory guidance for agents.
.github/skills/dev/git-workflow/run-pre-commit-checks/SKILL.md Updates skill guidance for running pre-commit with new flags and troubleshooting.
.gitignore Ignores /.tmp/ to support workspace-local log output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread contrib/dev-tools/git/hooks/pre-commit.sh Outdated
Comment thread contrib/dev-tools/git/hooks/pre-commit.sh
Comment thread contrib/dev-tools/git/hooks/pre-commit.sh
@josecelano josecelano force-pushed the 1769-refactor-pre-commit-checks-performance-and-verbosity branch from 3e2b6d6 to 369c5fd Compare May 13, 2026 11:19
@josecelano
Copy link
Copy Markdown
Member Author

ACK bf6b570

@josecelano josecelano linked an issue May 13, 2026 that may be closed by this pull request
32 tasks
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.01%. Comparing base (7cdc882) to head (bf6b570).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1773      +/-   ##
===========================================
- Coverage    79.02%   79.01%   -0.01%     
===========================================
  Files          371      371              
  Lines        27928    27928              
  Branches     27928    27928              
===========================================
- Hits         22069    22068       -1     
  Misses        5555     5555              
- Partials       304      305       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josecelano josecelano merged commit e4f8cf3 into torrust:develop May 13, 2026
19 checks passed
# Expected runtime: ~1 minute on a modern developer machine (concise default profile).
# AI agents: set a per-command timeout of at least 3 minutes before invoking this script.
#
# All steps must pass (exit 0) before committing.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should have a summary of the steps and what it supposed to be achieved in this file header?

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.

Refactor pre-commit checks for lower verbosity and faster feedback

3 participants