feat: add ctx hotspots — churn × complexity ranking#4
Merged
Conversation
Combines git commit churn (via gitutil::churn_since) with indexed complexity metrics into score = normalized_churn * normalized_complexity, min-max normalized over the analyzed set. Supports --since, --limit, --min-churn, --against REF, --by file|symbol, and the global --json flag. Informational command: exits 0 on success, 2 on operational errors (not a git repo, missing index, bad ref). --by symbol approximates a symbol's churn by its file's commit count (documented v1 limitation), and --no-renames means renames reset churn counts. Also extends the GitRepo test helper with commit_all_with_date for testing --since windows, and adds end-to-end CLI tests that index real git fixtures.
# Conflicts: # CHANGELOG.md # docs/json-output.md # src/main.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR 3 of 7 in the Quality Intelligence Suite. Stacked on #2 (
feat/quality-foundation) — will be retargeted tomainonce #2 merges; review only the top 2 commits until then.ctx hotspotscommand ranking indexed files (or symbols with--by symbol) by churn × complexity: churn fromgit log --sincehistory, complexity from the index (fan_out*2 + fan_in, same formula as the DuckDB analytics, computed in plain SQLite so it works on Windows builds too).score = minmax(churn) × minmax(complexity); deterministic ordering with documented tie-breaks.--since(default "6 months ago"),--limit,--min-churn,--against <REF>for diff-scoped use, global--json(entries include the top-3 most complex symbols per file as SymbolRefs).--no-renames).--help.Test plan
--since, non-git exit 2 with empty stdout,--by symbol,--min-churn).cargo test(198 green),clippy -D warnings,fmt --check,--no-default-featuresbuild — all clean.🤖 Generated with Claude Code