feat: restrict tracing to git repositories by default - #15
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Only emit traces when the session's working directory is inside a git repository. On by default; set CODE_TRACE_REQUIRE_GIT_REPO=false to trace everywhere (previous behavior). - langfuse::require_git_repo() reads the toggle (default true) - tags::cwd_in_git_repo() probes via git rev-parse --is-inside-work-tree - gate sits early in run(): no session recorded, no cursor advanced - shared + cli_test TestEnv disable the gate (payload cwds are non-git) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
/work is not a git repo, so the new default-on gate would suppress all traces. Disable it in both settings writers; the default-on path is covered by the git_gate_test integration test. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Adds an optional restriction so traces are only sent when the session's working directory is inside a git repository.
Controlled by
CODE_TRACE_REQUIRE_GIT_REPO(env or~/.config/code-trace/config), defaulting totrue. Set it tofalseto restore the previous trace-everywhere behavior.Behavior change on upgrade: because the restriction is on by default, existing installs will silently stop tracing sessions run outside any git repo until
CODE_TRACE_REQUIRE_GIT_REPO=falseis set. Also note that ifgitis not installed,rev-parsefails and nothing traces under the default.Design doc:
docs/superpowers/specs/2026-07-21-require-git-repo-design.md.