Skip to content

Commit 392fac9

Browse files
committed
release: v0.8.0
Tree-Sitter AST Integration: - --signatures: Extract function/class signatures (8 languages) - --structure: Structural summaries (function/class counts) - --truncate smart: AST-boundary truncation Bug fixes, dep updates (tree-sitter 0.24), Coveralls CI coverage.
1 parent 4d25143 commit 392fac9

6 files changed

Lines changed: 110 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,28 @@ jobs:
6969
- name: Run security audit
7070
run: cargo audit
7171

72+
coverage:
73+
name: Code Coverage
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Checkout code
78+
uses: actions/checkout@v5
79+
80+
- name: Install Rust toolchain
81+
uses: dtolnay/rust-toolchain@stable
82+
83+
- name: Install cargo-tarpaulin
84+
run: cargo install cargo-tarpaulin
85+
86+
- name: Generate coverage
87+
run: cargo tarpaulin --all-features --out lcov --output-dir ./coverage -- --test-threads=1
88+
89+
- name: Upload to Coveralls
90+
uses: coverallsapp/github-action@v2
91+
with:
92+
file: ./coverage/lcov.info
93+
7294
msrv:
7395
name: Minimum Supported Rust Version
7496
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## v0.8.0
6+
7+
- **Tree-Sitter AST Integration** (feature-gated)
8+
- New `--signatures` flag: Replaces full file content with extracted function/class signatures — dramatically reduces token usage (~4K vs ~15K tokens per file)
9+
- New `--structure` flag: Appends a structural summary to each file (e.g., "6 functions, 2 structs, 1 impl block")
10+
- New `--truncate smart` mode: Prefers AST-boundary truncation when content needs truncating
11+
- Supports 8 languages: Rust, JavaScript, TypeScript, Python, Go, Java, C, C++
12+
- Install with: `cargo install context-builder --features tree-sitter-all`
13+
- Individual language features available (e.g., `--features tree-sitter-rust`)
14+
15+
- **Dependency Updates**
16+
- Updated `tree-sitter` core: 0.22 → 0.24
17+
- Updated all grammar crates: 0.21 → 0.23
18+
- Migrated from deprecated `language()` functions to `LANGUAGE` constants API
19+
20+
- **Bug Fixes**
21+
- Fixed config hash mismatch — cache now includes `auto_diff` and `diff_context_lines` fields, preventing stale cache hits when toggling these options
22+
- Fixed silent config parse failure — `context-builder.toml` with invalid TOML syntax now prints a warning instead of silently falling back to defaults
23+
- Fixed smart truncation unconditionally cutting 50% of file content — now only activates with explicit token budget
24+
- Fixed Windows path separators in determinism test causing CI failure
25+
26+
- **CI & Quality**
27+
- Added Coveralls code coverage integration via `cargo-tarpaulin`
28+
- All 188+ tests passing across Ubuntu, macOS, and Windows
29+
530
## v0.7.1
631

732
- **Bug Fixes** (identified by Gemini Deep Think multi-round code review)

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "context-builder"
3-
version = "0.7.1"
3+
version = "0.8.0"
44
default-run = "context-builder"
55
edition = "2024"
66
authors = ["Igor Lins e Silva"]

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ It's a command-line utility that recursively processes directories and creates c
7070
- ✂️ **Diff-Only Mode:**
7171
Output only the change summary and modified file diffs—no full file bodies—to minimize token usage.
7272

73+
- 🌲 **Tree-Sitter AST Analysis** *(optional)*:
74+
Extract function/class signatures (`--signatures`), structural summaries (`--structure`), and smart AST-boundary truncation (`--truncate smart`). Supports Rust, JavaScript, TypeScript, Python, Go, Java, C, and C++.
75+
7376
- 🧪 **Accurate Token Counting:**
7477
Get real tokenizer–based estimates with `--token-count` to plan your prompt budgets.
7578

