source

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 54 Imported by: 0

Documentation

Overview

Package source acquires and materializes Git review sources without invoking external Git or GitHub command-line programs.

Index

Constants

View Source
const (
	// MaxSourceErrorConstructionBytes bounds one retained boundary error.
	MaxSourceErrorConstructionBytes int64 = 64 << 10
	// MaxPatchResultConstructionBytes bounds a native prepared patch result.
	MaxPatchResultConstructionBytes int64 = max(
		change.MaxPreparedPatchConstructionBytes,
		change.MaxPreparedPatchRetainedBytes,
	)
)

Variables

View Source
var (
	ErrSourceLimited = errors.New("source operation exceeded its limit")
	ErrSourceStale   = errors.New("source revision became stale")
)

ErrSourceLimited identifies an source limited failure.

View Source
var ErrInvalidTarget = errors.New("invalid review target")

ErrInvalidTarget identifies an invalid target failure.

Functions

func FinishPublicationCheck

func FinishPublicationCheck(
	acquisition PublicationCheckAcquisition,
	prepared change.PreparedPublication,
) (*change.CheckedPublication, error)

FinishPublicationCheck binds CPU-reconciled preparation to the acquired target.

func FinishPublicationCheckCancellable

func FinishPublicationCheckCancellable(
	cancelled func() error,
	acquisition PublicationCheckAcquisition,
	prepared change.PreparedPublication,
) (*change.CheckedPublication, error)

FinishPublicationCheckCancellable binds CPU-reconciled preparation to the acquired target while keeping payload encoding cancellable.

func PendingPublicationExecutionConstructionBytes

func PendingPublicationExecutionConstructionBytes(
	ctx context.Context,
	checked *change.CheckedPublication,
) (int64, error)

PendingPublicationExecutionConstructionBytes returns a conservative bound for prepared wire ownership and the largest one-batch encoding scratch.

Types

type CPUAdmission

type CPUAdmission func(context.Context, func() error) error

CPUAdmission synchronously admits one CPU-only closure. Implementations must invoke work at most once, must not retain it, and must return only after work has completed or admission has failed.

type Cleanup

type Cleanup struct {
	// contains filtered or unexported fields
}

Cleanup owns the lightweight filesystem cleanup detached from a source document.

func (*Cleanup) Close

func (cleanup *Cleanup) Close() error

Close removes the detached source workspace exactly once.

type FailureError

type FailureError struct {
	Operation FailureOperation
	Kind      FailureKind
	// contains filtered or unexported fields
}

FailureError describes failure error.

func (*FailureError) Error

func (failure *FailureError) Error() string

Error returns the receiver's error value.

func (*FailureError) Unwrap

func (failure *FailureError) Unwrap() error

Unwrap returns the receiver's unwrap value.

type FailureKind

type FailureKind uint8

FailureKind describes failure kind.

const (
	FailureUnavailable FailureKind = iota + 1
	FailureStale
	FailureCancelled
	FailureLimited
	FailureFailed
)

FailureUnavailable identifies a supported failure unavailable value.

type FailureOperation

type FailureOperation string

FailureOperation represents failure operation.

const (
	OperationDiscoverRepository FailureOperation = "discover-repository"
	OperationOpenSource         FailureOperation = "open-source"
	OperationCheckPublication   FailureOperation = "check-publication"
)

OperationDiscoverRepository identifies a supported operation discover repository value.

type FilterPattern

type FilterPattern string

FilterPattern represents filter pattern.

func NewFilterPattern

func NewFilterPattern(value string) (FilterPattern, error)

NewFilterPattern constructs and validates filter pattern.

func (FilterPattern) String

func (pattern FilterPattern) String() string

String returns the receiver's string value.

type GitConfigPath

type GitConfigPath struct {
	// contains filtered or unexported fields
}

GitConfigPath is an owned absolute path used by Git configuration loading.

func NewGitConfigPath

func NewGitConfigPath(value string) (GitConfigPath, error)

NewGitConfigPath validates and copies an absolute Git configuration path.

type GitHubAuthor

type GitHubAuthor string

