Summary
gstack-global-discover normalizes scp-style git remotes like git@github.com:owner/repo.git to https://github.com/owner/repo, but it leaves the equally valid ssh://git@github.com/owner/repo.git form as ssh://git@github.com/owner/repo.
That means /retro global and other global discovery consumers can report the same repository twice when one AI tool session ran in a clone using scp-style SSH and another ran in a clone using ssh:// SSH.
Repro
Run the normalizer on the two equivalent GitHub remotes:
bun -e "import { normalizeRemoteUrl } from './bin/gstack-global-discover.ts'; console.log(normalizeRemoteUrl('git@github.com:garrytan/gstack.git')); console.log(normalizeRemoteUrl('ssh://git@github.com/garrytan/gstack.git'));"
Current output:
https://github.com/garrytan/gstack
ssh://git@github.com/garrytan/gstack
Expected
Both valid SSH forms normalize to the same canonical remote:
https://github.com/garrytan/gstack
https://github.com/garrytan/gstack
Root cause
normalizeRemoteUrl() only handles scp-style SSH remotes with this pattern:
/^(?:ssh:\/\/)?git@([^:]+):(.+)$/
That pattern requires a colon after the host, so it misses standard URL-style SSH remotes where the owner/repo path follows a slash.
Suggested fix
Parse ssh:// remotes with URL, convert ssh://git@host/owner/repo.git to the same https://host/owner/repo form, and add regression coverage so scp-style SSH, URL-style SSH, and HTTPS all dedupe together.
Summary
gstack-global-discovernormalizes scp-style git remotes likegit@github.com:owner/repo.gittohttps://github.com/owner/repo, but it leaves the equally validssh://git@github.com/owner/repo.gitform asssh://git@github.com/owner/repo.That means
/retro globaland other global discovery consumers can report the same repository twice when one AI tool session ran in a clone using scp-style SSH and another ran in a clone usingssh://SSH.Repro
Run the normalizer on the two equivalent GitHub remotes:
bun -e "import { normalizeRemoteUrl } from './bin/gstack-global-discover.ts'; console.log(normalizeRemoteUrl('git@github.com:garrytan/gstack.git')); console.log(normalizeRemoteUrl('ssh://git@github.com/garrytan/gstack.git'));"Current output:
Expected
Both valid SSH forms normalize to the same canonical remote:
Root cause
normalizeRemoteUrl()only handles scp-style SSH remotes with this pattern:/^(?:ssh:\/\/)?git@([^:]+):(.+)$/That pattern requires a colon after the host, so it misses standard URL-style SSH remotes where the owner/repo path follows a slash.
Suggested fix
Parse
ssh://remotes withURL, convertssh://git@host/owner/repo.gitto the samehttps://host/owner/repoform, and add regression coverage so scp-style SSH, URL-style SSH, and HTTPS all dedupe together.