local

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package local captures local work for apply mode: the changed files of a Git worktree, named files, or no file.

Index

Constants

View Source
const (
	FormChanged = "changed"
	FormFiles   = "files"
	FormNoFiles = "no-files"
)

The capture forms, as local.capture records them.

View Source
const (
	SkipBinary    = "binary"
	SkipEmpty     = "empty"
	SkipDeleted   = "deleted"
	SkipSubmodule = "submodule"
	SkipTooLarge  = "too-large"
)

Skip reasons, as local.skipped records them.

View Source
const MaxFileSize = 1 << 20

MaxFileSize is the largest file a local capture takes; a larger one is skipped as too-large.

Variables

This section is empty.

Functions

func Outline

func Outline(d *diff.Diff, read func(path string) ([]byte, error)) ([]run.OutlineEntry, error)

Outline reads the headings of each changed Markdown file in d through read, which returns a file's content after the change. A deleted or binary file has no content to read, so it has no entry.

Types

type Captured

type Captured struct {
	Local   run.LocalTarget
	Diff    []byte
	Outline []run.OutlineEntry
}

Captured is what a local capture stores: the target's local block without its run number, the diff and the outline of the captured Markdown files.

func Capture

func Capture(req Request) (Captured, error)

Capture reads the local work req names. It writes nothing; the caller creates the run.

type File

type File struct {
	Path    string
	Abs     string
	Content []byte
}

File is one captured file: the display path the diff and anchors use, the absolute path the agent edits, and the content at capture.

func ReadFiles

func ReadFiles(args []string, cwd, root, home string) ([]File, []run.LocalSkipped, error)

ReadFiles reads the files of --files, each argument resolved against cwd. A file inside root shows as its path relative to root, one under home as ~/<path>, and any other as ext/<i>/<base name>.

type Place

type Place struct {
	// Root is the worktree root, or the working directory outside Git.
	Root string
	// Prefix is owner/repo, or the repository's directory name, or empty outside Git. It is display only.
	Prefix string
	// Repository is owner/repo when origin names a GitHub repository.
	Repository string
	// Branch is the current branch, empty on a detached HEAD.
	Branch string
	InGit  bool
}

Place is where a local capture runs: the root that display paths are relative to, and the names a run shows.

func Locate

func Locate(workdir string) (Place, error)

Locate finds the Place of workdir. Outside Git it is the working directory with no prefix.

type Request

type Request struct {
	Form    string
	WorkDir string
	Home    string
	// Base is --base for FormChanged; empty diffs against HEAD.
	Base string
	// Files are the --files arguments for FormFiles.
	Files []string
}

Request is one local capture.

Jump to

Keyboard shortcuts

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