Skip to content

Commit eb03acc

Browse files
committed
docs: update CLAUDE.md and PRD.md for v0.4.0 feature completion
Mark FR-030, FR-032, FR-036, FR-057, FR-058, TR-006, TR-007 as implemented. Move FR-057/FR-058 from Phase 3 to Phase 2. Update test count to 280, add new config options and file structure entries. PRD bumped to v3.3.
1 parent b1eaada commit eb03acc

2 files changed

Lines changed: 50 additions & 35 deletions

File tree

CLAUDE.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ commitbee --verbose # Show symbol extraction details
4646
commitbee --show-prompt # Debug: show the LLM prompt
4747
commitbee --no-split # Disable commit split suggestions
4848
commitbee --no-scope # Disable scope in commit messages
49+
commitbee --locale de # Generate message in German (type/scope stay English)
4950
commitbee init # Create config file
5051
commitbee config # Show current configuration
5152
commitbee doctor # Check configuration and connectivity
@@ -71,6 +72,11 @@ num_predict = 256
7172
timeout_secs = 30
7273
think = false
7374
rename_threshold = 70
75+
learn_from_history = false
76+
history_sample_size = 50
77+
# locale = "de"
78+
# system_prompt_path = "/path/to/system.txt"
79+
# template_path = "/path/to/template.txt"
7480

7581
[format]
7682
include_body = true
@@ -91,7 +97,9 @@ lowercase_subject = true
9197

9298
## Supported Languages (tree-sitter)
9399

94-
Rust, TypeScript, JavaScript, Python, Go
100+
Built-in: Rust, TypeScript, JavaScript, Python, Go
101+
102+
Feature-gated (optional): Java (`lang-java`), C (`lang-c`), C++ (`lang-cpp`), Ruby (`lang-ruby`), C# (`lang-csharp`). Enable with `--features lang-java` or `--features all-languages`.
95103

96104
## File Structure
97105

@@ -112,11 +120,13 @@ src/
112120
└── services/
113121
├── mod.rs
114122
├── git.rs # GitService (gix + git CLI, concurrent content fetching)
115-
├── analyzer.rs # AnalyzerService (tree-sitter, parallel via rayon)
123+
├── analyzer.rs # AnalyzerService (tree-sitter queries, parallel via rayon)
116124
├── context.rs # ContextBuilder (token budget)
125+
├── history.rs # HistoryService (commit style learning)
117126
├── safety.rs # Secret scanning (25 patterns), conflict detection
118127
├── sanitizer.rs # CommitSanitizer (JSON + plain text, BREAKING CHANGE footer)
119128
├── splitter.rs # CommitSplitter (multi-commit detection)
129+
├── template.rs # TemplateService (custom prompt templates)
120130
├── progress.rs # Progress indicators (indicatif spinners, TTY-aware)
121131
└── llm/
122132
├── mod.rs # LlmProvider trait + enum dispatch + shared SYSTEM_PROMPT
@@ -174,7 +184,7 @@ src/
174184
### Running Tests
175185

