feat(codedb): grok-build list_dir inside codedb - #579
Merged
Conversation
Port grok-build's directory listing into the existing codedb tool instead of adding a catalog entry. codedb list_dir walks any PathConfine folder (including --add-dir), honors .gitignore, seeds depth-1 so a fat sibling cannot hide the rest, and collapses leftover dirs under a 10k-char budget.
A listing of an unindexed extra root must not inherit /tmp/.gitignore (or /). Nested files under the walk dir still apply.
Keep a local codedb/ checkout (gitignored, like surfer/) so the harness and github.com/justrach/codedb#696 can evolve the same BFS listing. Graff still runs list_dir in-process for PathConfine.
Prints the current graff surface (one codedb tool, prompt-cache max) and a fixture bake-off: find/ls vs codedb list_dir vs codedb ls. No provider. --self-test checks gitignore, 10k cap, and catalog tax.
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.
Why
Grok-build's
list_dir(BFS,.gitignore, any folder, 10k-char cap) is the listing we were reaching for withbash ls. Graff already owns that slot with codedb — a new always-on catalog tool would tax every turn (that is how the first #574 A/B lost).What
codedb list_dir <path>is implemented in-process (no codedb binary, no index):.gitignore+.git/info/excludewhen the walk is inside a git repo; without a git root, only the walk dir's ignore file (no climb into/tmp/.gitignore).gitomitted; other dotfiles stay visible (.githubis load-bearing)[N files in subtree: K *.ext]read_file, including--add-dirextra rootscodedb ls/treestay index queries. ADR 0013 records the "subcommand, not catalog tool" decision.The root prompt now says to use this instead of
bash ls.Sibling: codedb repo
Same algorithm in a checkout at
/workspace/codedb(gitignored here, likesurfer/):codedb list_dir [path]walks the live tree and exits before snapshot/daemon (no index)src/mcp_list_dir.zig;mcp.zig(317KB) is wired viapatches/696-mcp-list-dir.patchGraff stays in-process so
--add-dirand a missing binary still work.Showcase (offline)
Measured on a 400-file fat-sibling fixture (gitignore +
.git+.github):find -printls -lacodedb list_dircodedb ls(index)list_diris 198× smaller thanfind, hidesskip.log/build/, keeps.github, collapsesaaa/to[400 files in subtree: 400 *.zig], and still listszzz/tail.md. Catalog stays onecodedbtool.Tests
**/ no-git-root climb.git, keeps.github, fat-sibling collapse, extra-root listing, confinement, empty dir--self-testgreenzig build testfor the new cases is green.Base:
release/v0.0.268.