GitHubAuthor represents git hub author.

func (GitHubAuthor) String

func (author GitHubAuthor) String() string

String returns the receiver's string value.

type GitHubOwner

type GitHubOwner string

GitHubOwner represents git hub owner.

func (GitHubOwner) String

func (owner GitHubOwner) String() string

String returns the receiver's string value.

type GitHubRepository

type GitHubRepository string

GitHubRepository represents git hub repository.

func (GitHubRepository) String

func (repository GitHubRepository) String() string

String returns the receiver's string value.

type GitHubState

type GitHubState string

GitHubState describes git hub state.

const (
	GitHubOpen   GitHubState = "OPEN"
	GitHubClosed GitHubState = "CLOSED"
	GitHubMerged GitHubState = "MERGED"
)

GitHubOpen identifies a supported git hub open value.

type GitHubToken

type GitHubToken struct {
	// contains filtered or unexported fields
}

GitHubToken is an owned GitHub credential. It intentionally has no string conversion so it cannot be included accidentally in diagnostics.

func NewGitHubToken

func NewGitHubToken(value string) (GitHubToken, error)

NewGitHubToken validates and copies a GitHub credential.

type GitHubURL

type GitHubURL string

GitHubURL represents git hub url.

func (GitHubURL) String

func (url GitHubURL) String() string

String returns the receiver's string value.

type GitReference

type GitReference string

GitReference represents git reference.

func NewGitReference

func NewGitReference(value string) (GitReference, error)

NewGitReference constructs and validates git reference.

func (GitReference) String

func (ref GitReference) String() string

String returns the receiver's string value.

type IgnoreFile

type IgnoreFile string

IgnoreFile represents ignore file.

func NewIgnoreFile

func NewIgnoreFile(value string) (IgnoreFile, error)

NewIgnoreFile constructs and validates ignore file.

func (IgnoreFile) String

func (file IgnoreFile) String() string

String returns the receiver's string value.

type LimitError

type LimitError struct {
	Resource LimitResource
	Limit    uint64
}

LimitError describes limit error.

func (*LimitError) Error

func (failure *LimitError) Error() string

Error returns the receiver's error value.

func (*LimitError) Unwrap

func (failure *LimitError) Unwrap() error

Unwrap returns the receiver's unwrap value.

type LimitResource

type LimitResource string

LimitResource represents limit resource.

const (
	LimitRenameCandidates       LimitResource = "rename-candidates"
	LimitChangedFiles           LimitResource = "changed-files"
	LimitPullRequestDepth       LimitResource = "pull-request-fetch-depth"
	LimitRemoteThreads          LimitResource = "remote-review-thread-identities"
	LimitPendingReview          LimitResource = "pending-review-identities"
	LimitIndexEncoding          LimitResource = "index-encoded-bytes"
	LimitIndexPaths             LimitResource = "index-path-bytes"
	LimitIndexExtensions        LimitResource = "index-extension-bytes"
	LimitWorktreeEntries        LimitResource = "worktree-visited-entries"
	LimitWorktreePaths          LimitResource = "worktree-visited-path-bytes"
	LimitWorktreeDepth          LimitResource = "worktree-depth"
	LimitWorktreeDirectories    LimitResource = "worktree-open-directories"
	LimitWorktreeSymlink        LimitResource = "worktree-symlink-target-bytes"
	LimitEmbeddedRepositories   LimitResource = "embedded-repositories"
	LimitConfigFiles            LimitResource = "git-config-files"
	LimitConfigBytes            LimitResource = "git-config-bytes"
	LimitConfigEntries          LimitResource = "git-config-entries"
	LimitConfigIncludeDepth     LimitResource = "git-config-include-depth"
	LimitIgnoreFiles            LimitResource = "ignore-files"
	LimitIgnoreBytes            LimitResource = "ignore-bytes"
	LimitIgnoreRules            LimitResource = "ignore-rules"
	LimitAttributeFiles         LimitResource = "attribute-files"
	LimitAttributeBytes         LimitResource = "attribute-bytes"
	LimitAttributeRules         LimitResource = "attribute-rules"
	LimitPolicyNFAStates        LimitResource = "policy-nfa-states"
	LimitPolicyDFAStates        LimitResource = "policy-dfa-states"
	LimitPolicyEdges            LimitResource = "policy-edges"
	LimitPolicyCompileWork      LimitResource = "policy-compile-transitions"
	LimitPolicyMatchWork        LimitResource = "policy-match-transitions"
	LimitFilterAutomaton        LimitResource = "filter-automaton-work"
	LimitPullRequestRawRecords  LimitResource = "pull-request-raw-records"
	LimitPullRequestRecords     LimitResource = "pull-request-retained-records"
	LimitPackWireBytes          LimitResource = "pack-wire-bytes"
	LimitPackExpandedBytes      LimitResource = "pack-expanded-bytes"
	LimitPullRequestWorkspace   LimitResource = "pull-request-workspace-bytes"
	LimitDiffInputBytes         LimitResource = "diff-input-bytes"
	LimitDiffProcessedBytes     LimitResource = "diff-processed-bytes"
	LimitDiffLineTokens         LimitResource = "diff-line-tokens" //nolint:gosec // This names a line-count resource, not a credential.
	LimitDiffHistogramProbes    LimitResource = "diff-histogram-probes"
	LimitDiffSignatureSpans     LimitResource = "diff-signature-spans"
	LimitDiffSignaturePairs     LimitResource = "diff-signature-pairs"
	LimitDiffSignatureMergeWork LimitResource = "diff-signature-merge-work"
	LimitDiffScratchBytes       LimitResource = "diff-scratch-bytes"
	LimitDiffWorkspaceBytes     LimitResource = "diff-workspace-bytes"
)