@@ -84,6 +87,11 @@ It's a command-line utility that recursively processes directories and creates c
8487
cargo install context-builder
8588
```
8689

90+
With tree-sitter AST support (signatures, structure analysis):
91+
```bash
92+
cargo install context-builder --features tree-sitter-all
93+
```
94+
8795

8896
### If you don't have Rust installed
8997

@@ -273,6 +281,9 @@ If you also set `diff_only = true` (or pass `--diff-only`), the full “## Files
273281
- `-y, --yes` - Automatically answer yes to all prompts (skip confirmation dialogs).
274282
- `--diff-only` - With auto-diff + timestamped output, output only change summary + modified file diffs (omit full file bodies).
275283
- `--clear-cache` - Remove stored state used for auto-diff; next run becomes a fresh baseline.
284+
- `--signatures` - Replace full file content with extracted function/class signatures *(requires tree-sitter)*.
285+
- `--structure` - Append structural summary (function/class counts) to each file *(requires tree-sitter)*.
286+
- `--truncate <MODE>` - Truncation strategy: `none` (default) or `smart` (AST-boundary aware) *(requires tree-sitter)*.
276287
- `--init` - Initialize a new `context-builder.toml` config file.
277288
- `-h, --help` - Show help information.
278289
---

test.md

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Directory Structure Report
22

33
This document contains all files from the `context-builder` directory, optimized for LLM consumption.
4-
Content hash: c2def09bf3360b73
4+
Content hash: 2ef2e240de1486a4
55

66
## File Tree Structure
77

@@ -235,14 +235,39 @@ cargo fmt --all
235235

236236
### File: `CHANGELOG.md`
237237

238-
- Size: 9078 bytes
239-
- Modified: 2026-02-15 04:21:58 UTC
238+
- Size: 10624 bytes
239+
- Modified: 2026-02-15 08:32:55 UTC
240240

241241
```markdown
242242
# Changelog
243243

244244
All notable changes to this project will be documented in this file.
245245

246+
## v0.8.0
247+
248+
- **Tree-Sitter AST Integration** (feature-gated)
249+
- New `--signatures` flag: Replaces full file content with extracted function/class signatures — dramatically reduces token usage (~4K vs ~15K tokens per file)
250+
- New `--structure` flag: Appends a structural summary to each file (e.g., "6 functions, 2 structs, 1 impl block")
251+
- New `--truncate smart` mode: Prefers AST-boundary truncation when content needs truncating
252+
- Supports 8 languages: Rust, JavaScript, TypeScript, Python, Go, Java, C, C++
253+
- Install with: `cargo install context-builder --features tree-sitter-all`
254+
- Individual language features available (e.g., `--features tree-sitter-rust`)
255+
256+
- **Dependency Updates**
257+
- Updated `tree-sitter` core: 0.22 → 0.24
258+
- Updated all grammar crates: 0.21 → 0.23
259+
- Migrated from deprecated `language()` functions to `LANGUAGE` constants API
260+
261+
- **Bug Fixes**
262+
- Fixed config hash mismatch — cache now includes `auto_diff` and `diff_context_lines` fields, preventing stale cache hits when toggling these options
263+
- Fixed silent config parse failure — `context-builder.toml` with invalid TOML syntax now prints a warning instead of silently falling back to defaults
264+
- Fixed smart truncation unconditionally cutting 50% of file content — now only activates with explicit token budget
265+
- Fixed Windows path separators in determinism test causing CI failure
266+
267+
- **CI & Quality**
268+
- Added Coveralls code coverage integration via `cargo-tarpaulin`
269+
- All 188+ tests passing across Ubuntu, macOS, and Windows
270+
246271
## v0.7.1
247272

248273
- **Bug Fixes** (identified by Gemini Deep Think multi-round code review)
@@ -425,12 +450,12 @@ All notable changes to this project will be documented in this file.
425450
### File: `Cargo.toml`
426451

