Skip to content

fix(analytics): keep dots in repository name when resolving git remote - #611

Open
dzmitry-lopukh wants to merge 1 commit into
codemie-ai:mainfrom
dzmitry-lopukh:fix/EPMCDME-15510-dotted-repo-name
Open

dzmitry-lopukh wants to merge 1 commit into
codemie-ai:mainfrom
dzmitry-lopukh:fix/EPMCDME-15510-dotted-repo-name

Conversation

@dzmitry-lopukh

Copy link
Copy Markdown

Summary

CLI Analytics showed the local folder path (e.g. C:\projects\my.repo) instead of owner/repo for sessions in repositories whose name contains a dot (next.js, three.js, <user>.github.io, ...). Fixes EPMCDME-15510.

Root cause: detectGitRemoteRepo used [^/.]+? for the repo segment, so remotes like git@github.com:owner/my.repo.git did not match, returned undefined, and callers fell back to extractRepository(workingDirectory) (the local path).

Changes

  • src/utils/processes.ts: allow dots in the repo segment of the remote URL regex ([^/.]+? -> [^/]+?); the optional .git suffix 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

  • Sessions in dotted repos now report owner/repo instead 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).
  • Repos without dots in the name: unchanged.
  • CRITICAL change per git-workflow guide: detectGitRemoteRepo is part of the derivation source of the X-CodeMie-Repository attribution value (via resolveRepositoryName and 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.
  • Previously stored sessions are not rewritten; only new sessions are affected.

Testing

  • Unit: npx vitest run src/utils/__tests__/processes-git.test.ts (12 tests pass, 6 new).
  • Manual (Preview): built the CLI from this branch, connected via codemie proxy connect --claude-code-otlp --scope user, ran a Claude Code session in my.repo (origin git@github.com:test-owner/my.repo.git, branch feature/dotted-repo). CLI Analytics → Sessions shows Repository = test-owner/my.repo. A repo without a dot in its name still shows owner/repo as before.

Checklist

  • Self-reviewed
  • Manual testing performed
  • Documentation updated (if needed) - n/a
  • No breaking changes (or clearly documented)

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

No deployments
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