LimitRenameCandidates identifies a supported limit rename candidates value.

type LocalDetails

type LocalDetails struct {
	Repo *RepositoryPath
	Base *RevisionRef
	Head *RevisionRef
	Kind SourceKind
}

LocalDetails represents local details.

type OpenOptions

type OpenOptions struct {
	IgnoreFile       IgnoreFile
	Include          []FilterPattern
	Exclude          []FilterPattern
	IncludeUntracked bool
	FetchThreads     bool
	FetchPending     bool
	BuiltinDefaults  bool
	Gitignore        bool
	RVWIgnore        bool
}

OpenOptions describes open options.

func (OpenOptions) RetainedBytes

func (options OpenOptions) RetainedBytes() int64

RetainedBytes returns conservative immutable option ownership.

type OpenRequest

type OpenRequest struct {
	Target  Target
	Options OpenOptions
}

OpenRequest identifies one source and its bounded acquisition options.

type Opened

type Opened struct {
	// contains filtered or unexported fields
}

Opened is the immutable result of opening one source revision. Its facts remain valid after the corresponding Revision is retired and cleaned up.

func (Opened) Kind

func (opened Opened) Kind() SourceKind

Kind returns the receiver's kind value.

func (Opened) Local

func (opened Opened) Local() (LocalDetails, bool)

Local returns the receiver's local value.

func (Opened) Options

func (opened Opened) Options() OpenOptions

Options returns the receiver's options value.

func (Opened) PublicationTarget

func (opened Opened) PublicationTarget() (PublicationTarget, bool)

PublicationTarget returns the source-bound open pull-request publication target.

func (Opened) PullRequest

func (opened Opened) PullRequest() (PullRequestDetails, bool)

PullRequest returns the receiver's pull request value.

func (Opened) Snapshot

func (opened Opened) Snapshot() change.Snapshot

Snapshot returns the receiver's snapshot value.

type OwnerRepository

type OwnerRepository struct {
	// contains filtered or unexported fields
}

OwnerRepository represents owner repository.

func NewOwnerRepository

func NewOwnerRepository(value string) (OwnerRepository, error)

NewOwnerRepository constructs and validates owner repository.

func (OwnerRepository) Owner

func (repository OwnerRepository) Owner() GitHubOwner

Owner returns the receiver's owner value.

func (OwnerRepository) Repository

