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
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ jobs:
uses: dtolnay/rust-toolchain@1.97.0
with:
targets: aarch64-apple-darwin
- name: Test
run: cargo test -- --test-threads=8
- name: Build
run: cargo build --release --target aarch64-apple-darwin
- uses: actions/upload-artifact@v4
Expand All @@ -76,6 +78,8 @@ jobs:
uses: dtolnay/rust-toolchain@1.97.0
with:
targets: x86_64-apple-darwin
- name: Test
run: cargo test -- --test-threads=8
- name: Build
run: cargo build --release --target x86_64-apple-darwin
- uses: actions/upload-artifact@v4
Expand All @@ -91,6 +95,8 @@ jobs:
uses: dtolnay/rust-toolchain@1.97.0
with:
targets: x86_64-pc-windows-msvc
- name: Test
run: cargo test -- --test-threads=8
- name: Build
run: cargo build --release --target x86_64-pc-windows-msvc
- uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ PLAN_NEXT.md
PLAN_COMPLETED.md
plan/

# Wikifier runtime cache (state files like file_health.md ARE versioned)
# Wikifier runtime cache. Generated maps of the old Python package are not versioned.
.wikifier_staging/
.coordinationhub/
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ Shards are one snapshot each under `.chisel/shards/<shard>/`, configured by `CHI

Scores are heuristics. Read `_meta.uniform_components` before trusting a composite risk score. `flakiness_trend` is present when a covering test has dated results in the current week and in an older week of the last 28 days. It does not change risk weights. `record_result` stores `recorded_at`.

Test filenames that produce edges include `test_*.py`, `*_test.py`, `*.test.ts`, `*.spec.ts`, `*_test.go`, and `*_test.rs`.
Test filenames that produce edges include `test_*.py`, `*_test.py`, `*.test.ts`, `*.spec.ts`, `*_test.go`, `*_test.rs`, and any `.rs` file under the top-level `tests/` directory. Rust functions marked `#[test]`, `#[tokio::test]`, `#[rstest]`, or `#[test_case]` are test units even when the file is not named like a test.

`CHISEL_EXTRACTOR` or `extractor` in `.chisel/extensions.toml` names an executable. That program may use its own libraries. Chisel does not link them. The toml file is ignored unless the process was started with `--allow-repo-extractor` or `CHISEL_ALLOW_REPO_EXTRACTOR=1`. A tool argument cannot turn it on. The path must stay inside the project. `CHISEL_EXTRACTOR` overrides the file. A bad run falls back to the built-in scanner. A git ref that starts with `-` is rejected.
48 changes: 43 additions & 5 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
# Architecture

Chisel is a zero-dependency Rust program. `AGENTS.md` is the agent contract.
Chisel is a zero-dependency Rust program. `AGENTS.md` is the agent contract. `plan.md` records the layout and the rules that stay in force.

`src/engine` analyzes the worktree, answers queries, and records advisory locks. `src/extract` scans source files. `src/store.rs` reads and writes one snapshot, `.chisel/store`, with a temp file, fsync, and rename. It does not open `chisel.db` and it rejects `:memory:` and `file:` paths.
The crate exposes two binaries. `chisel` is `src/main.rs`. `chisel-mcp` is `src/bin/chisel-mcp.rs`. Both call `cli::entry`. When the program name is `chisel-mcp`, the entry inserts `serve-mcp` and speaks stdio MCP. `chisel serve` is HTTP only: `GET /health`, `GET /tools`, and `POST /call` on `127.0.0.1:8377`. There is no `/mcp` path.

Git is a subprocess. HTTP is `GET /health`, `GET /tools`, and `POST /call` on `127.0.0.1:8377`. There is no `/mcp` path. MCP is stdio Content-Length JSON-RPC from `chisel serve-mcp` or the `chisel-mcp` name of the same binary.
## Flow

Status values: `no_data`, `no_changes`, `no_edges`, `git_error`, `stale_db`, `error`, `unsupported`, `auto_queued`.
1. `analyze` lists code files through git (or a walk when ignored files are included), extracts units, and writes one snapshot.
2. Test files come from `looks_like_test` in `src/engine/mod.rs`. That is the only filename classifier. Rust files under the top-level `tests/` directory are test files. Functions with a `#[test]`-family attribute are test units even inside a source file.
3. Edges are calls and imports from those test units to code units. `suggest-tests`, `diff-impact`, `test-gaps`, and `risk-map` read the snapshot.
4. `update` recomputes changed files. A no-op update sets `edge_rebuild_skipped` and does not run `git blame` or per-function `git log -L`.
5. `risk-map` and `test-gaps` skip paths that `looks_like_test` accepts. A source file that also holds `#[test]` functions stays in those answers. The test functions themselves are not listed as untested code.

