Jido.VFS.Adapter.GitHub (Jido.VFS v1.0.0)

View Source

A GitHub virtual filesystem adapter for Jido.VFS.

This adapter allows you to interact with GitHub repositories as if they were a local filesystem, using the GitHub API through the tentacat package.

Configuration

config = Jido.VFS.Adapter.GitHub.configure(
  owner: "username",
  repo: "repository-name",
  ref: "main",  # branch or commit SHA
  auth: %{access_token: "github_pat_token"}
)

Application Configuration

You can also configure GitHub credentials in your application config:

# config/config.exs
config :jido_vfs, :github,
  access_token: "github_pat_token",
  name: "Your Name",
  email: "your@email.com"

When configured this way, the adapter will automatically use these credentials as defaults if not explicitly provided in the configure/1 call.

Authentication

Supports several authentication methods:

  • Personal Access Token: %{access_token: "token"}
  • Username/Password: %{user: "username", password: "password"}
  • No authentication (public repos only): nil

Examples

# Read a file
{:ok, content} = Jido.VFS.read(config, "README.md")

# Write a file (creates a commit)
:ok = Jido.VFS.write(config, "new_file.txt", "content", 
                  message: "Add new file", 
                  committer: %{name: "Your Name", email: "your@email.com"})

# List directory contents
{:ok, files} = Jido.VFS.list_contents(config, "src/")

Summary

Functions

Configure the GitHub adapter.

Types

config()

@type config() :: t()

t()

@type t() :: %Jido.VFS.Adapter.GitHub{
  client: Tentacat.Client.t(),
  commit_info: %{
    message: String.t(),
    committer: %{name: String.t(), email: String.t()},
    author: %{name: String.t(), email: String.t()}
  },
  owner: String.t(),
  ref: String.t(),
  repo: String.t()
}

Functions

configure(opts)

Configure the GitHub adapter.

Options

  • :owner - GitHub username or organization (required)
  • :repo - Repository name (required)
  • :ref - Branch name or commit SHA (default: "main")
  • :auth - Authentication info (optional for public repos)
  • :commit_info - Default commit information for write operations