Skip to content

add github source#381

Merged
severo merged 12 commits intomasterfrom
github-sources
Mar 18, 2026
Merged

add github source#381
severo merged 12 commits intomasterfrom
github-sources

Conversation

@severo
Copy link
Contributor

@severo severo commented Mar 17, 2026

see #327

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new GitHub-backed Source implementation so the app can parse GitHub URLs and navigate repositories (directories/files) similarly to existing Hugging Face / HTTP sources.

Changes:

  • Introduces src/lib/sources/gitHubSource.ts with URL parsing, breadcrumb/sourceParts generation, directory listing via GitHub Contents API, and branch listing via GitHub Branches API.
  • Wires GitHub source detection into the app’s source resolution chain.
  • Adds a Vitest suite covering parseGitHubUrl and getGitHubSource().sourceParts.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/lib/sources/gitHubSource.ts Implements GitHub URL parsing + Source behaviors (list files, resolve URL, versions).
src/lib/sources/index.ts Exports getGitHubSource from the sources module.
src/components/App/App.tsx Adds GitHub to the source detection chain.
test/lib/sources/gitHubSource.test.ts Adds tests for parsing and breadcrumb/sourceParts generation.

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

You can also share your feedback on Copilot code review. Take the survey.

severo and others added 4 commits March 17, 2026 12:19
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class GitHub URL support to the app’s “sources” system, enabling parsing GitHub repo/tree/blob/raw URLs, listing directory contents via the GitHub API, and integrating this new source type into the main source-resolution flow (per #327).

Changes:

  • Introduce gitHubSource with URL parsing, directory listing (GitHub Contents API), and branch listing.
  • Wire getGitHubSource into the app’s source selection chain and export it from the sources index.
  • Add unit tests for GitHub URL parsing and breadcrumb/source-part generation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/lib/sources/gitHubSource.ts New GitHub source implementation (parse URLs, list files, list branches, build breadcrumbs).
src/components/App/App.tsx Uses getGitHubSource() during source detection.
src/lib/sources/index.ts Exports getGitHubSource from the sources module.
test/lib/sources/gitHubSource.test.ts Adds coverage for GitHub URL parsing and getGitHubSource().sourceParts.

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

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

Copilot AI left a comment

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 adds GitHub as a first-class data source option (URL parsing, breadcrumb generation, and directory listing via the GitHub API) and removes the prefix field from DirSource, updating UI/test code accordingly.

Changes:

  • Introduces getGitHubSource() + parseGitHubUrl() (including breadcrumb/sourceParts behavior) and adds unit tests for URL parsing/sourceParts.
  • Removes DirSource.prefix and updates existing sources/components/tests to rely on sourceId/sourceParts instead.
  • Updates the Folder UI navigation to route using file.sourceId (via routes config) rather than joining with a directory prefix.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/lib/sources/gitHubSource.test.ts Adds tests for GitHub URL parsing and sourceParts generation.
src/lib/sources/types.ts Removes prefix from DirSource interface.
src/lib/sources/index.ts Exports getGitHubSource.
src/lib/sources/hyperparamSource.ts Drops prefix from returned DirSource object.
src/lib/sources/huggingFaceSource.ts Removes now-unused prefix logic from HF directory source.
src/lib/sources/httpSource.ts Drops prefix from returned DirSource object.
src/lib/sources/gitHubSource.ts Adds GitHub source implementation (parsing, listFiles via API, branches/versions).
src/components/Folder/Folder.tsx Switches folder navigation logic from prefix-join to file.sourceId routing.
src/components/Folder/Folder.test.tsx Updates tests to match DirSource interface change (no prefix).
src/components/App/App.tsx Wires GitHub source into source detection chain.

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

You can also share your feedback on Copilot code review. Take the survey.

@severo severo requested a review from platypii March 18, 2026 14:24
Copy link
Contributor

@platypii platypii left a comment

Choose a reason for hiding this comment

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

cool!

@severo severo merged commit 417545d into master Mar 18, 2026
4 checks passed
@severo severo deleted the github-sources branch March 18, 2026 18:22
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.

3 participants