Skip to content

fix: parse repo and branch from marketplace URL instead of hardcoding#75

Open
e-Nicko wants to merge 2 commits intovakovalskii:mainfrom
e-Nicko:fix/skills-marketplace-url-parsing
Open

fix: parse repo and branch from marketplace URL instead of hardcoding#75
e-Nicko wants to merge 2 commits intovakovalskii:mainfrom
e-Nicko:fix/skills-marketplace-url-parsing

Conversation

@e-Nicko
Copy link

@e-Nicko e-Nicko commented Jan 22, 2026

🎯 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 the ref parameter in the marketplace URL.

✨ What Changed

  • Added parseMarketplaceUrl() function — intelligently parses marketplace URLs to extract repository and branch information
  • Dynamic source detection — replaces hardcoded values with parsed values from the URL
  • Support for custom forks and branches — works seamlessly with the ref parameter in URLs (e.g., ?ref=feature/rlm-pdf-reader)
  • In-memory cache — avoids redundant URL parsing for better performance
  • Graceful fallback — falls back to default values if parsing fails, ensuring backward compatibility

🔍 Example Usage

image

Now you can specify a custom marketplace URL, for example - custom user and branch:

https://api.github.com/repos/e-Nicko/LocalDesk-Skills/contents/skills?ref=feature/rlm-pdf-reader

It is quite useful for remote fork dev.

And the system will automatically:

  • Detect repository: e-Nicko/LocalDesk-Skills
  • Detect branch: feature/rlm-pdf-reader
  • Load skills from the specified source

🐛 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

  • Parsing function uses regex to extract owner/repo from the URL path
  • The ref parameter is extracted via URL.searchParams
  • Cache stores parsing results to optimize repeated calls
  • Fallback to default values ensures backward compatibility

🧪 Testing

Tested with:

  • Default marketplace URL (backward compatible)
  • Custom repository URLs
  • Custom branch references via ref parameter
  • Invalid URL formats (graceful fallback)

- 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
@EvilFreelancer
Copy link
Collaborator

Hi! Maybe it will be better to use any url, not only hardcoded api.github, what do you think?

@EvilFreelancer EvilFreelancer self-requested a review January 23, 2026 05:33
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
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.

2 participants