Repository navigation
feat(cli): default search repo to git root - #154
Merged
Merged
Conversation
Without --repo, kindling search now scopes to the enclosing git working-tree root (git rev-parse --show-toplevel), from any subdirectory, and applies no repo filter outside git. A new --all-repos flag searches every repository; an explicit --repo always wins and conflicts with --all-repos. log and capsule open default their recorded repo scope to the same root so CLI round trips keep working. Detection lives in a reusable git module (shared with the hook's project-root probe) and a resolve_repo helper that later search filters can build on. The demo's suggested search passes --all-repos because demo memory has its own sample repo ID.
git prints forward slashes on Windows while the hook records Claude Code's raw cwd (backslashes) as an observation's repoId, so the auto-detected default would never match hook-captured data. Convert the CLI default to native separators. The hook's project-root routing keeps git's raw output so per-project DB paths are unchanged.
joshuaboys
force-pushed
the
feat/cli-repo-autodetect
branch
from
October 20, 2026 16:34
8052068 to
05865f2
Compare
joshuaboys
added a commit
that referenced
this pull request
Oct 20, 2026
joshuaboys
added a commit
that referenced
this pull request
Oct 20, 2026
PR #154 merged: search defaults to the git root, with Windows separator parity against hook-captured repo ids.
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
Implements C3 (workspace auto-detect for the CLI search default repo).
crates/kindling/src/git.rs:repo_root_from(dir)/repo_root_from_cwd()viagit rev-parse --show-toplevel, failing open (non-git dir, missing dir or nogitgivesNone). The hook's project-root probe now reuses it, with identical behaviour.commands::resolve_repo(explicit, all_repos)with deterministic precedence: explicit--repo>--all-repos(no filter) > detected git root > no filter. Kept separate fromsearchso C7 (search filters) can build on it.kindling search: defaultsscopeIds.repoIdto the git root when--repois omitted; new--all-reposflag searches everything (conflicts with--repo). Text output prints the applied repo scope;--jsonalready records it inprovenance.scopeIds.kindling logandkindling capsule opendefault their recorded repo scope to the same root, sologthensearchin a git repo still round-trips (otherwise CLI-logged observations, stored with norepoId, would vanish from default searches).kindling demo's suggested search now passes--all-repos, since demo memory uses its own sample repo ID.[Unreleased]section.Claude Code hook stdin/stdout interface is unchanged. Retrieval stays deterministic (a single exact
repo_id =filter, no fallback).Known limitation
Hook-captured observations store the raw hook
cwdasrepoId(Node parity). When Claude Code runs from the repo root this matches the detected root; sessions started in a subdirectory would need--repo <that dir>or--all-repos.Testing
tests/cli.rs): default scoping from root and nested dir, explicit--repooverride,--all-repos,--repo+--all-reposrejected, text output names the scope,logdefaults repo and is found bysearch, non-git dir applies no filter. Confirmed the default-scoping tests fail against the oldsearch.rs.cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings,cargo testall pass locally.🤖 Generated with Claude Code