Skip to content

meta: Add hook to auto-add Linear issue links - #1131

Merged
szokeasaurusrex merged 3 commits into
masterfrom
szokeasaurusrex/pre-commit-hook
May 26, 2026
Merged

szokeasaurusrex merged 3 commits into
masterfrom
szokeasaurusrex/pre-commit-hook

Conversation

@szokeasaurusrex

Copy link
Copy Markdown
Member

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 locally; this checks it into this repo with modifications for the new pre-commit hook.

Examples

A footer for getsentry/sentry-rust#1:

References #1

becomes:

References [#1](https://github.com/getsentry/sentry-rust/issues/1)

A footer for getsentry/sentry-rust#1130, which has a Linear linkback to RUST-216:

References #1130

becomes:

References [#1130](https://github.com/getsentry/sentry-rust/issues/1130)
References [RUST-216](https://linear.app/getsentry/issue/RUST-216)

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)
```
@szokeasaurusrex
szokeasaurusrex requested a review from lcian as a code owner May 22, 2026 14:04
@linear-code

linear-code Bot commented May 22, 2026

Copy link
Copy Markdown

RUST-216

@szokeasaurusrex szokeasaurusrex changed the title meta(commit): Add commit message helpers meta: Add hook to auto-add Linear issue links May 22, 2026

@szokeasaurusrex szokeasaurusrex May 22, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@szokeasaurusrex
szokeasaurusrex requested a review from giortzisg May 22, 2026 14:12
cursor[bot]

This comment was marked as resolved.

cursor[bot]

This comment was marked as resolved.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7b4b827. Configure here.

Comment thread scripts/commit-msg-expand-issues.py Resolved

@lcian lcian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, but not sure how the agent is supposed to know which issue we're working on unless you include it in the prompt at some point.

@szokeasaurusrex

Copy link
Copy Markdown
Member Author

Sounds good, but not sure how the agent is supposed to know which issue we're working on unless you include it in the prompt at some point.

My typical workflow involves telling the agent to "work on #XYZ" so usually it knows already. But yeah, that is of course a limitation; at some point you need to tell the agent what issue you are working on

@szokeasaurusrex
szokeasaurusrex merged commit 19a3b63 into master May 26, 2026
26 checks passed
@szokeasaurusrex
szokeasaurusrex deleted the szokeasaurusrex/pre-commit-hook branch May 26, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants