refactor(dev-tools): consolidate git hook scripts under contrib/dev-tools/git#1704
Conversation
…ools/git Move scripts/ content to canonical locations: - scripts/install-git-hooks.sh → contrib/dev-tools/git/install-git-hooks.sh - scripts/pre-commit.sh → deleted (duplicate) - contrib/dev-tools/git/hooks/pre-commit.sh → rewritten in new structured style - contrib/dev-tools/git/hooks/pre-push.sh → rewritten in new structured style The new pre-commit.sh uses a STEPS array with per-step timing and PASSED/FAILED output. It excludes nightly toolchain checks and e2e tests (too slow for pre-commit; covered by CI and pre-push). The new pre-push.sh follows the same structured style and retains all checks from the old script including nightly fmt/check/doc and e2e tests. Update all references across agents, skills, workflows, and documentation.
There was a problem hiding this comment.
Pull request overview
This PR consolidates git-hook related developer tooling by removing the old scripts/ entrypoints and standardizing on the canonical location under contrib/dev-tools/git/, while updating all internal documentation/workflow references accordingly.
Changes:
- Delete the duplicate
scripts/pre-commit.shand migrate callers tocontrib/dev-tools/git/hooks/pre-commit.sh. - Move/standardize the hook installer to
contrib/dev-tools/git/install-git-hooks.sh. - Rewrite
pre-commit.shandpre-push.shhook scripts into a structured “timed steps” format, and update docs/skills/agents/workflows to reference the new paths.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/pre-commit.sh | Removes the legacy/duplicate pre-commit entrypoint. |
| contrib/dev-tools/git/install-git-hooks.sh | Canonical git hook installer path and updated usage comment. |
| contrib/dev-tools/git/hooks/pre-commit.sh | Canonical structured pre-commit hook script. |
| contrib/dev-tools/git/hooks/pre-push.sh | Canonical structured pre-push hook script (nightly + e2e). |
| .githooks/pre-commit | Updates wrapper to call canonical pre-commit script under contrib/. |
| AGENTS.md | Updates hook/script paths in repo guidance. |
| docs/issues/1697-ai-agent-configuration.md | Updates referenced hook install + pre-commit invocation paths. |
| .github/workflows/copilot-setup-steps.yml | Updates workflow path filters and install command to new locations. |
| .github/agents/committer.agent.md | Updates “pre-commit validation command” path. |
| .github/agents/implementer.agent.md | Updates “pre-commit validation command” path. |
| .github/skills/dev/git-workflow/commit-changes/SKILL.md | Updates hook installation and pre-commit command references. |
| .github/skills/dev/git-workflow/run-pre-commit-checks/SKILL.md | Updates hook installation and pre-commit command references. |
| .github/skills/dev/maintenance/setup-dev-environment/SKILL.md | Updates hook installation and pre-commit command references. |
| .github/skills/dev/maintenance/update-dependencies/SKILL.md | Updates verification command reference to canonical pre-commit script. |
Comments suppressed due to low confidence (1)
contrib/dev-tools/git/install-git-hooks.sh:8
- This installer copies hook wrappers from
.githooks/into.git/hooks/, but the repo currently only contains.githooks/pre-commit. As a result, the canonicalcontrib/dev-tools/git/hooks/pre-push.shscript will not be installed as a Gitpre-pushhook and won’t run automatically. Consider adding a.githooks/pre-pushwrapper (like.githooks/pre-commit) or otherwise wiringpre-pushinto the installation process.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1704 +/- ##
========================================
Coverage 86.43% 86.43%
========================================
Files 288 288
Lines 22672 22672
Branches 22672 22672
========================================
+ Hits 19596 19597 +1
Misses 2838 2838
+ Partials 238 237 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- AGENTS.md: clarify nightly toolchain is also needed for pre-push checks - pre-push.sh: explicitly use cargo +stable for non-nightly steps to ensure consistent results across machines regardless of default toolchain
|
ACK b3d1e6b |
Summary
Consolidates the duplicate/misplaced scripts from
scripts/into their canonical location undercontrib/dev-tools/git/.Changes
Files moved / deleted
scripts/install-git-hooks.sh→contrib/dev-tools/git/install-git-hooks.shscripts/pre-commit.sh→ deleted (duplicate; canonical version now lives in hooks dir)Scripts rewritten in new structured style
Both hook scripts now use a
STEPSarray with per-step timing and clearPASSED/FAILEDoutput, matching the style of the newpre-commit.sh.contrib/dev-tools/git/hooks/pre-commit.sh(fast, ~3 min):cargo machete— unused dependency checklinter all— all linterscargo test --doc --workspace— documentation testscargo test --tests --benches --examples --workspace --all-targets --all-features— all testsNightly toolchain checks and e2e tests are intentionally excluded — they are too slow for pre-commit and are covered by CI and
pre-push.contrib/dev-tools/git/hooks/pre-push.sh(comprehensive, ~15 min):cargo machetelinter allcargo +nightly fmt --checkcargo +nightly check …cargo +nightly doc …cargo test --doc --workspacecargo test … --all-targets --all-featurese2e_tests_runner)References updated
All references to the old
scripts/paths have been updated across:.githooks/pre-commitAGENTS.md.github/workflows/copilot-setup-steps.yml.github/agents/committer.agent.md.github/agents/implementer.agent.md.github/skills/dev/git-workflow/commit-changes/SKILL.md.github/skills/dev/git-workflow/run-pre-commit-checks/SKILL.md.github/skills/dev/maintenance/setup-dev-environment/SKILL.md.github/skills/dev/maintenance/update-dependencies/SKILL.mddocs/issues/1697-ai-agent-configuration.md