Do not pip-install this project. Do not store analysis in SQLite.
## Modules

| Module | Responsibility |
|---|---|
| `src/cli.rs` | Flags, subcommands, `chisel run`, `chisel watch`. |
| `src/engine/analyze.rs` | Full and incremental scans, test units, edges. |
| `src/engine/query.rs` | Read tools: impact, suggestions, risk, gaps, triage. |
| `src/engine/locks.rs` | Advisory lock rows in the snapshot. |
| `src/extract` | Python syntax units, brace-language units, import and call deps. |
| `src/syntax.rs` | Built-in Python and JavaScript syntax tree used by the scanners. |
| `src/store.rs` | One snapshot file. Write to a temp file, fsync, rename. |
| `src/git.rs` | Porcelain via `std::process`. A ref that starts with `-` is rejected. |
| `src/impact.rs` | Churn, coupling, coverage gap, risk score. |
| `src/json.rs` | Parser, serializer, Python-compatible rounding for scores. |
| `src/hash.rs` | SHA-256 for file content. |
| `src/http.rs` | The small JSON HTTP server. |
| `src/mcp.rs` | Content-Length framing and the tool bridge. |
| `src/fswatch.rs` | OS change notification. `collect_files` is only compiled for the kqueue path. |
| `src/lock.rs` | Cross-process shared and exclusive locks. |
| `src/schemas.rs` | Tool list. Missing required arguments are `status: "error"`. |
| `src/next_steps.rs` | Hint rows attached to tool results. |

Shards are one snapshot each under `.chisel/shards/<shard>/`. Writes use the longest path prefix. Unscoped reads aggregate. Cross-shard test edges are written to the parent snapshot and overlaid for impact, suggestions, diff, risk coverage, and stale tests.

## Storage and git

`.chisel/store` is the snapshot. Chisel does not open `chisel.db`. `:memory:` and `file:` storage paths are rejected. `CHISEL_PROJECT_DIR` and `CHISEL_STORAGE_DIR` apply when the CLI flags are absent.

Git is a subprocess. Locks are advisory records. They do not lock source files.

## Status

`no_data`, `no_changes`, `no_edges`, `git_error`, `stale_db`, `error`, `unsupported`, `auto_queued`. `no_data` and `stale_db` exit 0. `error` and `git_error` exit 1.

Do not pip-install this project. Do not store analysis in SQLite. Do not add a crates.io dependency.
8 changes: 5 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Chisel

The product is the Rust crate in `src/`. Read `AGENTS.md` for how to call it.
The product is the Rust crate in `src/`. Read `AGENTS.md` for how to call it and `ARCHITECTURE.md` for the module map.

Build with `cargo build --release`. The binary is `chisel`. `chisel-mcp` is the same program. Storage is the snapshot `.chisel/store`. Chisel does not open `chisel.db`. `:memory:` and `file:` storage paths are rejected.
Build with `cargo build --release`. The `chisel` binary is `src/main.rs`. The `chisel-mcp` binary is `src/bin/chisel-mcp.rs`. Both call the same entry point. Storage is the snapshot `.chisel/store`. Chisel does not open `chisel.db`. `:memory:` and `file:` storage paths are rejected.

Do not pip-install Chisel. Do not use SQLite as the store.
Do not pip-install Chisel. Do not use SQLite as the store. `Cargo.toml` dependency tables stay empty. There is no `build.rs`.

`looks_like_test` in `src/engine/mod.rs` is the only test-file classifier. Rust files under `tests/` are tests. `#[test]` functions are test units.

Status values: `no_data`, `no_changes`, `no_edges`, `git_error`, `stale_db`, `error`, `unsupported`, `auto_queued`. `no_data` and `stale_db` exit 0. `error` and `git_error` exit 1.
100 changes: 99 additions & 1 deletion COMPLETE_PROJECT_DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,107 @@
# Chisel

The program you run is the Rust binary from `src/`. Read `AGENTS.md`.
Updated: 2026-11-03.

Purpose: inventory of this repository. The program you run is the Rust binary from `src/`. Read `AGENTS.md` for calls and `ARCHITECTURE.md` for how the pieces fit.

Storage is the snapshot `.chisel/store`. Chisel does not open `chisel.db`. `:memory:` and `file:` paths are rejected. Do not pip-install Chisel and do not use SQLite as the store.

Status values: `no_data`, `no_changes`, `no_edges`, `git_error`, `stale_db`, `error`, `unsupported`, `auto_queued`.

`no_data` and `stale_db` exit 0. `error` and `git_error` exit 1.

`library.md`, `file_health.md`, and `file_health.json` were removed. They were generated maps of the deleted Python package. Nothing in this tree regenerates them. `monitored_paths.txt` was removed because it held one machine's absolute path and the binary does not read it.

## Root

| Path | Purpose |
|---|---|
| `README.md` | How to build and call the binary. |
| `AGENTS.md` | Agent contract: status values, flags, scale limits. |
| `CLAUDE.md` | Short orientation for agents that load this file first. |
| `ARCHITECTURE.md` | Module map and the analyze-to-query flow. |
| `plan.md` | Current layout and the dependency rule. Not a Python port schedule. |
| `CONTRIBUTING.md` | Build and test commands. |
| `CHANGELOG.md` | Release notes. Older entries mention the Python package. |
| `LLM_Development.md` | Historical session log. |
| `Cargo.toml` | Package `chisel`. Empty dependency tables. Two binaries. |
| `Cargo.lock` | Lockfile for the empty dependency graph. |
| `rust-toolchain.toml` | Pinned Rust channel. |
| `LICENSE` | MIT. |
| `.gitignore` | Build output, `.chisel/`, and the old `plan/` directory. |
| `exclude_patterns.txt` | Paths a watcher should skip. Not read by the Rust binary. |
| `GROK_CONNECTORS.md` | How to point an MCP client at `chisel-mcp`. |
| `skills/SKILL.md` | Skill text for calling the binary. |
| `.grok/skills/chisel/SKILL.md` | Same skill, installed for this workspace. |

## `src/`

| Path | Purpose |
|---|---|
| `src/lib.rs` | Crate root. |
| `src/main.rs` | `chisel` binary. |
| `src/bin/chisel-mcp.rs` | `chisel-mcp` binary. |
| `src/cli.rs` | Argv and dispatch, including `--version`. |
| `src/engine/mod.rs` | Engine type and `looks_like_test`. |
| `src/engine/analyze.rs` | `analyze` and `update`. |
| `src/engine/query.rs` | Read tools. |
| `src/engine/locks.rs` | Advisory locks. |
| `src/extract/mod.rs` | Scanner entry. |
| `src/extract/python.rs` | Python units. |
| `src/extract/brace.rs` | Brace languages, including Rust `#[test]`. |
| `src/extract/deps.rs` | Imports and calls. |
| `src/syntax.rs` | Python and JavaScript syntax tree. |
| `src/store.rs` | Snapshot file. |
| `src/git.rs` | Git subprocess. |
| `src/impact.rs` | Risk math. |
| `src/json.rs` | JSON. |
| `src/hash.rs` | SHA-256. |
| `src/http.rs` | HTTP server. |
| `src/mcp.rs` | Stdio MCP. |
| `src/fswatch.rs` | OS directory watch. |
| `src/lock.rs` | Process locks. |
| `src/schemas.rs` | Tool schemas. |
| `src/schemas_data.json` | Schema payload compiled into `schemas.rs`. |
| `src/next_steps.rs` | Follow-up hints. |

## `tests/`

| Path | Purpose |
|---|---|
| `tests/scale.rs` | Behaviour checks against temp git repos and the binary. |
| `tests/oracle_parity.rs` | Binary output against frozen oracle JSON. |
| `tests/surface_contract.rs` | Tool list shape. |
| `tests/extract_parity.rs` | Language fixtures, including Rust `#[test]` unit types. |
| `tests/durability.rs` | Snapshot publish under a killed writer. |
| `tests/rust_layout.rs` | Cargo layout fixture and a dogfood run on this repo. |
| `tests/fixtures/oracle/` | Frozen JSON for the Python-era oracle. |
| `tests/fixtures/languages/` | Small samples per language. |
| `tests/fixtures/rust_crate/` | `src/lib.rs`, `src/a.rs`, `tests/a.rs`, and a `Cargo.toml`. |

## Other trees

