|
| 1 | +--- |
| 2 | +description: Apply only when generating a suggested git commit message from the VS Code Source Control "Generate Commit Message" action. Do not use for staging files or running git commits. |
| 3 | +--- |
| 4 | + |
| 5 | +# Commit Message Generation |
| 6 | + |
| 7 | +Use this instruction only to generate a commit message suggestion from the current git changes shown in Source Control. It must not stage files, create a commit, or perform any git action that changes repository state. |
| 8 | + |
| 9 | +## Workflow |
| 10 | + |
| 11 | +- Base the message on the currently staged changes when staged changes exist. |
| 12 | +- If nothing is staged, base the message on the current unstaged working tree changes. |
| 13 | +- Summarise the actual change, not the user's intent or ticket title. |
| 14 | +- Only use a scope on `docs`, `chore`, `build`, and `ci` commits, and only when it meaningfully narrows the audience or area. Omit the scope on all other types. |
| 15 | +- Return only the proposed commit message. |
| 16 | + |
| 17 | +## Output Quality Examples |
| 18 | + |
| 19 | +The following shows the same diff handled correctly and incorrectly. |
| 20 | + |
| 21 | +**Bad** — raw diff tokens leaked into the message: |
| 22 | + |
| 23 | +``` |
| 24 | +refactor(U pouvoirs Ret coins): update config methods to use helper traits 文 আ obстоятельsspaq Tritur disposto மற்றும்... |
| 25 | +``` |
| 26 | + |
| 27 | +**Good** — high-level summary inferred from file paths and clear hunks only: |
| 28 | + |
| 29 | +``` |
| 30 | +refactor: extract repeated config resolution logic into helper methods |
| 31 | +``` |
| 32 | + |
| 33 | +If the diff is too noisy to summarise accurately, use a safe generic fallback: |
| 34 | + |
| 35 | +``` |
| 36 | +chore: update project files |
| 37 | +``` |
| 38 | + |
| 39 | +## Format |
| 40 | + |
| 41 | +``` |
| 42 | +<type>[optional scope]: <description> |
| 43 | +
|
| 44 | +[optional body] |
| 45 | +
|
| 46 | +[optional footer(s)] |
| 47 | +``` |
| 48 | + |
| 49 | +- **Present tense, imperative mood**: "add feature" not "added feature" |
| 50 | +- **Scope**: lowercase, in parentheses — only permitted on `docs`, `chore`, `build`, and `ci` types; omit on all others |
| 51 | +- **Description**: under 72 characters, concise, and in sentence case; preserve original casing for code/class references in backticks |
| 52 | + |
| 53 | +## Commit Types |
| 54 | + |
| 55 | +This repository extends the standard Conventional Commits types with additional project-specific types. |
| 56 | + |
| 57 | +| Type | When to use | |
| 58 | +| ----------- | ----------------------------------------------------------- | |
| 59 | +| `feat` | New feature | |
| 60 | +| `fix` | Bug fix | |
| 61 | +| `docs` | Documentation and docblocks only | |
| 62 | +| `style` | Formatting/whitespace, missing semi-colons, no logic change | |
| 63 | +| `refactor` | Code restructuring, no behaviour change | |
| 64 | +| `perf` | Performance improvement | |
| 65 | +| `test` | Add or update tests | |
| 66 | +| `build` | Build system or dependency changes | |
| 67 | +| `chore` | Maintenance, tooling, config, version bumps | |
| 68 | +| `ci` | CI/CD pipeline | |
| 69 | +| `revert` | Revert a previous commit | |
| 70 | +| `remove` | Remove code or files | |
| 71 | +| `security` | Security-related changes | |
| 72 | +| `deprecate` | Deprecation-related changes | |
| 73 | + |
| 74 | +## Custom Type Examples |
| 75 | + |
| 76 | +Prefer these extended types when they describe the change more accurately than `refactor`, `fix`, or `chore`. |
| 77 | + |
| 78 | +- Use `remove` only when code or files are actually deleted, not when they are merely moved or refactored. |
| 79 | +- Use `security` when security risk reduction is the primary intent and outcome, not for unrelated fixes. |
| 80 | +- Use `deprecate` only when introducing or documenting a deprecation path, not when fully removing the deprecated code. |
| 81 | + |
| 82 | +``` |
| 83 | +remove(drivers): delete legacy driver compatibility shim |
| 84 | +
|
| 85 | +security(nginx): harden fastcgi param handling for site isolation |
| 86 | +
|
| 87 | +deprecate(config): mark `php_port` as deprecated in favour of `php81_port` |
| 88 | +``` |
| 89 | + |
| 90 | +## Breaking Changes |
| 91 | + |
| 92 | +Use `!` after type/scope and add a `BREAKING CHANGE:` footer: |
| 93 | + |
| 94 | +``` |
| 95 | +feat!: rename PHP port config key |
| 96 | +
|
| 97 | +BREAKING CHANGE: `php_port` renamed to `php_port_override` |
| 98 | +``` |
| 99 | + |
| 100 | +## Body & Footers |
| 101 | + |
| 102 | +Add a body when the _why_ is not obvious from the subject line. |
| 103 | + |
| 104 | +Body guidance: |
| 105 | + |
| 106 | +- Explain why the change was needed when it is not already obvious. |
| 107 | +- Include relevant technical context only when it improves clarity. |
| 108 | +- Use sentence case and proper punctuation. |
| 109 | +- Use bullet points only when listing multiple distinct changes. |
| 110 | +- Always separate each bullet point with a blank line. |
| 111 | +- When referring to methods across multiple classes, prefix them with the class name, for example `ClassName::methodName`. |
| 112 | + |
| 113 | +Footer guidance: |
| 114 | + |
| 115 | +- Put issue references in the footer, for example `Closes #36` or `Refs #36`. |
| 116 | + |
| 117 | +**Bad** — wrong case, missing backticks, footer buried in body, no blank line before footer: |
| 118 | + |
| 119 | +``` |
| 120 | +fix - Fixed the field variable |
| 121 | +
|
| 122 | +fixed $field to $correctField in Config getValue method. also updated tests. closes #36 |
| 123 | +``` |
| 124 | + |
| 125 | +**Good**: |
| 126 | + |
| 127 | +``` |
| 128 | +fix: correct variable replacement |
| 129 | +
|
| 130 | +Variable was missed when replacement happened, causing errors. |
| 131 | +
|
| 132 | +- Fixed incorrect `$field` variable name to `$correctField` in `Config::getValue` method. |
| 133 | +
|
| 134 | +- Updated tests to cover this case. |
| 135 | +
|
| 136 | +Closes #36 |
| 137 | +``` |
| 138 | + |
| 139 | +## Best Practices |
| 140 | + |
| 141 | +- Review the current Source Control changes before generating the message. |
| 142 | +- Ensure the entire message is professional and clearly communicates the purpose of the commit. |
| 143 | +- Important: Use `docs` for JSDoc additions/changes, not `refactor`. |
| 144 | +- Use **British English** spelling for commit messages (e.g. "optimise" not "optimize", "colour", not "color") to maintain consistency with existing messages. |
| 145 | +- Always enclose code references in backticks (e.g. `php_port`). |
| 146 | +- Always separate each bullet point with a blank line. |
| 147 | + |
| 148 | +## Safety Rules |
| 149 | + |
| 150 | +- Never stage files, commit changes, amend commits, or push. |
| 151 | +- Never suggest including secrets, credentials, or private keys in a commit. |
0 commit comments