func (repository OwnerRepository) Repository() GitHubRepository

Repository returns the receiver's repository value.

func (OwnerRepository) String

func (repository OwnerRepository) String() string

String returns the receiver's string value.

type PatchAcquisition

type PatchAcquisition struct {
	// contains filtered or unexported fields
}

PatchAcquisition owns patch bytes acquired from Git until CPU preparation.

func (*PatchAcquisition) Close

func (acquisition *PatchAcquisition) Close()

Close releases unprepared patch bytes.

func (*PatchAcquisition) Finish

func (acquisition *PatchAcquisition) Finish(
	ctx context.Context,
	runCPU CPUAdmission,
) (change.PatchResult, error)

Finish consumes an acquisition and performs only cancellable CPU preparation.

func (*PatchAcquisition) RequiresPreparation

func (acquisition *PatchAcquisition) RequiresPreparation() bool

RequiresPreparation reports whether Finish must run under CPU admission.

type PendingPublicationExecution

type PendingPublicationExecution struct {
	// contains filtered or unexported fields
}

PendingPublicationExecution is an opaque handle to one prepared, bounded pending-review commit protocol. Copies share the same execution state and must drive it serially.

func PreparePendingPublicationExecution

func PreparePendingPublicationExecution(
	ctx context.Context,
	checked *change.CheckedPublication,
) (PendingPublicationExecution, error)

PreparePendingPublicationExecution constructs every first-attempt payload once. The caller must reserve PendingPublicationExecutionConstructionBytes and hold a CPU permit while this runs.

func (PendingPublicationExecution) Close

func (execution PendingPublicationExecution) Close()

Close releases all operation-local ownership. Because copied handles share state, closing any copy invalidates every copy and any outstanding step.

func (PendingPublicationExecution) RetainedBytes

func (execution PendingPublicationExecution) RetainedBytes() int64

RetainedBytes returns the complete prepared execution ownership.

type PendingPublicationReconciliationAcquisition

type PendingPublicationReconciliationAcquisition struct {
	// contains filtered or unexported fields
}

PendingPublicationReconciliationAcquisition owns bounded remote state until CPU-only continuation classification completes.

func (*PendingPublicationReconciliationAcquisition) Close

func (acquisition *PendingPublicationReconciliationAcquisition) Close()

Close releases acquired state that was not finished.

func (*PendingPublicationReconciliationAcquisition) ConstructionBytes

func (acquisition *PendingPublicationReconciliationAcquisition) ConstructionBytes() int64

ConstructionBytes returns the conservative CPU classification peak.

func (*PendingPublicationReconciliationAcquisition) Finish

Finish performs continuation effect construction and classification without network I/O.

func (*PendingPublicationReconciliationAcquisition) TakePendingCapture

func (acquisition *PendingPublicationReconciliationAcquisition) TakePendingCapture() (
	change.PendingReview,
	bool,
)

TakePendingCapture transfers a synchronizing acquisition to the review domain for one-pass classification, validation, and rebase preparation.

type PendingPublicationStep

type PendingPublicationStep struct {
	// contains filtered or unexported fields
}

PendingPublicationStep is one consuming result from the pending-publication protocol. Copied steps share the same cell and must be used serially; only the first valid consumer can finish, advance, take, or close it.

func (*PendingPublicationStep) Advance

func (step *PendingPublicationStep) Advance() error

Advance consumes a continuation result so its execution can acquire the next network step.

func (*PendingPublicationStep) Close

func (step *PendingPublicationStep) Close()

Close consumes an unfinished step. Closing acquired remote state preserves the uncertainty fence and forces the next acquisition through a safe read; it never makes a direct GitHub write eligible for retry.

func (*PendingPublicationStep) ConstructionBytes

func (step *PendingPublicationStep) ConstructionBytes() int64

ConstructionBytes returns the conservative simultaneous acquisition, classification, and retry-encoding peak.

func (*PendingPublicationStep) Finish

Finish consumes acquired remote state and returns either an explicit continuation or terminal commit. It performs no network I/O.

func (*PendingPublicationStep) Kind

