Repository navigation
Add --recursive discovery to summarize_git.py - #9
Merged
Merged
Conversation
- Walk the scanned directory with os.walk and treat git repos, submodules and worktrees (.git file; a worktree when its gitdir is under /worktrees/), bare repos (never descended into) and directories with a README as units, keyed by their path relative to the scanned directory. Flat mode stays the default and its keys and cache digests are unchanged - Add --build-dirs for README-less directories holding a build file, and repeatable --exclude/--include to adjust SKIP_DIRS; --save stores them - Give each unit its nearest enclosing unit as parent plus a depth; tell the model about the parent and the direct children (with the first paragraph of each child's README), keep child units' READMEs out of the parent's context, and store kind, depth, parent and children per entry - Viewer: list in tree order with indentation, print Kind, Parent and Contains lines, and resolve nested units by their last path component - Dry run lists every unit with its kind and indentation - Tests for discovery, parent assignment, --build-dirs, --exclude and --include, context isolation, README excerpts, the structure prompt, unchanged flat cache keys, the dry run and a mocked end-to-end run that checks the generated viewer Co-Authored-By: Claude Fable 5.1 <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 changed
summarize_git.pygains an opt-in recursive mode; the flat scan of immediate subdirectories stays the default and behaves exactly as before (its dry-run output, entries and cache keys are unchanged, and a test pins the flat cache digest).-r/--recursivewalks the scanned directory withos.walkand collects units: git repos (.gitdir), submodules and worktrees (.gitfile; a worktree when its gitdir contains/worktrees/), bare repos (HEAD,config,objects/,refs/; never descended into) and directories with a README. Hidden directories andSKIP_DIRSare pruned. Units are keyed by their path relative to the scanned directory.--build-dirsalso accepts README-less directories holding a build file (Makefile, package.json, pyproject.toml, go.mod, Cargo.toml, CMakeLists.txt, Chart.yaml, Dockerfile, ...), summarized from their build and CI files.--exclude NAME/--include NAME(repeatable) adjustSKIP_DIRS. All four options live inDEFAULTSand are stored by--save;--no-recursiveoverrides a saved config.kind,depth,parentandchildren.summaries.py): entries in tree order with an indented menu,Kind:/Parent:/Contains:lines under the header, nested units resolvable by their last path component.--list,--jsonand--textkeep working.Why
The work version of this tool treats nested repos, submodules, worktrees and sub-components as units with parent/child links; the repo version was deliberately flat. This ports that mode without changing the default.
Reviewer notes
USER_PROMPTis nowUSER_PROMPT_HEAD + USER_PROMPT_TAIL(same string). The structure note andSTRUCTURE_PROMPTenter the cache key only when the note is non-empty, which is what keeps flat-mode keys stable.HEADwould be a possible follow-up.uv run --python 3.13 --with pytest --with requests -- pytest -q test_summarize_git.py), and a live run against LM Studio on a nested fixture whose viewer shows the parent/child links and is fully cached on a rerun.🤖 Generated with Claude Code