Skip to content

Commit c485cfd

Browse files
committed
feat(Cargo.toml): update version number to 0.1.1 for workspace package
1 parent 332213a commit c485cfd

12 files changed

Lines changed: 499 additions & 159 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace.package]
2-
version = "0.1.0"
2+
version = "0.1.1"
33
edition = "2024"
44
license = "Apache-2.0"
55
repository = "https://github.com/longcipher/ast-doc"
@@ -15,7 +15,8 @@ resolver = "3"
1515

1616
[workspace.dependencies]
1717
# local crates
18-
ast-doc-core = { path = "crates/ast-doc-core", version = "0.1.0" }
18+
ast-doc = { path = "bin/ast-doc", version = "0.1.1" }
19+
ast-doc-core = { path = "crates/ast-doc-core", version = "0.1.1" }
1920

2021
# external crates
2122
clap = "4.6.0"
@@ -40,6 +41,7 @@ tracing-subscriber = "0.3.23"
4041
tree-sitter = "0.26.7"
4142
tree-sitter-c = "0.24.1"
4243
tree-sitter-go = "0.25.0"
44+
tree-sitter-language-pack = { version = "1.4.0", default-features = false }
4345
tree-sitter-python = "0.25.0"
4446
tree-sitter-rust = "0.24.2"
4547
tree-sitter-typescript = "0.23.2"

README.md

Lines changed: 50 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
# ast-doc
22

