Skip to content

Commit 822a438

Browse files
📝 docs: 更新提交命令文档以包含 monorepo 格式
1 parent 6f05d39 commit 822a438

1 file changed

Lines changed: 85 additions & 29 deletions

File tree

.claude/commands/commit.md

Lines changed: 85 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ This command helps you create well-formatted commits with conventional commit me
66

77
To create a commit, just type:
88

9-
```
9+
```text
1010
/commit
1111
```
1212

1313
Or with options:
1414

15-
```
15+
```text
1616
/commit --no-verify
1717
```
1818

@@ -29,6 +29,46 @@ Or with options:
2929
6. If multiple distinct changes are detected, suggests breaking the commit into multiple smaller commits
3030
7. For each commit (or the single commit if not split), creates a commit message using emoji conventional commit format
3131

32+
## Monorepo Commit Format
33+
34+
This is a monorepo project containing multiple datapacks. All commit messages **must** include the changed project's name tag in the format `[PROJECT_ABBR]` where the abbreviation is derived from the first letter of each word in the project name (uppercase).
35+
36+
- **With project tag**: `[DFL] ✨ feat: add new library function`
37+
- **Without project tag** (for repository-wide changes): `♻️ refactor: update build system`
38+
39+
### Project Abbreviation Rules
40+
41+
1. **Abbreviation derivation**: Take the first letter of each word in the project name, convert to uppercase
42+
- Example: "datapack function library" → "DFL"
43+
- Example: "stone disappearance" → "SD"
44+
- Example: "auto lucky block" → "ALB"
45+
46+
2. **When to use project tags**:
47+
- Changes specific to a single datapack project
48+
- Modifications within a project's directory
49+
- Updates to project-specific configuration
50+
51+
3. **When to omit project tags**:
52+
- Repository-wide changes (e.g., root `.github/`, `rule/`, `template/`)
53+
- Build system updates affecting all projects
54+
- Documentation changes covering multiple projects
55+
- CI/CD configuration changes
56+
57+
### Commit Message Format
58+
59+
The complete commit message format for this monorepo is:
60+
61+
```text
62+
[PROJECT_ABBR] <emoji> <type>: <description>
63+
```
64+
65+
Where:
66+
67+
- `[PROJECT_ABBR]` - Optional project abbreviation tag (omit for repository-wide changes)
68+
- `<emoji>` - Appropriate emoji for the commit type (see below)
69+
- `<type>` - Conventional commit type (feat, fix, docs, etc.)
70+
- `<description>` - Concise description in imperative mood
71+
3272
## Best Practices for Commits
3373

3474
- **Verify before committing**: Ensure code is linted, builds correctly, and documentation is updated
@@ -124,33 +164,49 @@ When analyzing the diff, consider splitting commits based on these criteria:
124164

125165
Good commit messages:
126166

127-
- ✨ feat: add user authentication system
128-
- 🐛 fix: resolve memory leak in rendering process
129-
- 📝 docs: update API documentation with new endpoints
130-
- ♻️ refactor: simplify error handling logic in parser
131-
- 🚨 fix: resolve linter warnings in component files
132-
- 🧑‍💻 chore: improve developer tooling setup process
133-
- 👔 feat: implement business logic for transaction validation
134-
- 🩹 fix: address minor styling inconsistency in header
135-
- 🚑️ fix: patch critical security vulnerability in auth flow
136-
- 🎨 style: reorganize component structure for better readability
137-
- 🔥 fix: remove deprecated legacy code
138-
- 🦺 feat: add input validation for user registration form
139-
- 💚 fix: resolve failing CI pipeline tests
140-
- 📈 feat: implement analytics tracking for user engagement
141-
- 🔒️ fix: strengthen authentication password requirements
142-
- ♿️ feat: improve form accessibility for screen readers
143-
144-
Example of splitting commits:
145-
146-
- First commit: ✨ feat: add new solc version type definitions
147-
- Second commit: 📝 docs: update documentation for new solc versions
148-
- Third commit: 🔧 chore: update package.json dependencies
149-
- Fourth commit: 🏷️ feat: add type definitions for new API endpoints
150-
- Fifth commit: 🧵 feat: improve concurrency handling in worker threads
151-
- Sixth commit: 🚨 fix: resolve linting issues in new code
152-
- Seventh commit: ✅ test: add unit tests for new solc version features
153-
- Eighth commit: 🔒️ fix: update dependencies with security vulnerabilities
167+
### Project-specific changes (with project abbreviation)
168+
169+
- [DFL] ✨ feat: add new library function for item manipulation
170+
- [SD] 🐛 fix: resolve stone disappearance timing issue
171+
- [ALB] 📝 docs: update auto lucky block configuration guide
172+
- [DFL] ♻️ refactor: simplify function error handling logic
173+
- [SD] 🚨 fix: resolve linter warnings in tick function
174+
- [ALB] 🧑‍💻 chore: improve developer tooling setup process
175+
- [DFL] 👔 feat: implement business logic for item validation
176+
- [SD] 🩹 fix: address minor timing inconsistency in animation
177+
178+
### Repository-wide changes (without project abbreviation)
179+
180+
- ♻️ refactor: update build system configuration for all datapacks
181+
- 📝 docs: update repository README with new project structure
182+
- 🔧 chore: add new CI workflow for automated testing
183+
- 🚨 fix: resolve linter configuration issues affecting all projects
184+
- 🧑‍💻 chore: improve developer documentation for monorepo setup
185+
- ✅ test: add integration tests for cross-datapack function calls
186+
187+
### Example of splitting commits for a datapack project
188+
189+
Suppose you're making changes to the "datapack function library" project. Instead of one large commit, you could split it into:
190+
191+
- First commit: [DFL] ✨ feat: add new function for item manipulation
192+
- Second commit: [DFL] 📝 docs: update function documentation with usage examples
193+
- Third commit: [DFL] 🔧 chore: update dependency configuration
194+
- Fourth commit: [DFL] 🏷️ feat: add type annotations for function parameters
195+
- Fifth commit: [DFL] 🧵 feat: improve performance with concurrent processing
196+
- Sixth commit: [DFL] 🚨 fix: resolve linter warnings in new code
197+
- Seventh commit: [DFL] ✅ test: add unit tests for new functions
198+
- Eighth commit: [DFL] 🔒️ fix: update dependencies with security patches
199+
200+
### Example of splitting repository-wide changes
201+
202+
For repository-wide changes affecting multiple projects:
203+
204+
- First commit: ♻️ refactor: update build system for all datapacks
205+
- Second commit: 📝 docs: update repository documentation with new guidelines
206+
- Third commit: 🔧 chore: add shared CI workflow configuration
207+
- Fourth commit: ✅ test: add integration tests for cross-project compatibility
208+
- Fifth commit: 🚨 fix: resolve shared configuration issues
209+
- Sixth commit: 🧑‍💻 chore: improve developer setup documentation
154210

155211
## Command Options
156212

0 commit comments

Comments
 (0)