Remove git-urls dependency by inlining URL parsing#734
Closed
plural-copilot[bot] wants to merge 1 commit into
Closed
Remove git-urls dependency by inlining URL parsing#734plural-copilot[bot] wants to merge 1 commit into
plural-copilot[bot] wants to merge 1 commit into
Conversation
This change eliminates the external git-urls dependency by replacing its usage with Go's standard library net/url package. The git-urls package was only used for two simple URL parsing operations: 1. Extracting the path component from HTTP(S) git URLs 2. Extracting the username from various git URL formats (SCP-style, SSH, HTTPS) Changes: - Replaced giturls.Parse() calls with url.Parse() from standard library - Updated getGitUsername() to handle URL parsing with proper fallback logic - Removed github.com/whilp/git-urls from go.mod and go.sum - All existing tests pass with the new implementation This reduces the dependency footprint and eliminates a potential security vulnerability vector.
Contributor
Author
There was a problem hiding this comment.
This PR was generated by the claude Plural Agent Runtime. Here's some useful information you might want to know to evaluate the ai's perfomance:
| Name | Details |
|---|---|
| 💬 Prompt | Determine whether the requested git-urls removal work in pluralsh/plural-cli has already been completed, and if not, complete it by creating a PR.... |
| 🔗 Run history | View run history |
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
This PR removes the
github.com/whilp/git-urlsdependency from the codebase by inlining the minimal URL parsing functionality that was actually being used. The git-urls package was only used in two places inpkg/up/context.go:identifier()function: Extracting the repository path from HTTP(S) URLsgetGitUsername()function: Extracting username from various git URL formats (SCP-style, SSH, HTTPS)Both use cases have been replaced with Go's standard library
net/urlpackage along with simple string manipulation, maintaining 100% compatibility with the existing behavior.Changes
pkg/up/context.go:
github.com/whilp/git-urlsnet/urlfrom standard libraryidentifier()to useurl.Parse()instead ofgiturls.Parse()getGitUsername()to useurl.Parse()with proper handling for different URL formatsgo.mod: Removed
github.com/whilp/git-urls v1.0.0dependencygo.sum: Removed associated checksums
Validation
pkg/up/context_test.gocover the modified functionsgit@github.com:user/repo.gitssh://git@github.com/user/repo.githttps://oauth2@github.com/user/repo.githttps://github.com/user/repo.gitBenefits
Related Work
This is a separate effort from PR #733 which addressed go-git vulnerabilities. This PR specifically targets the git-urls dependency removal as requested.