33
[![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/longcipher/ast-doc)
4-
[![Context7](https://img.shields.io/badge/Website-context7.com-blue)](https://context7.com/longcipher/ast-doc)
54
[![crates.io](https://img.shields.io/crates/v/ast-doc.svg)](https://crates.io/crates/ast-doc)
65
[![docs.rs](https://docs.rs/ast-doc/badge.svg)](https://docs.rs/ast-doc)
76

8-
![ast-doc](https://socialify.git.ci/longcipher/ast-doc/image?font=Source+Code+Pro&language=1&name=1&owner=1&pattern=Circuit+Board&theme=Auto)
9-
107
AST-powered code documentation tool for generating optimized `llms.txt` files from codebases.
118

129
## Overview
1310

14-
`ast-doc` is a Rust CLI tool that combines broad file traversal with deep AST-based semantic parsing to create optimized documentation. It uses a four-stage pipeline:
11+
`ast-doc` is a Rust CLI that combines broad file traversal with deep AST-based semantic parsing to create optimized documentation. It uses a four-stage pipeline:
1512

1613
1. **Ingestion** — File discovery, git metadata capture, directory tree generation
1714
2. **Parser** — tree-sitter AST extraction with pre-computed strategy variants
@@ -20,11 +17,19 @@ AST-powered code documentation tool for generating optimized `llms.txt` files fr
2017

2118
## Supported Languages
2219

23-
- Rust (`.rs`)
24-
- Python (`.py`)
25-
- TypeScript/JavaScript (`.ts`, `.tsx`, `.js`, `.jsx`)
26-
- Go (`.go`)
27-
- C (`.c`, `.h`)
20+
### Core (deep analysis)
21+
22+
| Language | Extensions |
23+
|----------|------------|
24+
| Rust | `.rs` |
25+
| Python | `.py` |
26+
| TypeScript/JavaScript | `.ts`, `.tsx`, `.js`, `.jsx` |
27+
| Go | `.go` |
28+
| C | `.c`, `.h` |
29+
30+
### Extended
31+
32+
With the `lang-pack` feature, 50+ additional languages are supported via `tree-sitter-language-pack` (Java, Ruby, Kotlin, Swift, etc.).
2833

2934
## Installation
3035

@@ -36,36 +41,20 @@ Install this skill for use with AI coding agents:
3641
npx skills add longcipher/ast-doc
3742
```
3843

39-
### From Source
40-
41-
```bash
42-
cargo install --path bin/ast-doc
43-
```
44-
4544
### From crates.io
4645

4746
```bash
4847
cargo install ast-doc
4948
```
5049

51-
## Features
50+
### From source
5251

53-
- **Four-stage pipeline**: Ingestion → AST Parser → Token Scheduler → Renderer
54-
- **Output strategies**: Full, NoTests (strip tests), Summary (signatures only)
55-
- **Token budget management**: Configurable `--max-tokens` with automatic degradation
56-
- **Core file protection**: Mark files with `--core` patterns that never get degraded
57-
- **Git context**: Automatic branch, commit, and diff inclusion (disable with `--no-git`)
58-
- **Directory tree**: Visual project structure with language annotations (disable with `--no-tree`)
59-
- **Glob filtering**: Include/exclude patterns for fine-grained file selection
60-
- **Anti-bloat rules**: Compress blank lines, trim trailing whitespace
61-
- **BDD acceptance tests**: Gherkin scenarios with `cucumber-rs`
62-
- **TDD inner loop**: Unit tests with `cargo test`
63-
- **Property tests**: `proptest` in the standard test flow
52+
```bash
53+
cargo install --path bin/ast-doc
54+
```
6455

6556
## Usage
6657

67-
### Basic Usage
68-
6958
```bash
7059
# Generate llms.txt to stdout
7160
ast-doc .
@@ -75,137 +64,66 @@ ast-doc . --output llms.txt
7564

7665
# Set token budget (default: 128,000)
7766
ast-doc . --max-tokens 64000
78-
```
7967

80-
### Output Strategies
81-
82-
```bash
83-
# Full source code (default)
84-
ast-doc . --strategy full
85-
86-
# Strip test modules and functions
87-
ast-doc . --strategy no-tests
88-
89-
# Signatures only, no implementations
68+
# Use summary mode (signatures only)
9069
ast-doc . --strategy summary
91-
```
9270

93-
### Core Files Protection
71+
# Strip tests
72+
ast-doc . --strategy no-tests
9473

95-
```bash
96-
# Core files always use Full strategy, never degraded
74+
# Protect core files from degradation
9775
ast-doc . --core "src/main.rs" --core "src/lib.rs" --strategy summary
98-
```
99-
100-
### File Filtering
101-
102-
```bash
103-
# Include only Rust files
104-
ast-doc . --include "*.rs"
105-
106-
# Exclude test files
107-
ast-doc . --exclude "*test*"
10876

109-
# Combine include/exclude
77+
# Filter files
11078
ast-doc . --include "*.rs" --exclude "target/**"
111-
```
112-
113-
### Git and Tree Options
114-
115-
```bash
116-
# Skip git context
117-
ast-doc . --no-git
118-
119-
# Skip directory tree
120-
ast-doc . --no-tree
121-
122-
# Copy to clipboard (not yet implemented)
123-
ast-doc . --copy
124-
```
12579

126-
### Verbose Logging
127-
128-
```bash
129-
ast-doc . --verbose
80+
# Skip git context and directory tree
81+
ast-doc . --no-git --no-tree
13082
```
13183

132-
## Quick Start (Development)
84+
## Development
13385

13486
```bash
87+
# Install tools
13588
just setup
136-
just check
137-
just test
138-
just bdd
139-
just test-all
140-
141-
# Run the CLI
142-
cargo run -p ast-doc -- --help
143-
cargo run -p ast-doc -- .
144-
```
145-
146-
## Testing Matrix
14789

148-
- BDD via `features/*.feature` plus `just bdd` remains the acceptance contract.
149-
- Example-based crate-local unit tests remain the default inner loop for named business cases and edge cases.
150-
- `proptest` lives in the ordinary `cargo test` path when the rule is an invariant across many valid inputs.
151-
- Advanced modes are opt-in: use `cargo-fuzz` only for hostile-input or `unsafe`-heavy crates, and add Criterion only when the work has a real performance target.
90+
# Run full CI
91+
just ci
15292

153-
## BDD + TDD Workflow
154-
155-
1. Write a failing Gherkin scenario in `features/*.feature`.
156-
2. Write a failing crate-local unit or property test in the affected crate to drive the inner loop.
157-
3. Implement the smallest shared Rust API needed to satisfy the test.
158-
4. Run `just test` to exercise deterministic unit tests and any `proptest` properties together.
159-
5. Re-run `just bdd` to confirm the acceptance scenario passes.
160-
161-
Use example-based unit tests for named business cases and edge cases that should stay readable. Use `proptest` when the rule is an invariant, such as totals matching line-item arithmetic or checkout always emptying the cart.
162-
163-
## Project Convention
164-
165-
- Put executable crates under `bin/*`
166-
- Put reusable library crates under `crates/*`
167-
- Keep shared dependencies in root `[workspace.dependencies]`
168-
169-
## Common Commands
170-
171-
```bash
172-
just format
93+
# Individual steps
17394
just lint
17495
just test
17596
just bdd
176-
just test-all
17797
just build
17898
```
17999

180-
`just test` runs the usual `cargo test --all-features` flow, so colocated `proptest` coverage in crate test modules stays in the standard inner loop rather than a separate test layer.
100+
## Feature Flags
181101

182-
## Conditional Benchmark Guidance
102+
| Feature | Description | Default |
103+
|---------|-------------|---------|
104+
| `lang-rust` | Rust parser ||
105+
| `lang-pack` | 50+ languages via tree-sitter-language-pack ||
106+
| `lang-python` | Python parser ||
107+
| `lang-typescript` | TypeScript/JavaScript parser ||
108+
| `lang-go` | Go parser ||
109+
| `lang-c` | C parser ||
110+
| `all-languages` | Enable all language parsers ||
111+
| `hotpath` | Profiling instrumentation ||
183112

184-
Do not add Criterion or a benchmark scaffold to every new workspace by default. Most business logic and CRUD-style crate work should stay on the ordinary `just test` plus `just bdd` path unless the planned feature has an explicit latency SLA, throughput target, or known hot path worth measuring.
113+
## Testing
185114

186-
When performance-sensitive code appears, add Criterion only in the affected crate and benchmark the hot path that carries the requirement. That keeps the default template lean while still using the standard Rust benchmark tool when the work genuinely needs measurement.
115+
- **BDD**: Gherkin scenarios in `features/*.feature`, run with `just bdd`
116+
- **Unit tests**: Colocated `#[cfg(test)]` modules, run with `just test`
117+
- **Property tests**: `proptest` in standard `cargo test` flow
187118

188-
## Conditional Fuzzing Guidance
119+
## Project Structure
189120

190-
Do not add `cargo-fuzz` targets to every new workspace by default. The standard Rust template is enough for ordinary business logic, CRUD-style services, and shared domain crates that only handle trusted or well-formed inputs.
191-
192-
Reach for fuzzing when a specific crate starts handling hostile input or high-risk memory behavior, especially when it:
193-
194-
- parses free-form text or file formats,
195-
- implements protocol framing or message decoding,
196-
- decodes binary formats or other untrusted payloads,
197-
- or relies on substantial `unsafe` code.
198-
199-
When one of those conditions applies, enable fuzzing only in the affected crate and use the normal Cargo workflow rather than baking a `fuzz/` directory into every starter:
200-
201-
```bash
202-
cd crates/<crate-name>
203-
cargo fuzz init
204-
cargo fuzz run <target-name>
121+
```text
122+
bin/ CLI binary crates
123+
crates/ Reusable library crates
124+
features/ BDD Gherkin scenarios
205125
```
206126

207-
That keeps the default template lean while still pointing parser-like, protocol, binary-decoding, or `unsafe`-heavy crates to the standard `cargo-fuzz` layout when they actually need it.
208-
209127
## License
210128

211129
Apache-2.0

bin/ast-doc/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub fn build_config(args: &Args) -> ast_doc_core::AstDocConfig {
107107

108108
fn main() -> Result<()> {
109109
#[cfg(feature = "hotpath")]
110-
let _guard = hotpath::GuardBuilder::new("main").build();
110+
let _guard = hotpath::HotpathGuardBuilder::new("main").build();
111111

112112
let args = Args::parse();
113113

crates/ast-doc-core/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ all-languages = [
1818
"lang-typescript",
1919
"lang-go",
2020
"lang-c",
21+
"lang-pack",
2122
]
22-
default = ["lang-rust"]
23+
default = ["lang-rust", "lang-pack"]
2324
hotpath = ["dep:hotpath"]
2425
lang-c = ["tree-sitter-c"]
2526
lang-go = ["tree-sitter-go"]
27+
lang-pack = ["tree-sitter-language-pack"]
2628
lang-python = ["tree-sitter-python"]
2729
lang-rust = ["tree-sitter-rust"]
2830
lang-typescript = ["tree-sitter-typescript"]
@@ -42,6 +44,7 @@ tracing = { workspace = true }
4244
tree-sitter = { workspace = true }
4345
tree-sitter-c = { workspace = true, optional = true }
4446
tree-sitter-go = { workspace = true, optional = true }
47+
tree-sitter-language-pack = { workspace = true, optional = true }
4548
tree-sitter-python = { workspace = true, optional = true }
4649
tree-sitter-rust = { workspace = true, optional = true }
4750
tree-sitter-typescript = { workspace = true, optional = true }
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Seeds for failure cases proptest has generated in the past. It is
2+
# automatically read and these particular cases re-run before any
3+
# novel cases are generated.
4+
#
5+
# It is recommended to check this file in to source control so that
6+
# everyone who runs the test benefits from these saved cases.
7+
cc d0fbd11ee1ec6c1952200f7bd57a632e17bb8de5cd741240aeace2c99899eb80 # shrinks to source = ""

crates/ast-doc-core/src/ingestion/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,18 @@ pub fn run_ingestion(config: &AstDocConfig) -> Result<IngestionResult, AstDocErr
7676
let abs_path = root.join(rel_path);
7777
match std::fs::read_to_string(&abs_path) {
7878
Ok(content) => {
79-
let language = crate::parser::detect_language(rel_path);
79+
let lang = crate::parser::detect_language(rel_path);
8080
let token_count = count_tokens(&content);
8181
debug!(
8282
path = %rel_path.display(),
83-
language = ?language,
83+
language = ?lang,
8484
tokens = token_count,
8585
"discovered file"
8686
);
8787
files.push(DiscoveredFile {
8888
path: rel_path.clone(),
8989
content,
90-
language,
90+
language: lang,
9191
raw_token_count: token_count,
9292
});
9393
}

crates/ast-doc-core/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub fn run_pipeline(config: &AstDocConfig) -> eyre::Result<PipelineResult> {
7676
let parsed: Vec<ParsedFile> = ingestion
7777
.files
7878
.par_iter()
79-
.filter_map(|f| f.language.map(|lang| (f, lang)))
79+
.filter_map(|f| f.language.as_ref().map(|lang| (f, lang)))
8080
.map(|(f, lang)| parser::parse_file(f, lang).map_err(eyre::Report::from))
8181
.collect::<eyre::Result<Vec<_>>>()?;
8282

@@ -134,6 +134,6 @@ fn count_tokens(text: &str) -> usize {
134134
#[cfg(all(test, feature = "hotpath"))]
135135
#[ctor::ctor]
136136
fn init_hotpath_for_tests() {
137-
let _guard = hotpath::GuardBuilder::new("test").build();
137+
let _guard = hotpath::HotpathGuardBuilder::new("test").build();
138138
std::mem::forget(_guard);
139139
}

0 commit comments

Comments
 (0)