427452
- Size: 2832 bytes
428-
- Modified: 2026-02-15 08:08:40 UTC
453+
- Modified: 2026-02-15 08:32:44 UTC
429454

430455
```toml
431456
[package]
432457
name = "context-builder"
433-
version = "0.7.1"
458+
version = "0.8.0"
434459
default-run = "context-builder"
435460
edition = "2024"
436461
authors = ["Igor Lins e Silva"]
@@ -518,8 +543,8 @@ required-features = ["samples-bin"]
518543

519544
### File: `README.md`
520545

521-
- Size: 10641 bytes
522-
- Modified: 2026-02-15 04:23:13 UTC
546+
- Size: 11381 bytes
547+
- Modified: 2026-02-15 08:32:57 UTC
523548

524549
```markdown
525550
<div align="center">
@@ -594,6 +619,9 @@ It's a command-line utility that recursively processes directories and creates c
594619
- ✂️ **Diff-Only Mode:**
595620
Output only the change summary and modified file diffs—no full file bodies—to minimize token usage.
596621

622+
- 🌲 **Tree-Sitter AST Analysis** *(optional)*:
623+
Extract function/class signatures (`--signatures`), structural summaries (`--structure`), and smart AST-boundary truncation (`--truncate smart`). Supports Rust, JavaScript, TypeScript, Python, Go, Java, C, and C++.
624+
597625
- 🧪 **Accurate Token Counting:**
598626
Get real tokenizer–based estimates with `--token-count` to plan your prompt budgets.
599627

@@ -608,6 +636,11 @@ It's a command-line utility that recursively processes directories and creates c
608636
cargo install context-builder
609637
```
610638

639+
With tree-sitter AST support (signatures, structure analysis):
640+
```bash
641+
cargo install context-builder --features tree-sitter-all
642+
```
643+
611644

612645
### If you don't have Rust installed
613646

@@ -797,6 +830,9 @@ If you also set `diff_only = true` (or pass `--diff-only`), the full “## Files
797830
- `-y, --yes` - Automatically answer yes to all prompts (skip confirmation dialogs).
798831
- `--diff-only` - With auto-diff + timestamped output, output only change summary + modified file diffs (omit full file bodies).
799832
- `--clear-cache` - Remove stored state used for auto-diff; next run becomes a fresh baseline.
833+
- `--signatures` - Replace full file content with extracted function/class signatures *(requires tree-sitter)*.
834+
- `--structure` - Append structural summary (function/class counts) to each file *(requires tree-sitter)*.
835+
- `--truncate <MODE>` - Truncation strategy: `none` (default) or `smart` (AST-boundary aware) *(requires tree-sitter)*.
800836
- `--init` - Initialize a new `context-builder.toml` config file.
801837
- `-h, --help` - Show help information.
802838
---
@@ -15910,8 +15946,8 @@ filter = ["txt"]
1591015946

1591115947
### File: `tests/test_determinism.rs`
1591215948

15913-
- Size: 21261 bytes
15914-
- Modified: 2026-02-15 06:55:40 UTC
15949+
- Size: 21480 bytes
15950+
- Modified: 2026-02-15 08:22:30 UTC
1591515951

1591615952
```rust
1591715953
//! Integration tests for determinism and robustness of context-builder
@@ -16141,6 +16177,11 @@ fn test_deterministic_output_multiple_runs() {
1614116177
// Category 0: Cargo.toml (config), README.md (key project doc)
1614216178
// Category 1: src/* (source code) — entry points first (lib.rs, main.rs before utils.rs)
1614316179
// Category 2: tests/* (tests)
16180+
// Normalize path separators for cross-platform compatibility (Windows uses backslashes)
16181+
let file_lines: Vec<String> = file_lines
16182+
.iter()
16183+
.map(|line| line.replace('\\', "/"))
16184+
.collect();
1614416185
let expected_order = vec![
1614516186
"### File: `Cargo.toml`",
1614616187
"### File: `docs/README.md`",

0 commit comments

Comments
 (0)