Add repo structure tree to CLI and HTML report#4
Conversation
Architecture-view section built from stats.FileHotspots, shared between the CLI (gitcortex stats --stat structure [--tree-depth N]) and the HTML report (collapsed accordion below the glossary, capped at 3 levels). Directories aggregate Churn + Files but leave Commits at zero to avoid the double-counting trap DirStat hit before the FileTouches rename; same-name file/dir collisions across history get separate sibling nodes instead of corrupting each other. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09f25dca86
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The structure branch previously always wrote the Unicode tree to stdout, breaking the "single clean table per --stat" CSV contract that downstream parsers rely on. Add RenderTreeCSV (one row per node in DFS preorder with path/type/depth/commits/churn/files/truncated columns) and route --format csv through it. Dir rows still carry commits=0 so the CSV matches the struct semantics documented on TreeNode. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The subtree-hidden message pointed users at --depth, but the flag is actually named --tree-depth; copy-pasting from the hint produced an unknown-flag error. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
- Honest comment on the leaf Commits += accumulator (defense-in-depth, not a real case — FileHotspots is map-keyed, no dupes reach here). - Rename the glossary CSS class to .accordion so the Repo Structure <details> no longer reads as misusing a glossary-specific class. - Banner prints "depth unlimited" when --tree-depth 0 is passed, rather than showing a misleading "depth 0". - Replace O(N) findChild linear scan with per-node map index so wide flat directories no longer degrade the build to quadratic. - Prune depth during descent instead of a post-pass, so nodes past the cap are never allocated. - CapChildrenPerDir caps the HTML surface to 50 children per dir, pushing long tails into a "… N more hidden" counter so wide repos don't balloon the report. CLI intentionally left uncapped. - RenderTreeForFormat centralizes the text/CSV dispatch so a future format addition can't repeat the "csv silently wrote Unicode" bug. - New tests: format dispatch table, truncation markers in text + CSV renderers, HTML per-dir cap. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Mention --stat structure in the README stat table and RUNBOOK command list, and add a Repo Structure section in METRICS.md explaining the history-lens aggregation semantics (dir Commits=0, child count cap, tree-depth default). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Architecture-view section built from stats.FileHotspots, shared between the CLI (gitcortex stats --stat structure [--tree-depth N]) and the HTML report (collapsed accordion below the glossary, capped at 3 levels). Directories aggregate Churn + Files but leave Commits at zero to avoid the double-counting trap DirStat hit before the FileTouches rename; same-name file/dir collisions across history get separate sibling nodes instead of corrupting each other.