Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Install mold linker
run: sudo apt-get update && sudo apt-get install -y mold
- name: Check workspace
run: cargo check --workspace --all-targets --all-features
- name: Check
run: cargo check --all-targets --all-features

test:
name: Test Suite
Expand All @@ -34,8 +34,7 @@ jobs:
- name: Install mold linker
run: sudo apt-get update && sudo apt-get install -y mold
- name: Run unit tests
run: cargo nextest run --workspace
# Note: No doctests - clemini is a binary crate without a library target
run: cargo nextest run

test-integration:
name: Integration Tests
Expand Down Expand Up @@ -86,7 +85,7 @@ jobs:
- name: Install mold linker
run: sudo apt-get update && sudo apt-get install -y mold
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
run: cargo clippy --all-targets --all-features -- -D warnings

doc:
name: Documentation
Expand All @@ -98,7 +97,7 @@ jobs:
- name: Install mold linker
run: sudo apt-get update && sudo apt-get install -y mold
- name: Check documentation
run: cargo doc --workspace --no-deps --document-private-items
run: cargo doc --no-deps --document-private-items
env:
RUSTDOCFLAGS: -D warnings

Expand All @@ -111,8 +110,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Install mold linker
run: sudo apt-get update && sudo apt-get install -y mold
- name: Check workspace with MSRV
run: cargo check --workspace
- name: Check with MSRV
run: cargo check

coverage:
name: Code Coverage
Expand All @@ -127,7 +126,7 @@ jobs:
- name: Install mold linker
run: sudo apt-get update && sudo apt-get install -y mold
- name: Generate coverage
run: cargo llvm-cov --workspace --lcov --output-path lcov.info
run: cargo llvm-cov --lcov --output-path lcov.info
- uses: codecov/codecov-action@v4
with:
files: lcov.info
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Rust
/target/
Cargo.lock

# IDE
.idea/
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed
- Extracted clemitui into standalone repository ([evansenter/clemitui](https://github.com/evansenter/clemitui)), now referenced as a git dependency
- Committed Cargo.lock for reproducible builds
- Removed single-member workspace wrapper

## [0.4.0] - 2026-01-24

### Added
Expand Down
45 changes: 10 additions & 35 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,7 @@ Logs are stored in `~/.clemini/logs/` with daily rotation.

The CLI has three modes: single-prompt (`-p "prompt"`), interactive REPL, and MCP server (`--mcp-server`).

### Workspace Structure

This project is a Cargo workspace with two crates:

```
.
├── Cargo.toml # Workspace root
├── src/ # clemini crate (AI agent)
└── crates/
└── clemitui/ # TUI library crate (reusable by any ACP agent)
```

#### clemini (AI Agent)
### Source Structure

```
src/
Expand All @@ -69,27 +57,9 @@ src/
└── ... # Individual tool modules (edit, read, grep, etc.)
```

#### clemitui (TUI Library)

Standalone crate for terminal UI, usable by any ACP-compatible agent:

```
crates/clemitui/
├── Cargo.toml
├── src/
│ ├── lib.rs # Re-exports
│ ├── format.rs # Primitive formatting functions (tool output, warnings)
│ ├── logging.rs # OutputSink trait, log_event functions
│ └── text_buffer.rs # TextBuffer for streaming markdown
└── tests/
├── common/mod.rs # Shared test helpers (strip_ansi, RAII guards, CaptureSink)
├── acp_simulation_tests.rs # 29 tests simulating ACP agent patterns
└── e2e_tests.rs # 19 PTY-based tests for actual terminal output
```

**Design**: clemitui takes primitive types (strings, durations, token counts), not genai-rs types. This allows it to work with any ACP agent. clemini's format.rs re-exports these and adds genai-rs-specific wrappers.
### clemitui (External TUI Library)

Run clemitui tests: `cargo test -p clemitui`
Terminal UI is provided by [clemitui](https://github.com/evansenter/clemitui), a standalone crate referenced as a git dependency. It takes primitive types (strings, durations, token counts), not genai-rs types, so it can work with any ACP agent. clemini's `format.rs` and `logging.rs` re-export clemitui's API and add genai-rs-specific wrappers.

### Event-Driven Architecture

Expand Down Expand Up @@ -158,6 +128,9 @@ Debugging: `LOUD_WIRE=1` logs all HTTP requests/responses.
- `GEMINI_API_KEY` - Required
- Model: `gemini-3-flash-preview`
- Config: `~/.clemini/config.toml` (optional)
- `model` - Gemini model to use (default: `gemini-3-flash-preview`)
- `bash_timeout` - Timeout in seconds for bash commands (default: 120)
- `allowed_paths` - Additional paths tools can access beyond cwd (default: none)

## Documentation

Expand All @@ -169,9 +142,10 @@ Debugging: `LOUD_WIRE=1` logs all HTTP requests/responses.

## Conventions

- Rust 2024 edition (let chains, etc.)
- Rust 2024 edition (let chains, etc.), MSRV 1.88 (enforced in CI)
- Tools return JSON: success data or `{"error": "..."}`
- Tool errors return as JSON (not propagated) so Gemini can see them and retry
- CI uses `cargo-nextest` for test execution (`make test-all` uses it locally too)

## Development Process

Expand All @@ -189,6 +163,7 @@ Debugging: `LOUD_WIRE=1` logs all HTTP requests/responses.
- `make clippy` (no warnings)
- `make fmt` (run formatter, then commit any changes it makes)
- `make test` (tests pass)
- Documentation must compile without warnings (CI runs `cargo doc --no-deps --document-private-items` with `-D warnings`)

Don't skip tests. If a test is flaky or legitimately broken by your change, fix the test as part of the PR.

Expand Down Expand Up @@ -216,7 +191,7 @@ Run locally with: `cargo test --test <name> -- --include-ignored --nocapture`
These use `validate_response_semantically()` from `tests/common/mod.rs` - a second Gemini call with structured output that judges whether responses are appropriate. This provides a middle ground between brittle string assertions and purely structural checks.

**Shared test helpers** - Common patterns for test utilities:
- Put shared helpers in `tests/common/mod.rs` (for clemini) or `crates/clemitui/tests/common/mod.rs` (for clemitui)
- Put shared helpers in `tests/common/mod.rs`
- Use `#![allow(dead_code)]` in shared test modules since not all test files use all helpers
- RAII guards for cleanup: `DisableColors` (reset color override on drop), `LoggingGuard` (disable logging on drop)
- Pattern: `let _guard = DisableColors::new();` at test start ensures cleanup even on panic
Expand Down
Loading