Skip to content
Open
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
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Large-diff work is a separate evaluation track, not part of the default live-rep
- **LLM-as-judge** — evaluator that scores analysis quality across 5 criteria
- **Eval suite** — 5 synthetic fixture codebases, deterministic scoring, 0.89 avg score
- **Config** — `.diffcore.toml` with entrypoint globs, layer names, ignore patterns, LLM settings, refinement settings
- **Logging** — `tracing` + `tracing-subscriber` behind `diffcore-core`'s `logging` feature; `RUST_LOG` sets the filter (default `info`), `DIFFCORE_LOG_FORMAT=json` switches to line-delimited JSON, `DIFFCORE_LOG_FILE` redirects to a file (the desktop app falls back to `~/.diffcore/desktop.log` when stderr is not a terminal, since GUI bundles discard it). Backend activity logs on the `activity` target, IR cache on `ir_cache`. `log`-crate call sites bridge in automatically.

## Tests

Expand Down
177 changes: 102 additions & 75 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ serde = { version = "1", features = ["derive"] }
# stable for arbitrary f64 scores (see assert_json_roundtrip).
serde_json = { version = "1", features = ["float_roundtrip"] }
log = "0.4"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
git2 = { version = "0.20", default-features = false }

# Optimize test builds: trades slightly longer compile for faster test runtime.
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,24 @@ When using direct API providers (`anthropic`, `openai`, `gemini`), Diffcore chec

When using `codex` or `claude`, Diffcore uses the local CLI login instead of an API key and lets that agent inspect the repository with structured output constraints.

### Logging

`diffcore` and `diffcore-web` log to stderr at `info` by default, so piping
stdout to `jq` still works; the desktop app logs to a file (see below).

Backend activity (`codex`, `claude`) logs on the `activity` target with `source`
and `event_type` fields — the same events the desktop UI shows; the IR cache logs
on `ir_cache`.

```bash
RUST_LOG=info,activity=warn diffcore analyze --base main # mute per-event chatter
DIFFCORE_LOG_FORMAT=json diffcore analyze --base main 2> analyze.log.jsonl
```

Launched from a terminal the desktop app logs there like the others; launched
from Finder or a `.desktop` entry — where stderr is discarded — it falls back to
`~/.diffcore/desktop.log`. `DIFFCORE_LOG_FILE` overrides the path for any binary.

## Architecture

```
Expand Down
3 changes: 1 addition & 2 deletions crates/diffcore-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ name = "diffcore"
path = "src/main.rs"

[dependencies]
diffcore-core = { path = "../diffcore-core" }
diffcore-core = { path = "../diffcore-core", features = ["logging"] }
clap = { version = "4", features = ["derive"] }
serde_json = { workspace = true }
git2 = { workspace = true }
tokio = { version = "1", features = ["full"] }
tempfile = "3"
log = { workspace = true }
env_logger = "0.11"

[features]
embeddings = ["diffcore-core/embeddings"]
4 changes: 2 additions & 2 deletions crates/diffcore-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ struct EmbedDiffArgs {
}

fn main() {
env_logger::init();
diffcore_core::logging::init(None);
let cli = Cli::parse();

match cli.command {
Expand Down Expand Up @@ -697,7 +697,7 @@ async fn run_refinement(
);

for w in &warnings {
eprintln!("refinement repair: {}", w.message);
warn!(target: "refinement", "repair: {}", w.message);
}

analysis_output.groups = refined_groups;
Expand Down
6 changes: 5 additions & 1 deletion crates/diffcore-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ bincode = "1"
dashmap = "6"
once_cell = "1"
log = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true, optional = true }
tempfile = "3"
tree-sitter-c-sharp = "0.23.1"
tree-sitter-php = "0.24.2"
Expand All @@ -48,12 +50,14 @@ test-support = []
## Enables local code embeddings via fastembed (ONNX Runtime + Jina Code model).
## Used for semantic similarity between file diffs in clustering.
embeddings = ["dep:fastembed"]
## Subscriber stack for the binaries; library consumers skip it.
logging = ["dep:tracing-subscriber"]

# Enable test-support feature automatically when running tests
# (dev-dependencies trigger `cfg(test)` in unit tests but not integration tests,
# so we also enable the feature here for integration test access to `with_base_url`).
[dev-dependencies]
diffcore-core = { path = ".", features = ["test-support"] }
diffcore-core = { path = ".", features = ["test-support", "logging"] }
proptest = "1"
tokio = { version = "1", features = ["full", "test-util"] }
wiremock = "0.6"
Expand Down
Loading