Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .cursor/rules/git-workflow.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ See `AGENTS.md` for the full canonical version. Short form:
2. Commit with conventional-style message:
`<type>: <imperative summary>`

**Every commit must credit Claude as co-author.** `.githooks/prepare-commit-msg`
appends the trailer automatically after `npm install`, but include it
explicitly anyway as defense-in-depth:
```
Co-authored-by: Claude <noreply@anthropic.com>
```

3. Push the branch and open a PR:
```bash
git push -u origin HEAD
Expand Down
27 changes: 27 additions & 0 deletions .githooks/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env sh
# Appends a Co-authored-by trailer crediting Claude on every commit.
#
# Activated via `core.hooksPath = .githooks`, which is set automatically by the
# `postinstall` npm script. To install manually, run:
# git config core.hooksPath .githooks

set -e

COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2

# Skip for true merge commits (they carry their own author metadata) but run
# for everything else including squash, amend, and template-based commits.
case "$COMMIT_SOURCE" in
merge) exit 0 ;;
esac

COAUTHOR="Co-authored-by: Claude <noreply@anthropic.com>"

# `git interpret-trailers` handles trailer placement (blank line before,
# existing trailers, duplicates) correctly.
git interpret-trailers \
--in-place \
--if-exists addIfDifferent \
--trailer "$COAUTHOR" \
"$COMMIT_MSG_FILE"
20 changes: 19 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ For every change:
```
Branch name format: `fix/…`, `feat/…`, `chore/…`, `docs/…`, `refactor/…`.

2. Commit with a conventional-style message:
2. Commit with a conventional-style message. **Every commit in this repo must
credit Claude as a co-author** — `.githooks/prepare-commit-msg` appends the
trailer automatically once `npm install` has run, but include it explicitly
anyway (e.g. when you commit via an API/web editor that skips git hooks):

```
<type>: <imperative summary>

<optional body explaining the why>

Co-authored-by: Claude <noreply@anthropic.com>
```

3. Push the branch and open a PR with `gh pr create`:
Expand Down Expand Up @@ -52,6 +58,18 @@ Run the same sequence CI runs — fail fast locally:
npm run lint && npm run typecheck && npm run test && npm run build
```

## Git hooks (co-author trailer)

This repo ships a `prepare-commit-msg` hook at `.githooks/prepare-commit-msg`
that appends `Co-authored-by: Claude <noreply@anthropic.com>` on every commit
(skipped for merge commits). `npm install` sets `core.hooksPath = .githooks`
via the `postinstall` script, so the hook activates automatically after a
fresh clone + install.

If you commit in an environment where the hook can't run (GitHub web editor,
some sandboxed agents, `-n` / `--no-verify` situations), add the trailer
manually so the policy is never silently dropped.

## Secrets

Never commit `.env.local`, `.env.vercel.check`, `.env.sentry-build-plugin`, or
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"lint": "eslint",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest"
"test:watch": "vitest",
"postinstall": "git config core.hooksPath .githooks 2>/dev/null || true"
},
"dependencies": {
"@fontsource/bitter": "^5.2.10",
Expand Down
Loading