remote

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package remote parses and materializes GitHub source specifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRemote

func IsRemote(input string) bool

IsRemote reports whether input uses the github: source scheme.

Types

type Result

type Result struct {
	Path       string // absolute path to the selected file, directory, or repository root
	Root       string // absolute path to the repository checkout, including its private .git directory
	Commit     string // full commit object ID
	Repository string // canonical https://github.com/owner/repository.git URL
	// contains filtered or unexported fields
}

Result describes a materialized source. Call Cleanup when the source is no longer needed; it removes the complete private work area, including .git.

func Materialize

func Materialize(ctx context.Context, raw string) (Result, error)

Materialize resolves a GitHub source to a fresh sparse worktree. It always contacts the fixed github.com HTTPS endpoint, fetches only depth one with blob filtering, performs no checkout hooks or submodule initialization, and does not run downloaded code. The caller owns the result and must call Result.Cleanup after use. An omitted subpath intentionally selects the complete repository; specifying a subpath limits checkout to that path. Every call creates a fresh temporary work area; no persistent cache is used.

func (*Result) Cleanup

func (r *Result) Cleanup() error

Cleanup removes the private working copy. It is safe to call more than once.

func (*Result) Close

func (r *Result) Close() error

Close is an alias for Cleanup and allows Result to be used as an owned resource.

type Spec

type Spec struct {
	Repo string // owner/repository
	Path string // optional file or directory within the repository
	Ref  string // optional branch, tag, or commit
}

Spec identifies one GitHub repository, an optional repository-relative path, and an optional branch, tag, or commit reference.

func Parse

func Parse(input string) (Spec, error)

Parse validates github:owner/repo[//sub/path][?ref=url-encoded-ref].

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL