meta: Add hook to auto-add Linear issue links#1131
Conversation
Add a `commit-msg` `pre-commit` hook that expands GitHub issue footers into markdown links and appends a matching Linear footer when GitHub comments include a linked Linear issue. Running this as a hook ensures footer expansion happens for both agent-written and manually-written commit messages. Add a commit agent skill that fetches Sentry commit guidelines before creating or amending commits and documents the footer format expected by the hook. I have been using a similar [commit skill](https://github.com/szokeasaurusrex/pi-agent/blob/85d169d0022f31c46cf7821e2f176bd739b1b2a2/skills/commit/SKILL.md) locally; this checks it into this repo with modifications for the new `pre-commit` hook. ### Examples A footer for [#1](#1): ``` References #1 ``` becomes: ``` References [#1](#1) ``` A footer for [#1130](#1130), which has a Linear linkback to [RUST-216](https://linear.app/getsentry/issue/RUST-216): ``` References #1130 ``` becomes: ``` References [#1130](#1130) References [RUST-216](https://linear.app/getsentry/issue/RUST-216) ```
There was a problem hiding this comment.
This script is admittedly 100% vibe-coded 🤖
I have skimmed the script, and it looks reasonable, but did not fully read it. In my limited testing, it appears to work. Given that this is only used as a pre-commit script, I think that should be okay; we can fix bugs as they are discovered.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 80c71ac. Configure here.
| from typing import Any | ||
|
|
||
| FOOTER_RE = re.compile( | ||
| r"^(?P<prefix>\s*)(?P<keyword>\w+)\s+" |
There was a problem hiding this comment.
Regex fails to match multi-word keywords documented in SKILL.md
Medium Severity
FOOTER_RE uses (?P<keyword>\w+) which only matches single-word keywords. The SKILL.md documents "Related to" and "Contributes to" as valid multi-word keywords, but lines like Related to #1130 will never match the regex — \w+ captures only "Related", then \s+ consumes the space, and "to #1130" fails the display group since # doesn't immediately follow "to". These footers are silently skipped with no warning, so agents following the documented format will produce unexpanded footers with no Linear links added.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 80c71ac. Configure here.
| Run: | ||
|
|
||
| ```bash | ||
| scripts/fetch-commit-guidelines.sh |
There was a problem hiding this comment.
Skill references nonexistent script path from repo root
Medium Severity
The SKILL.md instructs agents to run scripts/fetch-commit-guidelines.sh, but that path doesn't exist in the repo-root scripts/ directory (which only contains bump-version.sh, commit-msg-expand-issues.py, generate-readme.sh, and update-readme.sh). The actual script lives at .agents/skills/commit/scripts/fetch-commit-guidelines.sh. An agent executing this from the repository root will get a "file not found" error, causing the skill's first step (fetching commit guidelines) to fail entirely.
Reviewed by Cursor Bugbot for commit 80c71ac. Configure here.


Add a
commit-msgpre-commithook that expands GitHub issue footers into markdown links and appends a matching Linear footer when GitHub comments include a linked Linear issue. Running this as a hook ensures footer expansion happens for both agent-written and manually-written commit messages.Add a commit agent skill that fetches Sentry commit guidelines before creating or amending commits and documents the footer format expected by the hook. I have been using a similar commit skill locally; this checks it into this repo with modifications for the new
pre-commithook.Examples
A footer for getsentry/sentry-rust#1:
becomes:
A footer for getsentry/sentry-rust#1130, which has a Linear linkback to RUST-216:
becomes: