Skip to content

feat: restrict tracing to git repositories by default - #15

Merged
winjer merged 3 commits into
mainfrom
feat/require-git-repo
Jul 21, 2026
Merged

feat: restrict tracing to git repositories by default#15
winjer merged 3 commits into
mainfrom
feat/require-git-repo

Conversation

@winjer

@winjer winjer commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

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 to true. Set it to false to 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=false is set. Also note that if git is not installed, rev-parse fails and nothing traces under the default.

Design doc: docs/superpowers/specs/2026-07-21-require-git-repo-design.md.

winjer and others added 3 commits July 21, 2026 08:52
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>
@winjer
winjer marked this pull request as ready for review July 21, 2026 08:05
@winjer
winjer merged commit 710fa08 into main Jul 21, 2026
2 checks passed
@winjer
winjer deleted the feat/require-git-repo branch July 21, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant