commit
- Run
git diff --cachedto see all staged changes. If the diff is empty, inform the user that there are no staged changes and suggest they stage files withgit addbefore running this command. Do not proceed further. - Resolve the ticket identifier:
-
If a ticket argument was supplied, use it — it always wins; skip the rest of this step. The argument
--no-ticket(or the invoker explicitly asking for no ticket) also skips the rest of this step: write the message without one — inference never overrides a deliberate omission. -
Otherwise, check the current branch name (
git branch --show-current) for an issue reference. Only these patterns count:#<digits>anywhere in the nameissue-<digits>orissues/<digits><digits>-<slug>at the start of a path segment (123-fix-login,feat/123-fix-login)- an uppercase project key with a number (
SALES-456) - a lowercase tracker key with a number at the start of a path segment that follows another segment (Linear's
markus/eng-142-fix-login, Shortcut'smarkus/sc-1234/fix-login); uppercase the key on output (ENG-142). In a first or only segment, a lowercase word before digits is a type or word prefix, not a key —fix-123-loginyields nothing
These exclusions override every pattern above. Digits embedded in an ordinary word, version, or date are not references —
chore/bump-node-22,v2-api,2026-08-15-hotfix,dependabot/npm_and_yarn/lodash-4.17.21, andrenovate/node-22.xyield nothing (a package name is not a tracker key). Well-known standards identifiers are not project keys —fix/CVE-2024-21538,RFC-7231,SHA-256,ISO-8601yield nothing. -
Otherwise, use the issue the conversation explicitly ties to the staged work (e.g. the user asked for this change by issue number or link). A passing mention of an issue that isn't the subject of the staged changes does not count.
-
If nothing resolves, proceed without a ticket exactly as before. If the repo's recent history shows a ticket convention (several recent subjects in
git log --oneline -15carry an issue reference — atype(#123):ortype(KEY-123):scope, aKEY-123:prefix, or a trailing(#123)), note in one line — in your reply, never inside the commit message — that no issue reference was found so the user can decide; otherwise say nothing. Never prompt, gate, or retry over a missing reference.
-