Skip to content

Add support for SkillRepository from any Git source#6571

Draft
calvinmclean wants to merge 4 commits into
obot-platform:mainfrom
calvinmclean:feature/git-skill-sync
Draft

Add support for SkillRepository from any Git source#6571
calvinmclean wants to merge 4 commits into
obot-platform:mainfrom
calvinmclean:feature/git-skill-sync

Conversation

@calvinmclean

@calvinmclean calvinmclean commented May 11, 2026

Copy link
Copy Markdown
Contributor

Addresses #6548

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR expands SkillRepository support beyond GitHub-only archives by introducing a shared pkg/git cloning utility and wiring SkillRepository creation/sync to use it, including optional per-repository personal access tokens stored as GPTScript credentials.

Changes:

  • Add a generic pkg/git package (URL parsing, repo size checks, HTTPS cloning with size limits) and reuse it from MCP catalog + SkillRepository flows.
  • Extend SkillRepository manifest/types to carry optional sourceURLCredentials and add UI support for entering a personal access token.
  • Update controller/API handlers to store/reveal tokens via GPTScript credentials and pass them into repository sync.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
ui/user/src/routes/admin/skills/+page.svelte Adds optional PAT input and sends sourceURLCredentials on SkillRepository create.
ui/user/src/lib/services/admin/types.ts Extends admin client types with sourceURLCredentials.
pkg/git/git.go New shared git clone + URL parsing + pre-clone size checks.
pkg/git/git_test.go Unit tests for IsGitRepoURL and parseGitURL.
pkg/git/fs.go Moves/renames size-limited filesystem wrapper into pkg/git.
pkg/git/fs_test.go Updates tests for the moved size-limited filesystem wrapper.
pkg/controller/routes.go Wires SkillRepository handler construction with GPT client.
pkg/controller/handlers/skillrepository/skillrepository.go Switches SkillRepository syncing/materialization to generic git fetch + credential reveal.
pkg/controller/handlers/skillrepository/skillrepository_test.go Updates fetcher mocks/signatures to match new fetch interface.
pkg/controller/handlers/skillrepository/scan.go Pulls maxSkillMDBytes constant into scan package scope.
pkg/controller/handlers/skillrepository/github.go Replaces GitHub-only URL validation with git-based validation helper.
pkg/controller/handlers/skillrepository/github_test.go Updates URL validation tests for the new validation behavior.
pkg/controller/handlers/skillrepository/git.go New git-backed repository fetcher using pkg/git.Clone.
pkg/controller/handlers/mcpcatalog/mcpcatalog.go Reuses pkg/git.IsGitRepoURL and relocates isPathSafe.
pkg/controller/handlers/mcpcatalog/github.go Replaces inline clone logic with shared pkg/git.Clone.
pkg/controller/handlers/mcpcatalog/github_test.go Removes duplicated git URL parsing tests (now covered in pkg/git).
pkg/api/handlers/skillrepositories.go Stores/reveals per-repo tokens via GPTScript credentials and masks them in responses.
apiclient/types/skillrepository.go Adds sourceURLCredentials to the public API types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/controller/handlers/skillrepository/skillrepository.go Outdated
Comment thread pkg/git/git.go Outdated
Comment thread pkg/git/git.go Outdated
Comment thread pkg/controller/handlers/skillrepository/github.go
Comment thread ui/user/src/routes/admin/skills/+page.svelte
Comment thread pkg/api/handlers/skillrepositories.go
@calvinmclean calvinmclean force-pushed the feature/git-skill-sync branch from 4631cf7 to b13378d Compare May 12, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.

Comment thread pkg/git/git.go

sizeMB := repoInfo.Size / 1024
if sizeMB > maxSizeMB {
return fmt.Errorf("repository %s/%s is too large: %d MB (limit: %d MB)", org, repo, sizeMB, maxSizeMB)
Comment thread pkg/git/git.go
}

if sizeMB := info.Statistics.RepositorySize / (1024 * 1024); sizeMB > int64(maxSizeMB) {
return fmt.Errorf("repository %s is too large: %d MB (limit: %d MB)", projectPath, sizeMB, maxSizeMB)
Comment thread pkg/git/git.go
Comment on lines +178 to +190
clonedRepo, cloneErr := gogit.CloneContext(ctx, storer, limitedFS, cloneOptions)
if cloneErr != nil {
attemptErrs = append(attemptErrs, fmt.Errorf("%s %s: %w", attempt.name, refAttempt.name, cloneErr))
if errors.Is(cloneErr, errRepoTooLarge) {
cleanupFn()
return "", "", nil, fmt.Errorf("repository is too large (limit: %d MB)", maxRepoSizeMB)
}
if isContextError(cloneErr) {
cleanupFn()
return "", "", nil, fmt.Errorf("failed to clone repository: %w", cloneErr)
}
continue
}
Comment on lines 249 to 252

fetched, err := fetcher.MaterializeCommit(ctx, skill.Spec.RepoURL, skill.Spec.CommitSHA)
fetched, err := fetcher.Fetch(ctx, skill.Spec.RepoURL, "", skill.Spec.CommitSHA)
if err != nil {
return nil, "", err
Comment on lines +23 to 26
const maxSkillMDBytes = 1024 * 1024

func buildSkillsFromRepository(repoRoot string, repo *v1.SkillRepository, commitSHA string, indexedAt metav1.Time) ([]*v1.Skill, error) {
directories, err := discoverSkillDirectories(repoRoot)
Comment on lines +529 to +537
const repoURL = editingSource.value.trim();
const manifest: Parameters<typeof AdminService.createSkillRepository>[0] = {
displayName: editingSource.name,
repoURL: editingSource.value,
repoURL,
ref: editingSource.ref
});
};
if (editingSource.token) {
manifest.sourceURLCredentials = { [repoURL]: editingSource.token };
}
syncError?: string;
resolvedCommitSHA?: string;
discoveredSkillCount: number;
sourceURLCredentials?: Record<string, string>;
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