-
Notifications
You must be signed in to change notification settings - Fork 425
chore(repo): add commit message generator with clerk-specific scopes #7546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,168 @@ | ||||||
| --- | ||||||
| description: v7 - Generate commit message from chat changes | ||||||
| (note to LLMs: increment version when you make changes to this file) | ||||||
| --- | ||||||
|
|
||||||
| # Commit Message Generator | ||||||
|
|
||||||
| Generate a commit message for changes in this chat. **Do not commit or push** (staging allowed with flag). | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## ⚙️ REPO-SPECIFIC CONFIGURATION | ||||||
|
|
||||||
| > **Edit this section when using in a new repository.** | ||||||
|
|
||||||
| ### Valid Scopes | ||||||
|
|
||||||
| Scopes must match package/app names. No scope is also valid. Invalid scope = commitlint rejection. | ||||||
|
|
||||||
| - **Packages:** agent-toolkit, astro, backend, chrome-extension, clerk-js, dev-cli, elements, expo, expo-passkeys, express, fastify, localizations, nextjs, nuxt, react, react-router, remix, shared, tanstack-react-start, testing, themes, types, ui, upgrade, vue | ||||||
| - **Other:** docs, repo, release, e2e, \* | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Flags | ||||||
|
|
||||||
| - `noask` — skip questions, generate immediately | ||||||
| - `stage` — stage affected files after showing message | ||||||
| - `all` — include all git changes (default: only files discussed in chat) | ||||||
| - `staged` — include staged files in addition to chat context (default: only files discussed in chat) | ||||||
|
|
||||||
| **Examples:** `/cmd cmt`, `/cmd cmt noask`, `/cmd cmt stage all`, `/cmd cmt noask stage` | ||||||
|
|
||||||
| ## Valid Types | ||||||
|
|
||||||
| **Types (REQUIRED - ALWAYS FIRST):** feat | fix | build | chore | ci | perf | refactor | revert | style | test | ||||||
|
|
||||||
| ## FORMAT - READ THIS CAREFULLY | ||||||
|
|
||||||
| **CRITICAL: Type is MANDATORY and ALWAYS comes FIRST** | ||||||
|
|
||||||
| ``` | ||||||
| type(scope): description ← CORRECT: type first, scope optional | ||||||
| type: description ← CORRECT: type without scope | ||||||
| ``` | ||||||
|
|
||||||
| **WRONG FORMATS:** | ||||||
|
|
||||||
| ``` | ||||||
| docs: description ← WRONG: "docs" is a SCOPE, not a type! | ||||||
| scope: description ← WRONG: missing type! | ||||||
| ``` | ||||||
|
|
||||||
| **If working with docs:** | ||||||
|
|
||||||
| ``` | ||||||
| feat(docs): add new guide ← CORRECT | ||||||
| chore(docs): update readme ← CORRECT | ||||||
| docs: something ← WRONG | ||||||
| ``` | ||||||
|
Comment on lines
+42
to
+60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add language specifiers to all fenced code blocks. Markdown linting standards (MD040) require language specifiers on fenced code blocks for syntax highlighting and clarity. This improves readability for users viewing the file in markdown renderers. ✏️ Add language specifiers to code blocksLines 42, 49, 56, 83, 98, 114, 123, 138, 145, 152 need language specifiers. Since these are example commit messages/formats, use -\`\`\`
+\`\`\`text
type(scope): description ← CORRECT: type first, scope optional
type: description ← CORRECT: type without scope
-\`\`\`
+\`\`\`textApply the same pattern to all remaining code blocks (especially lines 49, 56, 83, 98, 114, 123, 138, 145, 152). Alternatively, if the blocks are meant to be copied literally (no specific language), use Also applies to: 83-150 🧰 Tools🪛 markdownlint-cli2 (0.18.1)42-42: Fenced code blocks should have a language specified (MD040, fenced-code-language) 49-49: Fenced code blocks should have a language specified (MD040, fenced-code-language) 56-56: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents |
||||||
|
|
||||||
| ## Process | ||||||
|
|
||||||
| 1. If "noask" present → skip to step 4 | ||||||
| 2. Review conversation for problem/decisions/rationale | ||||||
| 3. Determine scope: | ||||||
| - If "all" flag present → run `git diff` for all changes | ||||||
| - Otherwise → only consider files/changes mentioned in the chat conversation | ||||||
| 4. Classify impact: | ||||||
| - **High:** API/breaking changes, security, new features, architecture, bug fixes, deps | ||||||
| - **Low:** typos, formatting, refactors, docs, comments, linting | ||||||
| 5. If **high impact** AND conversation lacks clear "why" → ask: | ||||||
|
|
||||||
| > "Significant changes detected. Please explain: Why needed? What problem solved? Any trade-offs?" | ||||||
|
|
||||||
| Then **STOP and wait** for response. | ||||||
|
|
||||||
| 6. Generate commit message (TYPE FIRST, then optional scope in parentheses) | ||||||
| 7. If "stage" present → run `git add` on affected files (only chat-mentioned files unless "all" flag present) | ||||||
|
|
||||||
| ## Format Rules | ||||||
|
|
||||||
| ``` | ||||||
| type(scope): description | ||||||
| ``` | ||||||
|
|
||||||
| - **TYPE IS REQUIRED** - one of: feat, fix, build, chore, ci, perf, refactor, revert, style, test | ||||||
| - **SCOPE IS OPTIONAL** - if present, wrap in parentheses after type | ||||||
| - All lowercase, ≤72 chars | ||||||
| - Title = "what it does", body = "why" | ||||||
| - Be specific (use domain terms from conversation, not generic words) | ||||||
| - No filler: avoid "update", "changes", "code" when meaningless | ||||||
|
|
||||||
| ## Templates | ||||||
|
|
||||||
| **High impact (with context):** | ||||||
|
|
||||||
| ``` | ||||||
| type(scope): short description | ||||||
|
|
||||||
| Why: | ||||||
| [Problem/requirement that prompted this] | ||||||
|
|
||||||
| What changed: | ||||||
| [Key decisions, trade-offs, non-obvious choices] | ||||||
|
|
||||||
| Context (optional): | ||||||
|
|
||||||
| [Future work, related issues, caveats] | ||||||
| ``` | ||||||
|
|
||||||
| **Low impact or limited context:** | ||||||
|
|
||||||
| ``` | ||||||
| type(scope): short description | ||||||
|
|
||||||
| Why: | ||||||
| [1 sentence if not obvious from title] | ||||||
| ``` | ||||||
|
|
||||||
| ## Examples | ||||||
|
|
||||||
| ``` | ||||||
| feat(api): add rate limiting to auth endpoints | ||||||
|
|
||||||
| Why: | ||||||
| DDoS attacks on /api/sign-in caused production degradation. | ||||||
|
|
||||||
| What changed: | ||||||
| Redis over in-memory for multi-instance support. | ||||||
| Sliding window with exponential backoff for better UX. | ||||||
|
|
||||||
| Context: | ||||||
|
|
||||||
| May need IP allowlist for trusted services (CLERK-5678). | ||||||
| ``` | ||||||
|
|
||||||
| ``` | ||||||
| chore(docs): fix typo in authentication guide | ||||||
|
|
||||||
| Why: | ||||||
| Users reported confusion from misspelling. | ||||||
| ``` | ||||||
|
|
||||||
| ``` | ||||||
| ci: consolidate test job into checks to speed up pipeline | ||||||
|
|
||||||
| Why: | ||||||
| Reduce CI overhead by running tests in same job as lint/type checks. | ||||||
| ``` | ||||||
|
|
||||||
| ``` | ||||||
| feat(docs): document commitlint scope validation system | ||||||
|
|
||||||
| Why: | ||||||
| Added clear documentation to help contributors understand scope requirements. | ||||||
| ``` | ||||||
|
|
||||||
| ## Remember | ||||||
|
|
||||||
| - Important:Do not add unnecessary new lines or paragraphs to sentences. Let the editor wrap lines as needed. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix spacing in inline formatting. Line 161 has a missing space after the colon: ✏️ Proposed fix-- Important:Do not add unnecessary new lines or paragraphs to sentences. Let the editor wrap lines as needed.
+- Important: Do not add unnecessary new lines or paragraphs to sentences. Let the editor wrap lines as needed.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| - **TYPE FIRST, ALWAYS** - never start with a scope | ||||||
| - **NEVER COMMIT OR PUSH** | ||||||
| - Type is REQUIRED, scope is optional | ||||||
| - **Always explain WHY changes were made** - what problem was being solved, what issues were identified, what motivated the change | ||||||
| - **Provide enough context** - someone reading the commit in 2 years should understand the reasoning without access to the conversation | ||||||
| - Only ask questions for high-impact changes | ||||||
| - Prioritize conversation context over diff analysis | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should ask the agent to derive this from a source of truth instead of also having this list to maintain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that it takes a few more seconds each time to go through the commitlint config and all package.json files
This acts as a "cache" - if we add a new package, commitlint will most likely fail so we/the llm will update the list accordingly - maybe this is something we can add to the prompt as an explicit instruction?