|
| 1 | +--- |
| 2 | +description: 'Use when writing or reviewing git commit messages, changelogs, or version bumps. Covers Conventional Commits rules, scopes, and types.' |
| 3 | +--- |
| 4 | + |
| 5 | +<!-- @format --> |
| 6 | + |
| 7 | +## Commit Message Format |
| 8 | + |
| 9 | +Commit message titles must follow [Conventional Commits](https://www.conventionalcommits.org/) rules, enforced by commitlint (`package.json` → `commitlint`). |
| 10 | + |
| 11 | +**Pattern:** `<type>(<scope>): <summary>` |
| 12 | + |
| 13 | +- **Scope is required** — commitlint enforces `scope-enum: always` |
| 14 | +- **Summary**: imperative mood, lowercase start, no period at the end (e.g. `add`, not `Added` or `ADDS`) |
| 15 | +- **No emoji** in the title — added automatically by devmoji based on type |
| 16 | + |
| 17 | +## Allowed Types |
| 18 | + |
| 19 | +From `@commitlint/config-conventional`: |
| 20 | + |
| 21 | +| Type | When to use | Semver impact | |
| 22 | +| ---------- | ------------------------------------------------------------ | ------------- | |
| 23 | +| `feat` | New feature or capability visible to users | minor bump | |
| 24 | +| `fix` | Bug fix that corrects incorrect behavior | patch bump | |
| 25 | +| `perf` | Performance improvement, no behavior change | patch bump | |
| 26 | +| `refactor` | Restructuring without adding features or fixing bugs | no bump | |
| 27 | +| `test` | Adding or updating tests only | no bump | |
| 28 | +| `docs` | Documentation only (README, comments, changelogs) | no bump | |
| 29 | +| `style` | Formatting, whitespace, missing semicolons — no logic change | no bump | |
| 30 | +| `chore` | Maintenance: tooling, config, dependency bumps | no bump | |
| 31 | +| `build` | Build system or script changes | no bump | |
| 32 | +| `ci` | CI configuration changes | no bump | |
| 33 | +| `revert` | Reverts a previous commit | patch bump | |
| 34 | + |
| 35 | +> Append `!` to type or add `BREAKING CHANGE:` in the footer for breaking changes → major bump. |
| 36 | +
|
| 37 | +## Scopes |
| 38 | + |
| 39 | +Scopes are automatically derived from npm workspace package names via `@commitlint/config-workspace-scopes`. Valid scopes are the unscoped part of each package `name` found in the workspace paths defined by `workspaces` in root `package.json` (e.g. `@tomgrv/gitutils` → `gitutils`). |
| 40 | + |
| 41 | +To see valid scopes at any time, run: |
| 42 | + |
| 43 | +```bash |
| 44 | +npm query .workspace | node -e "const d=require('fs').readFileSync(0,'utf8'); JSON.parse(d).forEach(p => console.log(p.name))" |
| 45 | +``` |
| 46 | + |
| 47 | +**Rules for choosing a scope:** |
| 48 | + |
| 49 | +- Use the unscoped package name of the affected workspace (strip the `@org/` prefix) |
| 50 | +- Use the narrowest scope that accurately describes the change |
| 51 | +- When a change spans multiple workspaces equally, pick the primary one |
| 52 | + |
| 53 | +**Examples:** |
| 54 | + |
| 55 | +``` |
| 56 | +feat(gitutils): add new git alias |
| 57 | +fix(githooks): prevent double-run on post-merge |
| 58 | +perf(common-utils): reduce script startup time |
| 59 | +refactor(gitversion): extract bump logic into shared function |
| 60 | +docs(gateway): document SSL setup |
| 61 | +chore(githooks): bump @commitlint/cli to latest |
| 62 | +feat!(pecl): remove legacy extension installer — breaking change |
| 63 | +``` |
0 commit comments