| Path | Purpose |
|---|---|
| `.github/workflows/ci.yml` | Test on Linux, macOS, and Windows. Release builds for the publish targets. |
| `.github/workflows/publish.yml` | Tagged release builds. |
| `docs/AGENT_PLAYBOOK.md` | Short pointer at `AGENTS.md`. |
| `docs/CUSTOM_EXTRACTORS.md` | External extractor program. |
| `docs/EXTRACTOR_ECOSYSTEM.md` | Where an external extractor fits. |
| `docs/LLM_CONTRACT.md` | Pointer at the status contract. |
| `docs/ZERO_DEPS.md` | Empty dependency tables. |
| `docs/chisel-demo.png` | Screenshot used by the README. |
| `examples/github-actions/chisel.yml` | Example workflow that builds this binary with Cargo. |
| `findings/` | Closed review notes. |
| `journal/2026/` | Dated notes from June 2026. |
| `Logged_issues/` | One closed issue note. |
| `wiki-local/` | Local notes. They still mention `schemas.py` in places. The Rust schemas are `src/schemas.rs`. |

## Removed in this pass

| Path | Why |
|---|---|
| `library.md` | Wikifier map of `chisel/*.py`. Those modules are gone, and this repo cannot regenerate the file. |
| `file_health.md` | Same age, same deleted tree. |
| `file_health.json` | Machine-readable copy of that matrix. |
| `pending_updates.md` | Empty. |
| `monitored_paths.txt` | Held `/home/aron/Documents/coding_projects/Chisel`. The binary does not read it. |
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ edition = "2021"
description = "Test impact analysis and code intelligence for LLM agents"
license = "MIT"
publish = false
autobins = false

[[bin]]
name = "chisel"
path = "src/main.rs"

[[bin]]
name = "chisel-mcp"
path = "src/main.rs"
path = "src/bin/chisel-mcp.rs"

[dependencies]

Expand Down
11 changes: 11 additions & 0 deletions LLM_Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ Chronological record of development activity on the Chisel project.

---

## 2026-11-03 -- Cargo test discovery, docs, CI, version

- One test-file classifier. Rust files under `tests/` and `#[test]`-family functions are test units.
- Removed `library.md`, `file_health.md`, `file_health.json`, and `pending_updates.md`. They described the deleted Python package or were empty. `plan.md`, `ARCHITECTURE.md`, `CLAUDE.md`, and `COMPLETE_PROJECT_DOCUMENTATION.md` now describe the Rust tree.
- `chisel` and `chisel-mcp` no longer share `src/main.rs`. `collect_files` is compiled only for the kqueue path.
- CI runs `cargo test` on macOS and Windows as well as Linux.
- `--version` prints the package version. Removed `monitored_paths.txt` (it held one local absolute path).
- Cleared the clippy warnings reported by `cargo clippy --all-targets`.

---

## 2026-04-14 -- Review Thirteen fixes (kimi_review_2): risk_map crash, suggest_tests/diff_impact working_tree timeouts

### Summary
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ The same binary has been run on flask, requests, cJSON, quixbugs, and the Probat

- **Zero dependencies** — the Rust binary links only the standard library. No crates.io crates. System `git` is required at runtime.
- **Multi-language** — Python, JavaScript/TypeScript, Go, Rust, C#, Java, Kotlin, C/C++, Swift, PHP, Ruby, Dart
- **Framework-aware** — pytest, Jest, Go test, Rust #[test], Playwright, xUnit/NUnit/MSTest, JUnit (incl. parameterized), XCTest + Swift Testing, PHPUnit, RSpec, Minitest, gtest, Dart test
- **Framework-aware** — pytest, Jest, Go test, Rust `#[test]` (including `#[tokio::test]` and `#[rstest]`, in `tests/*.rs` and in source files), Playwright, xUnit/NUnit/MSTest, JUnit (incl. parameterized), XCTest + Swift Testing, PHPUnit, RSpec, Minitest, gtest, Dart test
- **Incremental** — `update` recomputes changed files and newer commits. A no-op update sets `edge_rebuild_skipped` and does not run `git blame` or per-function `git log -L`. Above 2000 code files, file-level churn still runs and per-function `git log -L` does not (`unit_churn_skipped`).
- **gitignore-aware** — ignored trees (vendored deps, build output, fixtures) are never scanned; untracked files still are (`CHISEL_INCLUDE_IGNORED=1` to override)
- **Branch-aware** — `diff_impact` auto-detects feature branch vs main. Feature-branch co-change comes from `merge-base..HEAD`. `main` and `master` keep that list empty.
Expand Down
Loading
Loading