Repository navigation
fix(tree): star marks import hubs, not the largest files; add legend - #295
Merged
Merged
Conversation
The tree starred the five largest source files with no legend, so a reader could not tell what the star meant, and on this repo it landed on main_more_test.go. File size says nothing about blast radius. The star now marks hubs from the file graph, with the importer count inline: `types.ts ←41` for a file, `scanner/ ←73` on the directory of a multi-file Go package (Go imports name packages, so the count belongs to the package, per #292). N is the importer count used by get_hubs and the session-start hub list; a hub needs 3+ non-test importers, so test files are never starred. One legend line under the tree says what the marker and N mean, and carries the graph note: partial coverage, or why stars are missing (no graph, or the repo is above the 5000-file graph limit). Hubs come from the daemon's validated graph when it was built with the same filters, else a fresh BuildFileGraph scan (docling, no daemon: 0.41s -> 1.8s per `codemap .`; codemap with a warm daemon: no measurable change). The session-start hook drops its own hub block when the tree carries the legend, so hubs are stated once and the werkzeug tree still fits the 10,000 char cap at full depth. --json, --deps, --skyline and --diff output are unchanged. MCP get_structure renders without hub data, so its tree loses the old size stars and gains no legend; its HUB FILES section is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWQw8DzwM4bQnL7mvk6Fsq
JordanCoin
added a commit
that referenced
this pull request
Nov 11, 2026
…296) * fix(tree): star marks import hubs, not the largest files; add legend The tree starred the five largest source files with no legend, so a reader could not tell what the star meant, and on this repo it landed on main_more_test.go. File size says nothing about blast radius. The star now marks hubs from the file graph, with the importer count inline: `types.ts ←41` for a file, `scanner/ ←73` on the directory of a multi-file Go package (Go imports name packages, so the count belongs to the package, per #292). N is the importer count used by get_hubs and the session-start hub list; a hub needs 3+ non-test importers, so test files are never starred. One legend line under the tree says what the marker and N mean, and carries the graph note: partial coverage, or why stars are missing (no graph, or the repo is above the 5000-file graph limit). Hubs come from the daemon's validated graph when it was built with the same filters, else a fresh BuildFileGraph scan (docling, no daemon: 0.41s -> 1.8s per `codemap .`; codemap with a warm daemon: no measurable change). The session-start hook drops its own hub block when the tree carries the legend, so hubs are stated once and the werkzeug tree still fits the 10,000 char cap at full depth. --json, --deps, --skyline and --diff output are unchanged. MCP get_structure renders without hub data, so its tree loses the old size stars and gains no legend; its HUB FILES section is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWQw8DzwM4bQnL7mvk6Fsq * feat(tree): compact tree with line counts, hub addresses and symbols Builds on the hub stars and legend from #295. All changes apply to the plain `codemap .` tree; --json, --deps, --skyline and --diff are unchanged. - Fold same-directory tests into their source: `filegraph.go (+3 tests)` (Go x_test/x_*_test, JS/TS .test/.spec, Python test_x/x_test). - Count unmatched tests as `+N other tests`, except in a tests tree (test/, tests/, __tests__/, spec/ or no folded test), which lists its files. - Collapse 4+ siblings that differ only in digit-bearing tokens: `page-*.yml ×9`. - Collapse a wholly untracked directory (git ls-files --others --directory) to one line with its file count and size. - Print a single-file directory as `dir/FILE`, at any depth, so .claude/skills/ and plugins/codemap/skills/ render alike. - Give an overlong name its own row in sorted position instead of forcing a whole directory into one column. - Show physical line counts at 100+ lines (`hooks.go 2535L`; text files up to 2MB, binaries and assets skipped). - Read files for line counts and symbol lines only when Lstat says regular (symlinks, FIFOs and devices skipped), through a reader capped at 2MB+1. - Trailer: `Hubs (top 10 of N)` with full paths, importer counts and line counts, wrapped under 400 chars; `path:line Name` for up to 3 exported top-level functions of the top 5 file hubs, kept only when the reported source line names the symbol; `Next:` commands. - ast-grep function and type matches now record their line (FileAnalysis.SymbolLines, not serialized). - Session-start hook: hubs stated once (its own hub block is dropped when the tree prints the legend), and the tree sheds extras before depth via CODEMAP_TREE_LEAN (1: no symbols, top 3 hubs; 2: also no line counts) before fitSessionStart cuts depth. Renders are cached by depth and level. Measured (`codemap .`, warm, vs origin/main): - codemap (daemon cache warm): 0.04s -> 0.13s; docling (no daemon): 0.40s -> 1.97s, of which the hub graph scan is ~1.4s, line counts and symbols ~0.2s. - Output: codemap 307 -> 163 lines, 16.1KB -> 10.3KB; docling 492 -> 456 lines; CodeMachine-CLI 313 -> 324 lines. - Hook: werkzeug full depth at 8,040 chars (#295: 8,028, full depth); codemap full depth at 8,528 chars (#295: depth 1, 3,369). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWQw8DzwM4bQnL7mvk6Fsq * fix(tree): hub list one per line, drop symbol lines First-three-exported-in-file-order symbols were arbitrary and Go package hubs got none, so the symbol rows and the ast-grep line recording behind them are gone. The hub list prints one hub per line, right-aligned count first, so names align and no 400-char wrapping is needed; hook lean level 1 now cuts it to three rows. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWQw8DzwM4bQnL7mvk6Fsq --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
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.
What
In
codemap ., the star used to mark the five largest source files, with no legend. On this repo that put a star onmain_more_test.go. File size says nothing about what breaks when you edit a file.The star now marks import hubs, with the importer count inline, and one legend line under the tree says what it means:
get_hubsand the session-start hub list report: 3+ non-test importers. Test files are never starred.Cost
Hubs come from the daemon's validated graph when one exists, otherwise a fresh
BuildFileGraphscan. With no daemon,codemap .on docling goes from 0.41s to about 1.8s. With a warm daemon on this repo there is no measurable change.Unchanged
--json,--deps,--skylineoutput is byte-identical on codemap and docling;--diffshows no stars or legend.get_structurerenders without hub data, so its tree loses the old size stars and gains no legend. Its HUB FILES section is unchanged. (Checked by reading the code, not by running the MCP server.)Known loose wording
#includefor C, type references for Swift).Test
gofmt -l .clean,go vet ./...,go test ./...pass locally.🤖 Generated with Claude Code
https://claude.ai/code/session_01FWQw8DzwM4bQnL7mvk6Fsq