An open API service indexing awesome lists of open source software.

https://github.com/thesurlydev/techdocs

A Rust-based tool for generating technical documentation from codebases, with support for AI-powered README generation.
https://github.com/thesurlydev/techdocs

ai readme rust

Last synced: about 1 year ago
JSON representation

A Rust-based tool for generating technical documentation from codebases, with support for AI-powered README generation.

Awesome Lists containing this project

README

          

# TechDocs

A Rust-based tool for generating technical documentation from codebases, with support for AI-powered README generation. Available as both a CLI tool and an HTTP API.

## Key Features

- Recursive directory traversal with `.gitignore` support
- Smart file filtering and size limits
- Robust UTF-8 handling with lossy conversion for binary files
- AI-powered README generation using Claude API
- Customizable exclude patterns
- Language-aware code formatting
- Support for GitHub URLs as input (automatically clones repositories)
- HTTP API for integration with other tools

## Installation

```bash
# Clone the repository
git clone https://github.com/thesurlydev/techdocs.git

# Build the project
cargo build --release

# Add CLI to path (optional)
cp target/release/techdocs-cli /usr/local/bin/
```

Requires:
- Rust toolchain
- `ANTHROPIC_API_KEY` environment variable for Claude integration

## Usage

### CLI

```bash
# List files in a directory
techdocs-cli list path/to/project

# Generate formatted content for AI prompts
techdocs-cli prompt path/to/project --max-file-size-kb 100 --max-total-size-mb 10

# Generate README using Claude AI
techdocs-cli readme path/to/project

# Use with GitHub repositories
techdocs-cli readme https://github.com/username/repo

# Add exclude patterns
techdocs-cli -e "target/,node_modules/" readme path/to/project
```

### HTTP API

The HTTP API is documented using OpenAPI 3.0 specification in `openapi.yaml`. You can view the API documentation using tools like [Swagger UI](https://swagger.io/tools/swagger-ui/) or [Redoc](https://redoc.ly/).

```bash
# Start the API server
cargo run --bin techdocs-api

# Generate README for a local directory
curl -X POST http://localhost:3000/generate \
-H "Content-Type: application/json" \
-d '{
"path_or_url": "/path/to/project",
"exclude_patterns": ["target", "node_modules"]
}'

# Generate README for a GitHub repository
curl -X POST http://localhost:3000/generate \
-H "Content-Type: application/json" \
-d '{
"path_or_url": "https://github.com/username/repo"
}'
```

When using GitHub URLs, the tool will automatically:
1. Clone the repository to a temporary directory
2. Process the files as requested
3. Clean up the temporary directory when done

## Project Structure

```
src/
├── lib.rs # Core library functionality
├── claude.rs # Claude API integration
└── bin/
├── cli.rs # Command-line interface
└── api.rs # HTTP API server
```

## Development

```bash
# Run tests
cargo test

# Check code formatting
cargo fmt --check

# Run linter
cargo clippy

# Build documentation
cargo doc --no-deps --open
```