fix(scripts): make fast commits skip hooks

This commit is contained in:
Vincent Koc 2026-06-17 16:09:07 +02:00
parent 606f8ec669
commit 16a5d3b51a
No known key found for this signature in database
3 changed files with 6 additions and 6 deletions

View file

@ -110,7 +110,7 @@ For coordinated change sets that genuinely need more than 20 PRs, join the **#cl
- Keep PRs takeover-ready: open them from a branch maintainers can push to. For fork PRs, leave GitHub's **Allow edits by maintainers** option enabled so maintainers can finish urgent fixes, changelog entries, or merge prep when needed. If GitHub shows **Allow edits and access to secrets by maintainers**, enable it only when that workflow/secrets access is acceptable and say so in the PR.
- Do not edit `CHANGELOG.md` in contributor PRs. Maintainers or ClawSweeper add the changelog entry when landing user-facing changes.
- Run tests: `pnpm build && pnpm check && pnpm test`
- For iterative local commits, `scripts/committer --fast "message" <files...>` passes `FAST_COMMIT=1` through to the pre-commit hook so it skips the repo-wide `pnpm check`. Only use it when you've already run equivalent targeted validation for the touched surface.
- For iterative local commits, `scripts/committer --fast "message" <files...>` skips commit hooks. Only use it when you've already run equivalent targeted validation for the touched surface.
- For extension/plugin changes, run the fast local lane first:
- `pnpm test:extension <extension-name>`
- `pnpm test:extension --list` to see valid extension ids

View file

@ -216,7 +216,7 @@ fi
committed=false
if [ "$fast_commit" = true ]; then
declare -a commit_env=(FAST_COMMIT=1)
if run_git_with_lock_retry "commit" env "${commit_env[@]}" git commit -m "$commit_message"; then
if run_git_with_lock_retry "commit" env "${commit_env[@]}" git commit --no-verify -m "$commit_message"; then
committed=true
fi
else

View file

@ -172,18 +172,18 @@ describe("scripts/committer", () => {
expect(committedPaths(repo)).toEqual(["note.txt"]);
});
it("passes FAST_COMMIT through to git hooks when using --fast", () => {
it("bypasses git hooks when using --fast", () => {
const repo = createRepo();
installHook(
repo,
".githooks/pre-commit",
'#!/usr/bin/env bash\nset -euo pipefail\n[ "${FAST_COMMIT:-}" = "1" ] || exit 91\n',
"#!/usr/bin/env bash\nset -euo pipefail\nexit 91\n",
);
writeRepoFile(repo, "note.txt", "hello\n");
const output = commitWithHelperArgs(repo, "--fast", "test: fast hook env", "note.txt");
const output = commitWithHelperArgs(repo, "--fast", "test: fast no verify", "note.txt");
expect(output).toContain('Committed "test: fast hook env" with 1 files');
expect(output).toContain('Committed "test: fast no verify" with 1 files');
expect(committedPaths(repo)).toEqual(["note.txt"]);
});