Repository navigation
fix(analytics): keep dots in repository name when resolving git remote - #611
Open
dzmitry-lopukh wants to merge 1 commit into
Open
dzmitry-lopukh wants to merge 1 commit into
dzmitry-lopukh wants to merge 1 commit into
Conversation
detectGitRemoteRepo rejected dots in the repo segment, so remotes like git@github.com:owner/my.repo.git returned undefined and CLI Analytics fell back to the local folder path instead of owner/repo. Fixes EPMCDME-15510 Generated with AI Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
This branch has not been deployed
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
CLI Analytics showed the local folder path (e.g.
C:\projects\my.repo) instead ofowner/repofor sessions in repositories whose name contains a dot (next.js,three.js,<user>.github.io, ...). Fixes EPMCDME-15510.Root cause:
detectGitRemoteRepoused[^/.]+?for the repo segment, so remotes likegit@github.com:owner/my.repo.gitdid not match, returnedundefined, and callers fell back toextractRepository(workingDirectory)(the local path).Changes
src/utils/processes.ts: allow dots in the repo segment of the remote URL regex ([^/.]+?->[^/]+?); the optional.gitsuffix is still stripped.src/utils/__tests__/processes-git.test.ts: added cases for SSH/HTTPS remotes with and without.git,vercel/next.js,user.github.io, and multi-dot names.Impact
owner/repoinstead of a local path (also stops leaking local paths / OS user names into analytics, and stops one repo splitting into a row per developer machine).detectGitRemoteRepois part of the derivation source of theX-CodeMie-Repositoryattribution value (viaresolveRepositoryNameand the session/hook paths), so this needs the security-practices reviewer checklist / sign-off. Behavior change is limited to dotted repo names, which previously fell back to the local path.Testing
npx vitest run src/utils/__tests__/processes-git.test.ts(12 tests pass, 6 new).codemie proxy connect --claude-code-otlp --scope user, ran a Claude Code session inmy.repo(origingit@github.com:test-owner/my.repo.git, branchfeature/dotted-repo). CLI Analytics → Sessions shows Repository =test-owner/my.repo. A repo without a dot in its name still showsowner/repoas before.Checklist