fix: parse repo and branch from marketplace URL instead of hardcoding#75
Open
e-Nicko wants to merge 2 commits intovakovalskii:mainfrom
Open
fix: parse repo and branch from marketplace URL instead of hardcoding#75e-Nicko wants to merge 2 commits intovakovalskii:mainfrom
e-Nicko wants to merge 2 commits intovakovalskii:mainfrom
Conversation
- Add parseMarketplaceUrl() function to extract repo and branch from URL - Use parsed values instead of hardcoded 'vakovalskii/LocalDesk-Skills/main' - Support custom forks and branches via ref parameter - Add in-memory cache to avoid duplicate URL parsing - Fixes issue where skills from custom forks/branches were not loaded correctly
Collaborator
|
Hi! Maybe it will be better to use any url, not only hardcoded api.github, what do you think? |
Addresses code review feedback to support any URL format instead of hardcoded GitHub API endpoints. Changes: - Add parseMarketplaceUrl() function to extract baseUrl, repo, and branch from any marketplace URL format (GitHub, GitLab, custom APIs, localhost) - Dynamically construct SKILL.md and content URLs based on parsed URL data - Preserve query parameters and hash from download_url when constructing SKILL.md URLs for non-GitHub sources - Conditionally add ?ref= parameter only if original marketplace URL contains it (indicates API support) - Improve error handling: track download failures, check for critical SKILL.md file, allow partial downloads with warnings - Add in-memory cache for parsed marketplace URLs to optimize performance Fixes: - Path shadowing bug in downloadContents - SKILL.md URL construction for non-GitHub sources - Relative path calculation for nested directories - Double slashes in URLs for root path marketplaces - Missing query parameters in constructed URLs - Silent download failures Now supports: - GitHub API: https://api.github.com/repos/owner/repo/contents/skills - Custom forks/branches: ?ref=feature/branch - Localhost: http://localhost:3000/api/skills - Custom APIs: https://custom-api.example.com/skills - Any URL format with proper path and query parameter handling
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.
🎯 What's Fixed
Previously, the skills loader used hardcoded repository and branch values (
vakovalskii/LocalDesk-Skills/main), which prevented users from working with custom forks and branches via therefparameter in the marketplace URL.✨ What Changed
parseMarketplaceUrl()function — intelligently parses marketplace URLs to extract repository and branch informationrefparameter in URLs (e.g.,?ref=feature/rlm-pdf-reader)🔍 Example Usage
Now you can specify a custom marketplace URL, for example - custom user and branch:
It is quite useful for remote fork dev.
And the system will automatically:
e-Nicko/LocalDesk-Skillsfeature/rlm-pdf-reader🐛 Problem Solved
Previously, when a custom marketplace URL was specified, the system would still attempt to load skills from the default repository and branch, causing errors or loading incorrect skill versions.
📝 Technical Details
owner/repofrom the URL pathrefparameter is extracted viaURL.searchParams🧪 Testing
Tested with:
refparameter