Skip to content

feat: support installing skills from GitLab, Bitbucket, and Codeberg - #75

Open
knoxgraeme wants to merge 2 commits into
mainfrom
claude/elegant-curie-uu5pnd
Open

knoxgraeme wants to merge 2 commits into
mainfrom
claude/elegant-curie-uu5pnd

Conversation

@knoxgraeme

Copy link
Copy Markdown
Owner

Closes #74

Summary

  • URL input parsing: skillfish add now 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 giget gitlab: prefix
    • https://bitbucket.org/owner/repo → Bitbucket via giget bitbucket: prefix
    • https://codeberg.org/owner/repo → Gitea via giget gitea: prefix
  • Manifest tracking: added optional provider field to .skillfish.json (omitted for GitHub for backwards compatibility)
  • Update command: non-GitHub skills are filtered out before the GitHub API update check, with a message directing users to reinstall instead
  • Giget routing: installer.ts maps the stored provider to the correct giget prefix and skips GitHub auth token for non-GitHub providers (public repos only in v1)

Limitations (v1)

  • Non-GitHub providers skip tree-based skill discovery (the GitHub API isn't available). Users must use --path to target a specific skill, or the root SKILL.md is installed.
  • Only public repositories are supported for non-GitHub providers (no per-provider auth token support yet).
  • GitLab nested namespace paths (e.g. group/subgroup/project) are not supported in the owner/repo shorthand — use the full URL form.
  • skillfish update cannot check for updates to non-GitHub skills; users must skillfish add again to update.

Test plan

  • All 255 existing tests continue to pass
  • New URL parsing tests cover: GitHub URL, GitLab URL, Bitbucket URL, Codeberg URL, unknown host rejection, missing repo rejection, JSON error output
  • New manifest tests cover: provider field round-trip, backwards compatibility without field, invalid provider rejection, healManifest preservation and dropping
  • TypeScript type check passes

🤖 Generated with Claude Code

https://claude.ai/code/session_017pk3z7xV1Y8tK6TeWiMifQ


Generated by Claude Code

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/commands/add.ts Outdated
'github.com': 'github',
'gitlab.com': 'gitlab',
'bitbucket.org': 'bitbucket',
'codeberg.org': 'gitea',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/commands/add.ts Outdated
// 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: [] };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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
Comment thread src/commands/add.ts
const data = (await res.json()) as { mainbranch?: { name?: string } };
return typeof data.mainbranch?.name === 'string' ? data.mainbranch.name : undefined;
}
} catch {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread src/commands/add.ts
if (explicitPath) {
// For explicit paths, we still need to fetch the default branch and SHA for tracking

if (provider !== 'github') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codeberg/gitea have trees sha API
https://codeberg.org/api/swagger#/repository/GetTree

self-hosted version have too

Comment thread src/commands/add.ts
$ 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only support cloud-hosted version of popular git provider?

Can support flag like --provider gitlab and full url is self-hosted url?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feel free to submit a PR for this one! @nhymxu

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.

support install skills from other Git provider

3 participants