|
| 1 | +# Claude Code Configuration |
| 2 | + |
| 3 | +This document contains instructions for Claude Code to ensure all commits follow Angular commit conventions. |
| 4 | + |
| 5 | +## Commit Message Format |
| 6 | + |
| 7 | +**IMPORTANT**: All commit messages MUST follow the Angular conventional commit format: |
| 8 | + |
| 9 | +``` |
| 10 | +type(scope): description |
| 11 | +
|
| 12 | +[optional body] |
| 13 | +
|
| 14 | +[optional footer(s)] |
| 15 | +``` |
| 16 | + |
| 17 | +### Required Format Rules |
| 18 | + |
| 19 | +1. **Type**: Use lowercase, required |
| 20 | +2. **Scope**: Use lowercase, optional but recommended |
| 21 | +3. **Description**: |
| 22 | + - Start with lowercase letter |
| 23 | + - No period at the end |
| 24 | + - Present tense, imperative mood |
| 25 | + - Maximum 72 characters for the entire first line |
| 26 | + |
| 27 | +### Commit Types |
| 28 | + |
| 29 | +Use these commit types (in order of preference): |
| 30 | + |
| 31 | +- `feat`: A new feature |
| 32 | +- `fix`: A bug fix |
| 33 | +- `docs`: Documentation only changes |
| 34 | +- `style`: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) |
| 35 | +- `refactor`: A code change that neither fixes a bug nor adds a feature |
| 36 | +- `test`: Adding missing tests or correcting existing tests |
| 37 | +- `chore`: Changes to the build process or auxiliary tools and libraries |
| 38 | +- `perf`: A code change that improves performance |
| 39 | +- `ci`: Changes to CI configuration files and scripts |
| 40 | +- `build`: Changes that affect the build system or external dependencies |
| 41 | +- `revert`: Reverts a previous commit |
| 42 | + |
| 43 | +### Scope Guidelines |
| 44 | + |
| 45 | +Common scopes for this project: |
| 46 | +- `cli`: Command-line interface changes |
| 47 | +- `core`: Core knowhub functionality |
| 48 | +- `config`: Configuration-related changes |
| 49 | +- `plugins`: Plugin system changes |
| 50 | +- `sync`: Synchronization functionality |
| 51 | +- `templates`: Template-related changes |
| 52 | +- `docs`: Documentation changes |
| 53 | +- `tests`: Test-related changes |
| 54 | +- `deps`: Dependency updates |
| 55 | + |
| 56 | +### Description Guidelines |
| 57 | + |
| 58 | +- Use imperative mood: "add feature" not "added feature" |
| 59 | +- Keep it concise but descriptive |
| 60 | +- Explain WHAT changed, not HOW |
| 61 | +- Start with lowercase letter |
| 62 | +- No period at the end |
| 63 | + |
| 64 | +## Examples |
| 65 | + |
| 66 | +### Good Commit Messages |
| 67 | + |
| 68 | +``` |
| 69 | +feat(cli): add sync command for knowledge files |
| 70 | +fix(config): resolve parsing error for nested configurations |
| 71 | +docs(readme): update installation instructions |
| 72 | +refactor(plugins): simplify plugin registry initialization |
| 73 | +test(sync): add integration tests for GitHub plugin |
| 74 | +chore(deps): update biome to v1.9.4 |
| 75 | +style(cli): fix formatting in help command |
| 76 | +perf(sync): optimize file processing for large repositories |
| 77 | +``` |
| 78 | + |
| 79 | +### Bad Commit Messages (DO NOT USE) |
| 80 | + |
| 81 | +``` |
| 82 | +❌ Update files |
| 83 | +❌ Fix bug |
| 84 | +❌ Added new feature |
| 85 | +❌ WIP: working on sync |
| 86 | +❌ Fixed the thing that was broken |
| 87 | +❌ docs: Update README.md. |
| 88 | +❌ FEAT: Add new command |
| 89 | +``` |
| 90 | + |
| 91 | +## Additional Guidelines |
| 92 | + |
| 93 | +1. **No WIP commits**: Always complete the work before committing |
| 94 | +2. **Single responsibility**: One commit should represent one logical change |
| 95 | +3. **Test before commit**: Ensure tests pass before committing |
| 96 | +4. **Lint compliance**: Code must pass linting before committing |
| 97 | +5. **Release commits**: The project uses semantic-release, so proper commit types are crucial for versioning |
| 98 | + |
| 99 | +## Build and Test Commands |
| 100 | + |
| 101 | +Before committing, ensure: |
| 102 | +- `bun run check` passes (Biome linting) |
| 103 | +- `bun test` passes (all tests) |
| 104 | +- `bun run build` succeeds (TypeScript compilation) |
| 105 | + |
| 106 | +## Special Cases |
| 107 | + |
| 108 | +- Release-related commits starting with `chore(release):` are automatically ignored by commitlint |
| 109 | +- Breaking changes should include `BREAKING CHANGE:` in the footer |
| 110 | +- Reference issues using `Closes #123` or `Fixes #123` in the footer |
| 111 | + |
| 112 | +## Enforcement |
| 113 | + |
| 114 | +This project uses: |
| 115 | +- **commitlint** with `@commitlint/config-conventional` to enforce these rules |
| 116 | +- **husky** for git hooks |
| 117 | +- **lint-staged** for pre-commit checks |
| 118 | + |
| 119 | +All commits must pass these checks to be accepted. |
0 commit comments