Skip to content

Commit 2cc9224

Browse files
committed
feat: prospector improved greatly in terms of feedback, nonblocking and performance characteristics. Tested on repo with 3 million commits, works fine.
1 parent 4b777f5 commit 2cc9224

6 files changed

Lines changed: 860 additions & 179 deletions

File tree

COMMIT_SYNTAX.md

Lines changed: 73 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,149 @@
11
# Commit Message Syntax for Version Bumping
22

3-
Prospector can automatically bump versions based on keywords in commit messages. This provides fine-grained control over versioning without requiring git tags for every release.
3+
Prospector can automatically bump versions based on simple keywords in commit messages. This provides fine-grained control over versioning without requiring git tags for every release.
44

55
## Supported Patterns
66

77
### Major Version Bumps
88

9-
Patterns that trigger a **major** version bump (e.g., `1.2.3``2.0.0`):
10-
11-
- `[major]` - Explicit major bump marker
12-
- `+semver: major` - Semantic version annotation
13-
- `BREAKING CHANGE` - Conventional commits breaking change
14-
- `BREAKING-CHANGE` - Alternative format
9+
Use `[major]` to trigger a **major** version bump (e.g., `1.2.3``2.0.0`):
1510

1611
**Examples:**
12+
1713
```bash
1814
git commit -m "[major] Complete API redesign"
19-
git commit -m "+semver: major - Removed legacy endpoints"
20-
git commit -m "refactor: BREAKING CHANGE: changed authentication flow"
15+
git commit -m "[major] Remove deprecated endpoints"
16+
git commit -m "Refactor authentication system [major]"
2117
```
2218

2319
### Minor Version Bumps
2420

25-
Patterns that trigger a **minor** version bump (e.g., `1.2.3``1.3.0`):
26-
27-
- `[minor]` - Explicit minor bump marker
28-
- `+semver: minor` - Semantic version annotation
29-
- `feat:` - Conventional commits feature
30-
- `feature:` - Alternative feature marker
21+
Use `[minor]` to trigger a **minor** version bump (e.g., `1.2.3``1.3.0`):
3122

3223
**Examples:**
24+
3325
```bash
3426
git commit -m "[minor] Add user dashboard"
35-
git commit -m "feat: implement dark mode"
36-
git commit -m "feature: add export to CSV functionality"
37-
git commit -m "+semver: minor - new reporting module"
27+
git commit -m "[minor] Implement dark mode"
28+
git commit -m "Add export to CSV functionality [minor]"
3829
```
3930

4031
### Patch Version Bumps
4132

42-
Patterns that trigger a **patch** version bump (e.g., `1.2.3``1.2.4`):
43-
44-
- `[patch]` - Explicit patch bump marker
45-
- `+semver: patch` - Semantic version annotation
46-
- `fix:` - Conventional commits fix
47-
- `bugfix:` - Alternative fix marker
33+
Use `[patch]` to trigger a **patch** version bump (e.g., `1.2.3``1.2.4`):
4834

4935
**Examples:**
36+
5037
```bash
5138
git commit -m "[patch] Update dependencies"
52-
git commit -m "fix: resolve login timeout issue"
53-
git commit -m "bugfix: correct date formatting"
54-
git commit -m "+semver: patch - minor UI tweaks"
39+
git commit -m "[patch] Fix login timeout issue"
40+
git commit -m "Correct date formatting [patch]"
41+
```
42+
43+
### Explicit Version Setting
44+
45+
Use `[version:x.y.z]` or `[v:x.y.z]` to set an **exact version**:
46+
47+
**Examples:**
48+
49+
```bash
50+
git commit -m "[version:1.5.0] Release version 1.5.0"
51+
git commit -m "[v:2.0.0] Major release"
52+
git commit -m "Prepare for release [version:1.2.3]"
5553
```
5654

55+
**Note:** When an explicit version is set, it takes precedence over any bump indicators. This is useful for:
56+
57+
- Aligning with external version requirements
58+
- Jumping to a specific version number
59+
- Resetting version after major refactoring
60+
5761
### No Explicit Bump
5862

5963
Commits without bump indicators fall back to the default behavior (commit count):
6064

6165
**Examples:**
66+
6267
```bash
63-
git commit -m "chore: update README"
64-
git commit -m "docs: improve API documentation"
65-
git commit -m "style: format code"
66-
git commit -m "test: add unit tests"
68+
git commit -m "Update README"
69+
git commit -m "Refactor internal code"
70+
git commit -m "Add comments"
6771
```
6872

6973
## Priority and Accumulation
7074

7175
### Priority Order
7276

73-
When a commit contains multiple patterns, **only the highest priority** bump is counted:
77+
Patterns are evaluated in this priority order:
7478

75-
1. **Major** (highest priority)
76-
2. **Minor**
77-
3. **Patch** (lowest priority)
79+
1. **Explicit version** (highest priority - `[version:x.y.z]`)
80+
2. **Major** (`[major]`)
81+
3. **Minor** (`[minor]`)
82+
4. **Patch** (`[patch]`)
83+
84+
**Examples:**
7885

79-
**Example:**
8086
```bash
81-
# This commit only counts as a major bump, not major + minor
82-
git commit -m "feat: BREAKING CHANGE: new authentication system"
87+
# Explicit version takes precedence over everything
88+
git commit -m "[major] [version:3.5.0] Release 3.5.0" # Results in 3.5.0
89+
90+
# Only the highest bump counts per commit
91+
git commit -m "[major] [minor] Big change" # Counts as major only
8392
```
8493

8594
### Accumulation
8695

8796
Multiple commits can accumulate bumps:
8897

8998
**Scenario:**
99+
90100
```bash
91101
git tag v1.0.0
92-
git commit -m "feat: add feature A" # Minor bump
93-
git commit -m "feat: add feature B" # Minor bump
94-
git commit -m "fix: bug in feature A" # Patch bump
102+
git commit -m "[minor] Add feature A"
103+
git commit -m "[minor] Add feature B"
104+
git commit -m "[patch] Fix bug in feature A"
95105
```
96106

97107
**Result:** Version `1.2.1`
108+
98109
- Started at `1.0.0`
99110
- 2 minor bumps → `1.2.0`
100111
- 1 patch bump → `1.2.1`
101112

113+
### Explicit Version Override
114+
115+
When an explicit version is set, it overrides all accumulated bumps:
116+
117+
**Scenario:**
118+
119+
```bash
120+
git tag v1.0.0
121+
git commit -m "[minor] Add feature" # Would bump to 1.1.0
122+
git commit -m "[version:2.5.0] Align with upstream" # Sets to 2.5.0
123+
```
124+
125+
**Result:** Version `2.5.0` (explicit version used)
126+
102127
### Version Reset Rules
103128

104129
When bumping major or minor versions, lower components reset to 0:
105130

106131
**Major bump:**
132+
107133
- `1.5.7` + major → `2.0.0` (minor and patch reset)
108134

109135
**Minor bump:**
136+
110137
- `1.5.7` + minor → `1.6.0` (patch resets)
111138

112139
**Patch bump:**
140+
113141
- `1.5.7` + patch → `1.5.8` (no reset)
114142

143+
**Explicit version:**
144+
145+
- `1.5.7` + `[version:3.2.1]``3.2.1` (exact version)
146+
115147
## Customizing Patterns
116148

117149
You can customize the patterns programmatically:

0 commit comments

Comments
 (0)