Skip to content

feat(fetchers): add GitHubCodeFetcher for source file fetching#62

Merged
chaliy merged 1 commit intomainfrom
fix/issue-51-github-code-fetcher
Mar 26, 2026
Merged

feat(fetchers): add GitHubCodeFetcher for source file fetching#62
chaliy merged 1 commit intomainfrom
fix/issue-51-github-code-fetcher

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 26, 2026

What

Adds a dedicated GitHubCodeFetcher that matches github.com/{owner}/{repo}/blob/{ref}/{path} URLs, returning raw source file content with language metadata via the GitHub API.

Closes #51

Why

Agents frequently need to read source files from GitHub without cloning entire repositories. The DefaultFetcher returns the GitHub UI HTML with line numbers, blame controls, and other noise. This fetcher returns clean source code.

How

  • New GitHubCodeFetcher following existing fetcher patterns
  • Fetches file contents via /repos/{owner}/{repo}/contents/{path}?ref={ref}
  • Language detection from file extension (~50 languages)
  • Binary files handled gracefully (metadata only)
  • Large files (>1MB) return metadata only
  • Format field: "github_file"
  • Registered before GitHubIssueFetcher (most specific GitHub URL pattern)

Risk

  • Low
  • Only adds a new fetcher; no changes to existing behavior

Checklist

  • Unit tests passed
  • Clippy clean (-D warnings)
  • Docs build without warnings
  • Formatting applied

Closes #51 — Adds a dedicated fetcher for GitHub blob URLs that returns
raw source file content with language metadata via the GitHub API.

Matches github.com/{owner}/{repo}/blob/{ref}/{path}. Returns file content
in a fenced code block with language detection, plus metadata (repo, ref,
size, language). Handles binary files gracefully (metadata only).
@chaliy chaliy merged commit f530c6f into main Mar 26, 2026
10 checks passed
@chaliy chaliy deleted the fix/issue-51-github-code-fetcher branch March 26, 2026 23:04
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.

feat(fetchers): GitHubCodeFetcher — source file and code search

1 participant