Repository navigation
feat: support installing skills from GitLab, Bitbucket, and Codeberg - #75
knoxgraeme wants to merge 2 commits into
Conversation
Closes #74. Users can now pass a full URL to `skillfish add` and the correct Git provider is detected from the hostname: skillfish add https://gitlab.com/owner/repo skillfish add https://bitbucket.org/owner/repo --path skills/foo skillfish add https://codeberg.org/owner/repo The `owner/repo` shorthand continues to target GitHub as before. - add.ts: parse https:// URLs via parseProviderUrl(); route non-GitHub inputs to a simplified install flow (no tree-discovery API call is made; --path or root SKILL.md is used instead) - installer.ts: accept `provider` option and map it to the matching giget prefix (github/gitlab/bitbucket/gitea); skip GitHub auth token for non-GitHub providers - manifest.ts: add optional `provider` field to SkillManifest; validate and heal it alongside existing fields - update.ts: filter out non-GitHub skills before the GitHub API update check; show a helpful message directing users to reinstall instead Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017pk3z7xV1Y8tK6TeWiMifQ
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd39fce644
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| 'github.com': 'github', | ||
| 'gitlab.com': 'gitlab', | ||
| 'bitbucket.org': 'bitbucket', | ||
| 'codeberg.org': 'gitea', |
There was a problem hiding this comment.
Use a supported provider for Codeberg URLs
For Codeberg URLs this sets the giget prefix to gitea, but giget 3.1.1 does not include a gitea provider in its built-in provider map (the upstream source lists github, gh, gitlab, bitbucket, and sourcehut: https://raw.githubusercontent.com/unjs/giget/v3.1.1/src/providers.ts). In the advertised skillfish add https://codeberg.org/owner/repo path, downloadTemplate('gitea:owner/repo') therefore resolves via the registry or errors instead of downloading from codeberg.org, so Codeberg installs are effectively broken unless a custom provider or supported tarball URL is supplied.
Useful? React with 👍 / 👎.
| // For non-GitHub providers, the GitHub tree API is unavailable. | ||
| // Install from the explicit path, or fall back to the root SKILL.md. | ||
| const skillPath = explicitPath ?? SKILL_FILENAME; | ||
| discoveryResult = { paths: [skillPath], branch: undefined, sha: undefined, tree: [] }; |
There was a problem hiding this comment.
Pass the actual default branch for non-GitHub installs
For GitLab and Bitbucket this leaves branch undefined, so installSkill constructs a giget source without #ref. Giget 3.1.1 defaults a missing ref to main in parseGitURI (https://raw.githubusercontent.com/unjs/giget/v3.1.1/src/_utils.ts), rather than asking the host for the repository's default branch, so public repos whose default branch is still master 404 even though a plain repo URL should install. Fetch and pass the provider's default branch, or support an explicit ref, before calling the installer.
Useful? React with 👍 / 👎.
… for non-GitHub Addresses two bugs flagged in code review: 1. gitea is not a built-in provider in giget 3.1.1 (only github, gh, gitlab, bitbucket, sourcehut). Codeberg URLs would have silently hit the template registry instead of codeberg.org. Removed Codeberg from URL_PROVIDERS and updated all references. 2. giget defaults to 'main' when no ref is given. Non-GitHub installs were passing branch: undefined, so any public repo whose default branch is 'master' or other would 404. Added fetchProviderDefaultBranch which queries the GitLab projects API and Bitbucket repositories API (unauthenticated, public repos) to resolve the actual default branch before calling the installer. Falls back to undefined (giget's default) on any network failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017pk3z7xV1Y8tK6TeWiMifQ
| const data = (await res.json()) as { mainbranch?: { name?: string } }; | ||
| return typeof data.mainbranch?.name === 'string' ? data.mainbranch.name : undefined; | ||
| } | ||
| } catch { |
There was a problem hiding this comment.
codeberg have public API can get default branch here
https://codeberg.org/api/swagger#/repository/repoGet
gitea have same https://docs.gitea.com/api/#tag/repository/operation/repoSearch
any way to handle this case for self-hosted gitlab/gitea/forgejo?
| if (explicitPath) { | ||
| // For explicit paths, we still need to fetch the default branch and SHA for tracking | ||
|
|
||
| if (provider !== 'github') { |
There was a problem hiding this comment.
codeberg/gitea have trees sha API
https://codeberg.org/api/swagger#/repository/GetTree
self-hosted version have too
| $ skillfish add owner/repo/plugin/skill Install a specific skill by path | ||
| $ skillfish add owner/repo --path path/to Install skill at specific path | ||
| $ skillfish add owner/repo --project Install to current project only | ||
| $ skillfish add https://gitlab.com/owner/repo Install from GitLab |
There was a problem hiding this comment.
only support cloud-hosted version of popular git provider?
Can support flag like --provider gitlab and full url is self-hosted url?
There was a problem hiding this comment.
feel free to submit a PR for this one! @nhymxu
Closes #74
Summary
skillfish addnow accepts full repository URLs. The provider is auto-detected from the hostname:https://github.com/owner/repo→ existing GitHub flow (full skill discovery)https://gitlab.com/owner/repo→ GitLab via gigetgitlab:prefixhttps://bitbucket.org/owner/repo→ Bitbucket via gigetbitbucket:prefixhttps://codeberg.org/owner/repo→ Gitea via gigetgitea:prefixproviderfield to.skillfish.json(omitted for GitHub for backwards compatibility)installer.tsmaps the stored provider to the correct giget prefix and skips GitHub auth token for non-GitHub providers (public repos only in v1)Limitations (v1)
--pathto target a specific skill, or the rootSKILL.mdis installed.group/subgroup/project) are not supported in theowner/reposhorthand — use the full URL form.skillfish updatecannot check for updates to non-GitHub skills; users mustskillfish addagain to update.Test plan
providerfield round-trip, backwards compatibility without field, invalid provider rejection,healManifestpreservation and dropping🤖 Generated with Claude Code
https://claude.ai/code/session_017pk3z7xV1Y8tK6TeWiMifQ
Generated by Claude Code