176186
```bash
177-
cargo test # All tests (202 tests)
187+
cargo test # All tests (280 tests)
178188
cargo test --test sanitizer # CommitSanitizer tests
179189
cargo test --test safety # Safety module tests
180190
cargo test --test context # ContextBuilder tests
@@ -284,4 +294,4 @@ Common mistake: calling a new safeguard/check `fix` — if there was no bug, it'
284294

285295
### Documentation Sync
286296

287-
Keep README.md test count in sync (currently 202).
297+
Keep README.md test count in sync (currently 280).

PRD.md

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
66

77
# CommitBee — Product Requirements Document
88

9-
**Version**: 3.2
9+
**Version**: 3.3
1010
**Date**: 2026-03-13
1111
**Status**: Active
1212
**Author**: Sephyi + Claude
1313

14+
**Revision 3.3**: v0.4.0 full feature completion (2026-03-13) — FR-030 (Custom Prompt Templates): `TemplateService` with `system_prompt_path`/`template_path` config. FR-032 (Multi-Language Commit Messages): `--locale` flag with ISO 639-1 codes. FR-036 (Tree-sitter Query Patterns): `.scm` query files replacing manual AST walking. FR-057 (Additional Language Support): Java, C, C++, Ruby, C# with feature-gated crates and 15 tests. FR-058 (Commit History Style Learning): `HistoryService` with type/scope/case/compliance analysis. TR-006 (Evaluation Harness): fixture-based pipeline testing. TR-007 (Fuzzing): 3 `cargo-fuzz` targets. Moved FR-057/FR-058 from Phase 3 to Phase 2. 280 tests.
15+
1416
**Revision 3.2**: v0.4.0 feature implementation (2026-03-13) — FR-035 (Rename Detection): `--find-renames=N%` with configurable threshold, `ChangeStatus::Renamed`, NUL-delimited R-status parsing. FR-037 (Expanded Secret Scanning): 25 built-in patterns across 13 categories, pluggable `build_patterns()` engine with custom/disabled config. FR-038 (Progress Indicators): `indicatif` spinners with TTY detection, `Progress` struct with phase/info/warning/finish methods. 202 tests.
1517

1618
**Revision 3.1**: Deep codebase audit + streaming hardening (2026-03-13) — LLM provider hardening: `Provider::new()` returns `Result`, 1 MB response cap (`MAX_RESPONSE_BYTES`), EOF buffer parsing for all SSE providers, zero-allocation streaming (slice + drain), HTTP error body propagation. Security: full untruncated diff scanning for secrets, `sk-proj-` pattern support. Performance: HashSet symbol dedup, single-pass evidence detection, `String::with_capacity` pre-allocation. Error handling: hardened observability in analyzer and app orchestrator. 188 tests.
@@ -84,9 +86,9 @@ CommitBee is a Rust-native CLI tool that uses tree-sitter semantic analysis and
8486
| Git hook integration | Universal | **Implemented** |
8587
| Shell completions | Expected for CLI tools | **Implemented** |
8688
| Multiple message generation (pick from N) | Common (aicommits, aicommit2) | **Implemented** |
87-
| Unit/integration tests | Non-negotiable for quality | **188 tests** |
89+
| Unit/integration tests | Non-negotiable for quality | **280 tests** |
8890
| Commit splitting (multi-concern detection) | No competitor has this | **Implemented** |
89-
| Custom prompt/instruction files | Growing (Copilot, aicommit2) | Missing |
91+
| Custom prompt/instruction files | Growing (Copilot, aicommit2) | **Implemented** |
9092

9193
## 3. Architecture Requirements
9294

@@ -406,24 +408,27 @@ These are bugs, panics, and missing foundations that must be fixed before any ne
406408

407409
### 4.3 P2 — Next (v0.3.0: Differentiation)
408410

409-
#### FR-030: Custom Prompt Templates
411+
#### FR-030: Custom Prompt Templates ✅ (v0.4.0)
410412

411413
- **What**: User-provided system prompt and prompt template files.
414+
- **Status**: **Implemented** (v0.4.0)
412415
- **Acceptance**:
413-
- `prompt.system_path` and `prompt.template_path` in config
414-
- Project-level `.commitbee.toml` overrides user config (team standardization)
416+
- `system_prompt_path` and `template_path` in config
415417
- Template variables: `{{diff}}`, `{{symbols}}`, `{{files}}`, `{{type}}`, `{{scope}}`
416418
- Default templates remain if no custom template specified
419+
- **Implemented**: `TemplateService` in `src/services/template.rs` — loads custom system prompt and user prompt template files. Config fields `system_prompt_path` and `template_path`. All LLM providers pass through custom system prompt when configured. 7 template tests.
417420

418421
#### FR-031: Exclude Files
419422

420423
- **What**: Skip certain files from analysis.
421424
- **Acceptance**: `--exclude` CLI flag and `exclude_patterns` config option. Glob patterns (e.g., `*.lock`, `**/*.generated.*`). Excluded files still listed but not analyzed or included in diff context.
422425

423-
#### FR-032: Multi-Language Commit Messages
426+
#### FR-032: Multi-Language Commit Messages ✅ (v0.4.0)
424427

425428
- **What**: Generate commit messages in languages other than English.
429+
- **Status**: **Implemented** (v0.4.0)
426430
- **Acceptance**: `--locale <lang>` flag (e.g., `--locale de`, `--locale ja`). Prompt instructs LLM to write in target language. Type/scope remain in English (conventional commits spec).
431+
- **Implemented**: `--locale` CLI flag and `locale` config option. `LANGUAGE:` instruction injected into prompt context. ISO 639-1 codes supported.
427432

428433
#### FR-033: Copy to Clipboard
429434

@@ -454,10 +459,12 @@ These are bugs, panics, and missing foundations that must be fixed before any ne
454459
- **Acceptance**: Use `git diff --cached --find-renames`. Parse `R` status. Set `old_path` field. LLM prompt says "renamed X to Y" instead of "added Y, deleted X".
455460
- **Implemented**: `--find-renames=N%` with configurable `rename_threshold` (default 70%, 0 disables). NUL-delimited `R<NNN>` status parsing consumes two path fields. `ChangeStatus::Renamed` variant (Copy-safe, old_path on `FileChange`). Context builder formats as `old → new (N% similar)`. Split suggestions show `[R]` marker. 202 tests.
456461

457-
#### FR-036: Tree-sitter Query Patterns
462+
#### FR-036: Tree-sitter Query Patterns ✅ (v0.4.0)
458463

459464
- **What**: Replace manual AST walking with tree-sitter query S-expressions.
465+
- **Status**: **Implemented** (v0.4.0)
460466
- **Acceptance**: Each language has a `.scm` query file defining symbol extraction. More maintainable, more precise, easier to add new languages.
467+
- **Implemented**: `src/queries/*.scm` files for each language with `@name` and `@definition` captures. `LanguageConfig` struct with `query_source` field. `tree_sitter::Query` + `QueryCursor` + `StreamingIterator` pattern matching replaces manual `TreeCursor` walking.
461468

462469
#### FR-037: Expanded Secret Scanning ✅ (v0.4.0)
463470

@@ -546,25 +553,20 @@ These are bugs, panics, and missing foundations that must be fixed before any ne
546553
- **What**: Run commitbee in CI to validate or rewrite commit messages.
547554
- **Rationale**: opencommit's GitHub Action is a key differentiator for team adoption.
548555

549-
#### FR-057: Additional Language Support
550-
551-
- **What**: Expand tree-sitter beyond Rust/TS/JS/Python/Go to Java, C/C++, Ruby, C#, Swift, Kotlin.
552-
- **Acceptance**: Feature-gated language support to control binary size:
556+
#### FR-057: Additional Language Support ✅ (v0.4.0)
553557

554-
```toml
555-
[features]
556-
default = ["lang-rust", "lang-typescript", "lang-javascript", "lang-python", "lang-go"]
557-
lang-java = ["tree-sitter-java"]
558-
lang-cpp = ["tree-sitter-cpp"]
559-
all-languages = ["lang-java", "lang-cpp", "lang-ruby", "lang-csharp", ...]
560-
```
558+
- **What**: Expand tree-sitter beyond Rust/TS/JS/Python/Go to Java, C/C++, Ruby, C#.
559+
- **Status**: **Implemented** (v0.4.0)
560+
- **Acceptance**: Feature-gated language support to control binary size.
561+
- **Implemented**: 5 new language crates (`tree-sitter-java`, `tree-sitter-c`, `tree-sitter-cpp`, `tree-sitter-ruby`, `tree-sitter-c-sharp`) as optional dependencies. Feature flags: `lang-java`, `lang-c`, `lang-cpp`, `lang-ruby`, `lang-csharp`, `all-languages`. Each language has `.scm` query files. 15 feature-gated tests in `tests/languages.rs`. Visibility detection for Java/C# public modifiers.
561562

562-
#### FR-058: Commit History Style Learning (Experimental)
563+
#### FR-058: Commit History Style Learning (Experimental) ✅ (v0.4.0)
563564

564565
- **What**: Analyze existing commit history in the repository to learn the project's commit style, then align generated messages accordingly. This includes scope naming conventions, type usage patterns, subject phrasing style, and body conventions.
565-
- **Status**: Planned (experimental — may diverge from strict Conventional Commits compliance)
566+
- **Status**: **Implemented** (v0.4.0, experimental)
566567
- **Rationale**: GitHub Copilot does this implicitly. Making it explicit and configurable would be a differentiator. However, blindly mimicking a repository's history could produce non-compliant messages if the history is inconsistent.
567568
- **Acceptance**: Feature-gated behind `--experimental-history` or a config flag. Samples last N commits, extracts patterns, injects as additional context in the LLM prompt. Does not override conventional commits structure — only influences scope naming and subject phrasing style.
569+
- **Implemented**: `HistoryService` in `src/services/history.rs``analyze()` fetches last N commit subjects via `git log`, `analyze_subjects()` extracts type distribution, scope patterns, case style, conventional compliance ratio, and sample subjects. `HistoryContext::to_prompt_section()` formats as `PROJECT STYLE` block. Config: `learn_from_history` (bool, default false), `history_sample_size` (default 50). Deterministic sort order for equal-count entries.
568570

569571
## 5. Security Requirements
570572

@@ -817,17 +819,20 @@ proptest! {
817819
- Matrix: stable Rust + MSRV (1.94)
818820
- **Edition 2024**: Rust edition 2024 requires MSRV 1.94; let chains (Rust 1.94) raise the effective MSRV to 1.94. CI matrix explicitly tests both stable and 1.94 to verify compatibility.
819821

820-
### TR-006: Evaluation Harness (`commitbee eval`)
822+
### TR-006: Evaluation Harness (`commitbee eval`) ✅ (v0.4.0)
821823

822824
A developer-facing command (`commitbee eval`) that runs the full pipeline against a set of fixture diffs and compares generated commit messages against expected style snapshots. Not shipped in release builds (feature-gated behind `dev` or `eval` feature flag).
823825

824826
- **Fixtures**: Stored in `tests/fixtures/eval/`, each containing a staged diff, optional config overrides, and an expected output snapshot.
825827
- **Output**: Pass/fail report per fixture, with diff of expected vs. actual message.
826828
- **Purpose**: Regression testing for prompt engineering changes — ensures prompt template updates don't degrade quality across the fixture set.
829+
- **Status**: **Implemented** (v0.4.0)
830+
831+
### TR-007: Fuzzing ✅ (v0.4.0)
827832

828-
### TR-007: Fuzzing (Future Enhancement)
833+
`cargo fuzz` targets for the diff parser, sanitizer, and secret scanner. Fuzz targets in `fuzz/` directory following standard `cargo-fuzz` conventions.
829834

830-
`cargo fuzz` targets for the diff parser, sanitizer, and secret scanner. Priority: P2 — implement after the unit test suite (TR-001) and property tests (TR-004) are stable. Fuzz targets should be added to `fuzz/` directory following standard `cargo-fuzz` conventions.
835+
- **Status**: **Implemented** (v0.4.0) — 3 fuzz targets: `fuzz_sanitizer`, `fuzz_safety`, `fuzz_diff_parser`. `fuzz/Cargo.toml` with `libfuzzer-sys` dependency.
831836

832837
## 9. Distribution Requirements
833838

@@ -957,16 +962,18 @@ opt-level = "z" # or "s" — benchmark both
957962
- FR-040: Conventional Commits 1.0.0 spec anchoring ✅ (already implemented, enhanced with cross-project support)
958963
- FR-041: Post-generation validation ✅ (already implemented)
959964
- FR-034: Improved commit type heuristics ✅ (fully implemented — evidence flags, API replacement, mechanical detection, metadata breaking, symbol tri-state)
960-
- FR-030: Custom prompt templates
965+
- FR-030: Custom prompt templates
961966
- FR-031: Exclude files
962-
- FR-032: Multi-language commit messages
967+
- FR-032: Multi-language commit messages
963968
- FR-033: Copy to clipboard
964969
- FR-035: Rename detection ✅
965-
- FR-036: Tree-sitter query patterns
970+
- FR-036: Tree-sitter query patterns
966971
- FR-037: Expanded secret scanning ✅
967972
- FR-038: Progress indicators ✅
968-
- TR-006: Evaluation harness
969-
- TR-007: Fuzzing targets
973+
- FR-057: Additional language support ✅ (moved from Phase 3)
974+
- FR-058: Commit history style learning ✅ (moved from Phase 3)
975+
- TR-006: Evaluation harness ✅
976+
- TR-007: Fuzzing targets ✅
970977

971978
### Phase 3: Market Leadership (v0.4.0+)
972979

@@ -979,8 +986,6 @@ opt-level = "z" # or "s" — benchmark both
979986
- FR-054: Monorepo support
980987
- FR-055: Version bumping
981988
- FR-056: GitHub Action
982-
- FR-057: Additional language support (feature-gated)
983-
- FR-058: Commit history style learning (experimental)
984989

985990
## 12. Success Metrics
986991

0 commit comments

Comments
 (0)