Kind returns the step's current closed outcome. A zero result is invalid or was already consumed through another copy.

func (*PendingPublicationStep) TakeCommit

func (step *PendingPublicationStep) TakeCommit() (PublicationCommit, error)

TakeCommit consumes a terminal result and invalidates its execution before transferring the commit to the caller.

type PendingPublicationStepKind

type PendingPublicationStepKind uint8

PendingPublicationStepKind identifies the only valid outcomes of acquiring or finishing one pending-publication protocol step.

const (
	// PendingPublicationStepAcquired requires bounded CPU-only classification.
	PendingPublicationStepAcquired PendingPublicationStepKind = iota + 1
	// PendingPublicationStepContinue permits acquisition of the next protocol step.
	PendingPublicationStepContinue
	// PendingPublicationStepTerminal owns the final publication commit.
	PendingPublicationStepTerminal
)

type PublicationCheckAcquisition

type PublicationCheckAcquisition struct {
	// contains filtered or unexported fields
}

PublicationCheckAcquisition is the validated network phase of preflight.

func (PublicationCheckAcquisition) FreshPending

func (acquisition PublicationCheckAcquisition) FreshPending() (change.PendingReview, bool)

FreshPending returns the immutable pending capture requiring CPU reconciliation.

type PublicationCheckMode

type PublicationCheckMode uint8

PublicationCheckMode states whether preflight must reacquire an existing pending review before local preparation can be finalized.

const (
	// PublicationCheckNew checks a publication with no captured pending change.
	PublicationCheckNew PublicationCheckMode = iota + 1
	// PublicationCheckPendingContinuation reacquires the captured pending change.
	PublicationCheckPendingContinuation
)

type PublicationCommit

type PublicationCommit struct {
	Pending        *change.PendingReview
	Detail         change.OperationDetail
	RemoteReview   uint64
	Disposition    change.PublicationDisposition
	PendingPhase   change.PendingPublicationPhase
	PendingRefresh change.PendingRefreshAcquisition
}

PublicationCommit represents publication commit.

type PublicationReconciliationAcquisition

type PublicationReconciliationAcquisition struct {
	// contains filtered or unexported fields
}

PublicationReconciliationAcquisition owns one bounded GitHub history spool awaiting cancellable CPU validation.

func (*PublicationReconciliationAcquisition) Close

func (acquisition *PublicationReconciliationAcquisition) Close() error

Close releases an unfinished reconciliation acquisition.

func (*PublicationReconciliationAcquisition) Finish

Finish validates and classifies acquired history without network I/O.

type PublicationTarget

type PublicationTarget struct {
	// contains filtered or unexported fields
}

PublicationTarget is the narrow immutable GitHub target needed by publication preflight. It cannot reach snapshot or repository resources.

func (PublicationTarget) RetainedBytes

func (target PublicationTarget) RetainedBytes() int64

RetainedBytes returns target-owned immutable string bytes and metadata.

func (PublicationTarget) SourceID

func (target PublicationTarget) SourceID() change.SourceID

SourceID returns the target source identity.

type PullRequestDetails

type PullRequestDetails struct {
	Author     *GitHubAuthor
	Repository OwnerRepository
	Title      Title
	BaseOID    change.ObjectID
	HeadOID    change.ObjectID
	BaseRef    GitReference
	HeadRef    GitReference
	URL        GitHubURL
	State      GitHubState
	Number     PullRequestNumber
	Draft      bool
}

PullRequestDetails represents pull request details.

type PullRequestNumber

type PullRequestNumber uint64

PullRequestNumber represents pull request number.

func (PullRequestNumber) Uint64

func (number PullRequestNumber) Uint64() uint64

Uint64 returns the receiver's uint64 value.

type PullRequestSelector

type PullRequestSelector struct {
	// contains filtered or unexported fields
}

PullRequestSelector represents pull request selector.

func NewPullRequestSelector

func NewPullRequestSelector(selector string, repository *OwnerRepository) (PullRequestSelector, error)

NewPullRequestSelector constructs and validates pull request selector.

func (PullRequestSelector) Number

