Files
buzz/lefthook.yml
T
dc1646fcb9 docs: document required DCO sign-off and add commit-msg sign-off hook (#2993)
`DCO Check` is a required status check on this repo and the top failing
check on open contributor PRs, but nothing documented it and nothing
surfaced it locally — a missing `Signed-off-by` trailer only showed up
as a red check after the PR was already open.

## `lefthook.yml`

New `commit-msg` hook that appends the `Signed-off-by` trailer:

```yaml
commit-msg:
  commands:
    signoff:
      run: 'git interpret-trailers --if-exists doNothing --trailer "Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed ''s/ [0-9]* [+-][0-9]*$//'')" --in-place {1}'
```

`GIT_COMMITTER_IDENT` is the identity that performed the commit, which
is what a DCO sign-off certifies and what native `git commit -s` uses.
Committing someone else's work with `--author` or `git commit -C`
therefore signs off as you, not as the original author.

`--if-exists doNothing` makes it idempotent: `git commit -s` still
yields exactly one trailer, and an existing sign-off from a different
signer is preserved rather than supplemented. An empty commit message
still aborts — the hook does not turn one into a commit body containing
only a trailer.

Git runs `commit-msg` for `git commit` and `git merge` only. Other flows
bypass it and need their own sign-off flag — `git rebase --signoff`,
`git cherry-pick -s`. Note `-s` is `--strategy` on `git rebase`, so only
the long flag works there. The header comment and both docs state the
scope rather than promising blanket coverage. Installed by `just hooks`;
`commit-msg` carries no `glob` because it rewrites the message, not
files.

## `CONTRIBUTING.md`

`Before You Open a PR` gains a paragraph on sign-off: commit with `git
commit -s`, what the trailer certifies, that the required `DCO Check`
blocks merge without it, `git rebase --signoff main` to repair
already-pushed commits, and what the hook does and does not cover.

`CI Gate` gains one sentence pointing at `just fix-all` for
formatting-only failures.

## `AGENTS.md`

`Quality Gates` gains the same requirement framed for agents, including
the sequencer caveat and the reminder to include `-s` in
programmatically built commit commands.

## Related issue
none found

---------

Signed-off-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
2026-07-26 13:43:06 -04:00

73 lines
3.1 KiB
YAML

# Glob patterns below mirror the `changes` job's dorny/paths-filter groups in
# .github/workflows/ci.yml — keep the two in sync. Deliberate deviations:
# - The `.github/workflows/ci.yml` path CI adds to its `rust`/`mobile` filters
# is omitted; a CI-workflow-only edit doesn't need a local test run.
# - `desktop-check`/`desktop-test` don't trigger on `rust` changes, though CI's
# Desktop Core job does. Those commands are pure TS (biome + node:test) with
# no Rust dependency, so the extra trigger would be spurious locally.
# - Deletion-only surface changes do not trigger local hooks: lefthook 2.1.x
# drops deleted paths from push-file discovery (`extractFiles` existence
# check, repository.go). CI's dorny/paths-filter catches deletions.
# Deliberate — accepted, not worked around.
# - `commit-msg` has no glob: it rewrites the commit message, not files. Note
# Git only runs it for `git commit` and `git merge` — other flows need their own
# flag: `git rebase --signoff`, `git cherry-pick -s`.
pre-commit:
parallel: true
commands:
rust-fmt:
glob: ["crates/**", "examples/countdown-bot/**"]
run: just fmt
stage_fixed: true
desktop-tauri-fmt:
glob: ["desktop/src-tauri/**"]
run: just desktop-tauri-fmt
stage_fixed: true
desktop-fix:
glob: ["desktop/**", "pnpm-lock.yaml"]
exclude: ["desktop/src-tauri/**"]
run: just desktop-fix
stage_fixed: true
web-fix:
glob: ["web/**", "pnpm-lock.yaml"]
run: just web-fix
stage_fixed: true
mobile-fix:
glob: ["mobile/**"]
run: just mobile-fix
stage_fixed: true
# Appends the DCO Signed-off-by trailer the required "DCO Check" enforces.
# `--if-exists doNothing` makes it idempotent and preserves an existing
# sign-off (including `git commit -s` and a different signer's trailer).
commit-msg:
commands:
signoff:
run: 'git interpret-trailers --if-exists doNothing --trailer "Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed ''s/ [0-9]* [+-][0-9]*$//'')" --in-place {1}'
pre-push:
parallel: true
commands:
branch-skew:
run: ./scripts/check-branch-skew.sh
rust-tests:
glob: ["crates/**", "migrations/**", "schema/**", "Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "deny.toml", "scripts/run-tests.sh", "justfile"]
run: just test-unit
desktop-check:
glob: ["desktop/**", "pnpm-lock.yaml"]
exclude: ["desktop/src-tauri/**"]
run: just desktop-check
desktop-test:
glob: ["desktop/**", "pnpm-lock.yaml"]
exclude: ["desktop/src-tauri/**"]
run: just desktop-test
desktop-tauri-test:
# ci.yml:113 — Desktop Core triggers on `rust` OR `desktop-rust`;
# desktop/src-tauri path-depends on crates/buzz-core, buzz-persona,
# buzz-sdk, buzz-agent (desktop/src-tauri/Cargo.toml:88-91).
glob: ["desktop/src-tauri/**", "crates/**", "migrations/**", "schema/**", "Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "deny.toml", "scripts/run-tests.sh", "justfile"]
run: just desktop-tauri-test
mobile-test:
glob: ["mobile/**"]
run: just mobile-test