feat(cli): Preserve original GitHub URLs in agents.toml#29
Open
feat(cli): Preserve original GitHub URLs in agents.toml#29
Conversation
Previously, `dotagents add` normalized all GitHub source forms (SSH, HTTPS, shorthand) to `owner/repo` before storing in agents.toml. This lost the user's protocol intent — SSH users who need `git@` for private repo auth got silently switched to HTTPS cloning. Now the user's original URL is preserved in agents.toml and used for cloning. Source comparisons throughout the codebase use a new `sourcesMatch()` helper that normalizes to `owner/repo` internally. Also adds a helpful error message when HTTPS cloning fails due to authentication, suggesting the SSH URL form. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/HvJlB3fZbyVt7PcG3LydRzvn89uTZD1uYcvyxXrXhfg
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Replace `/(?:\.git)?\/*$/` with a non-backtracking alternative to fix CodeQL high-severity ReDoS alert. The regex could backtrack on strings with many '/' characters. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/4KUqW_ZW1-8zKBCW6XUHKriRopxbS0b4adPpUxhK7c4
Use `source.slice(0, -(ref.length + 1))` instead of regex `/@[^@]+$/` to strip the inline @ref from URLs. The regex only removes characters after the last @, so it fails for monorepo-style tags like `packages/foo@1.0.0`. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/OxcFX3PWWoQ_GZIhu0fbKJUQKzYnbDrDM6y9jQv1y-0
Replace regex-based slash stripping with a simple while loop to avoid CodeQL polynomial regex false positive on /\/+$/. Co-Authored-By: Claude <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.
Preserve the user's original GitHub URL form (SSH, HTTPS, or
owner/reposhorthand) inagents.tomlinstead of normalizing everything toowner/repo. This fixes SSH users who needgit@URLs for private repo auth — previously they got silently switched to HTTPS cloning, which fails without credential helpers.Internal source comparisons now go through
normalizeSource()/sourcesMatch()helpers that canonicalize toowner/repofor dedup and matching, while the stored and cloned URL stays in the user's original form.Also adds a helpful error when HTTPS cloning fails due to auth, suggesting the SSH URL:
Changes:
src/skills/resolver.ts—parseSource()returnscloneUrlpreserving protocol; newnormalizeSource()andsourcesMatch()exportssrc/cli/commands/add.ts— stores original URL form, usessourcesMatch()for dedupsrc/cli/commands/{install,update,remove,list,sync}.ts— normalized comparisonssrc/config/writer.ts— normalized comparison inaddExcludeToWildcardsrc/sources/git.ts— HTTPS auth failure detection with SSH hintsrc/skills/resolver.test.ts— 14 new tests forcloneUrl,normalizeSource,sourcesMatchAgent transcript: https://claudescope.sentry.dev/share/vm6xSO2oDRmrLw_n9mZVXhi-RuAcYMHxA19lsfjIOYs