func (selector PullRequestSelector) Number() PullRequestNumber

Number returns the receiver's number value.

func (PullRequestSelector) Repository

func (selector PullRequestSelector) Repository() (OwnerRepository, bool)

Repository returns the receiver's repository value.

type RepositoryPath

type RepositoryPath string

RepositoryPath represents repository path.

func NewRepositoryPath

func NewRepositoryPath(value string) (RepositoryPath, error)

NewRepositoryPath constructs and validates repository path.

func (RepositoryPath) String

func (path RepositoryPath) String() string

String returns the receiver's string value.

type Revision

type Revision struct {
	// contains filtered or unexported fields
}

Revision exclusively owns the resources used to lazily materialize an opened source revision.

func (*Revision) Retire

func (resource *Revision) Retire() *Cleanup

Retire transfers resource ownership exactly once. It does not mutate the separately returned Opened value.

type RevisionRef

type RevisionRef string

RevisionRef represents revision ref.

func (RevisionRef) String

func (ref RevisionRef) String() string

String returns the receiver's string value.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service owns local repository discovery and the GitHub client.

func NewService

func NewService(cwd WorkingDirectory, options ServiceOptions) (*Service, error)

NewService constructs and validates service.

func (*Service) AcquirePatch

func (service *Service) AcquirePatch(
	ctx context.Context,
	opened Opened,
	revision *Revision,
	request change.PatchRequest,
) (PatchAcquisition, error)

AcquirePatch performs validation, filesystem inspection, and Git acquisition only.

func (*Service) AcquirePendingPublication

func (service *Service) AcquirePendingPublication(
	ctx context.Context,
	execution PendingPublicationExecution,
	runCPU CPUAdmission,
) PendingPublicationStep

AcquirePendingPublication performs the next network-only step of a prepared pending-review publication. It returns either acquired CPU work or a terminal commit; a caller must consume that result before acquiring again.

func (*Service) AcquirePendingPublicationReconciliation

func (service *Service) AcquirePendingPublicationReconciliation(
	ctx context.Context,
	request change.ReconciliationRequest,
	runCPU CPUAdmission,
) (*PendingPublicationReconciliationAcquisition, error)

AcquirePendingPublicationReconciliation performs only remote acquisition.

func (*Service) AcquirePublicationCheck

func (service *Service) AcquirePublicationCheck(
	ctx context.Context,
	target PublicationTarget,
	options change.PublicationOptions,
	mode PublicationCheckMode,
	runCPU CPUAdmission,
) (PublicationCheckAcquisition, error)

AcquirePublicationCheck performs only network acquisition and validation.

func (*Service) AcquirePublicationReconciliation

func (service *Service) AcquirePublicationReconciliation(
	ctx context.Context,
	request change.ReconciliationRequest,
) (*PublicationReconciliationAcquisition, error)

AcquirePublicationReconciliation performs only the non-pending network acquisition phase.

func (*Service) CheckPublication

func (service *Service) CheckPublication(
	ctx context.Context,
	target PublicationTarget,
	prepared change.PreparedPublication,
) (*change.CheckedPublication, error)

CheckPublication performs the compatibility preflight path synchronously.

func (*Service) Close

func (service *Service) Close(context.Context) error

Close releases idle network connections.

func (*Service) LoadPatch

func (service *Service) LoadPatch(
	ctx context.Context,
	opened Opened,
	revision *Revision,
	request change.PatchRequest,
) (change.PatchResult, error)

LoadPatch loads and prepares a patch without scheduler integration.

func (*Service) LoadSyntax

func (service *Service) LoadSyntax(
	ctx context.Context,
	opened Opened,
	revision *Revision,
	request change.SyntaxRequest,
) (change.SyntaxResult, error)

LoadSyntax loads syntax without scheduler integration.

func (*Service) LoadSyntaxWithCPUAdmission

func (service *Service) LoadSyntaxWithCPUAdmission(
	ctx context.Context,
	opened Opened,
	revision *Revision,
	request change.SyntaxRequest,
	runCPU CPUAdmission,
) (change.SyntaxResult, error)

LoadSyntaxWithCPUAdmission acquires Git blobs outside CPU admission and prepares each acquired blob synchronously under admission.

func (*Service) Open

func (service *Service) Open(
	ctx context.Context,
	request OpenRequest,
) (Opened, *Revision, error)

Open performs the open operation.

func (*Service) Publish

func (service *Service) Publish(
	ctx context.Context,
	checked *change.CheckedPublication,
) PublicationCommit

Publish performs the publish operation.

func (*Service) ReconcilePublication

func (service *Service) ReconcilePublication(
	ctx context.Context,
	request change.ReconciliationRequest,
) change.ReconciliationResult

ReconcilePublication performs the reconcile publication operation.

func (*Service) Reload

func (service *Service) Reload(
	ctx context.Context,
	opened Opened,
	revision *Revision,
	options OpenOptions,
	runCPU CPUAdmission,
) (Opened, *Revision, error)

Reload performs the reload operation.

func (*Service) RepositoryRoot

func (service *Service) RepositoryRoot(ctx context.Context) (RepositoryPath, error)

RepositoryRoot returns the descriptor-discovered repository root.

type ServiceOptions

type ServiceOptions struct {
	GitHubToken      *GitHubToken
	GitConfigHome    *GitConfigPath
	GlobalGitConfigs []GitConfigPath
}

ServiceOptions contains the complete process-derived configuration admitted into source. The service never reads ambient credentials or environment.

type SourceKind

type SourceKind string

SourceKind describes source kind.

const (
	SourceLocalWorktree SourceKind = "local-worktree"
	SourceLocalStaged   SourceKind = "local-staged"
	SourceLocalRange    SourceKind = "local-range"
	SourceGitHubPR      SourceKind = "github-pr"
)

SourceLocalWorktree identifies a supported source local worktree value.

type SyntaxAcquisition

type SyntaxAcquisition struct {
	// contains filtered or unexported fields
}

SyntaxAcquisition owns one Git blob until CPU preparation completes.

func (*SyntaxAcquisition) Close

func (acquisition *SyntaxAcquisition) Close()

Close releases an unprepared blob.

func (*SyntaxAcquisition) Finish

func (acquisition *SyntaxAcquisition) Finish(
	ctx context.Context,
	runCPU CPUAdmission,
) (*change.PreparedSyntax, error)

Finish consumes a blob and performs only cancellable CPU preparation.

type Target

type Target struct {
	// contains filtered or unexported fields
}

Target represents target.

func NewPullRequestTarget

func NewPullRequestTarget(selector PullRequestSelector) (Target, error)

NewPullRequestTarget constructs and validates pull request target.

func NewRangeTarget

func NewRangeTarget(value string) (Target, error)

NewRangeTarget constructs and validates range target.

func StagedTarget

func StagedTarget() Target

StagedTarget performs the staged target operation.

func WorktreeTarget

func WorktreeTarget() Target

WorktreeTarget performs the worktree target operation.

func (Target) Kind

func (target Target) Kind() TargetKind

Kind returns the receiver's kind value.

func (Target) PullRequest

func (target Target) PullRequest() (PullRequestSelector, bool)

PullRequest returns the receiver's pull request value.

func (Target) Range

func (target Target) Range() (base, head RevisionRef, ok bool)

Range returns the receiver's range value.

type TargetKind

type TargetKind uint8

TargetKind describes target kind.

const (
	TargetWorktree TargetKind = iota + 1
	TargetStaged
	TargetRange
	TargetPullRequest
)

TargetWorktree identifies a supported target worktree value.

type Title

type Title string

Title represents title.

func (Title) String

func (title Title) String() string

String returns the receiver's string value.

type WorkingDirectory

type WorkingDirectory string

WorkingDirectory represents working directory.

func NewWorkingDirectory

func NewWorkingDirectory(value string) (WorkingDirectory, error)

NewWorkingDirectory constructs and validates working directory.

func (WorkingDirectory) String

func (directory WorkingDirectory) String() string

String returns the receiver's string value.

Jump to

Keyboard shortcuts

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