workspace

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const LocalWorkspacePatternRoot = "~/.openase/workspace"

LocalWorkspacePatternRoot is the display form for the local ticket workspace root.

Variables

This section is empty.

Functions

func LocalWorkspaceRoot

func LocalWorkspaceRoot() (string, error)

LocalWorkspaceRoot resolves the absolute local ticket workspace root.

func RepoPath

func RepoPath(workspacePath string, workspaceDirname string, repoName string) string

RepoPath derives the repository path under a ticket workspace.

func TicketWorkspacePath

func TicketWorkspacePath(workspaceRoot string, orgSlug string, projectSlug string, ticketIdentifier string) (string, error)

TicketWorkspacePath derives the absolute ticket workspace path.

func TicketWorkspacePattern

func TicketWorkspacePattern(workspaceRoot string, orgSlug string, projectSlug string) (string, error)

TicketWorkspacePattern derives the read-only ticket workspace convention with a ticket placeholder.

func WrapPrepareTransportError

func WrapPrepareTransportError(machineName string, cause error) error

Types

type HTTPBasicAuthInput

type HTTPBasicAuthInput struct {
	Username string
	Password string
}

HTTPBasicAuthInput describes raw HTTPS credentials for one repository.

type HTTPBasicAuthRequest

type HTTPBasicAuthRequest struct {
	Username string
	Password string
}

HTTPBasicAuthRequest is the parsed HTTPS credential for one repository.

type Manager

type Manager struct{}

Manager prepares ticket workspaces and repository clones.

func NewManager

func NewManager() *Manager

NewManager constructs a workspace preparation manager.

func (*Manager) Prepare

func (m *Manager) Prepare(ctx context.Context, request SetupRequest) (Workspace, error)

Prepare creates the workspace root and materializes each configured repository.

type PrepareError

type PrepareError struct {
	Stage   PrepareFailureStage
	Message string
	Cause   error
}

func (*PrepareError) Error

func (e *PrepareError) Error() string

func (*PrepareError) Unwrap

func (e *PrepareError) Unwrap() error

type PrepareFailureStage

type PrepareFailureStage string
const (
	PrepareFailureStageTransport     PrepareFailureStage = "transport"
	PrepareFailureStageWorkspaceRoot PrepareFailureStage = "workspace_root"
	PrepareFailureStageRepoAuth      PrepareFailureStage = "repo_auth"
	PrepareFailureStageGitOperation  PrepareFailureStage = "git_operation"
)

type PreparedRepo

type PreparedRepo struct {
	Name             string
	RepositoryURL    string
	DefaultBranch    string
	BranchName       string
	WorkspaceDirname string
	HeadCommit       string
	Path             string
}

PreparedRepo describes one repository that was prepared inside a workspace.

type RemoteManager

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

RemoteManager prepares ticket workspaces on a remote machine over SSH.

func NewRemoteManager

func NewRemoteManager(pool *sshinfra.Pool) *RemoteManager

func (*RemoteManager) Prepare

func (m *RemoteManager) Prepare(ctx context.Context, machine domain.Machine, request SetupRequest) (Workspace, error)

type RepoInput

type RepoInput struct {
	Name             string
	RepositoryURL    string
	DefaultBranch    string
	WorkspaceDirname *string
	BranchName       *string
	HTTPBasicAuth    *HTTPBasicAuthInput
}

RepoInput describes one repository to materialize in a workspace.

type RepoRequest

type RepoRequest struct {
	Name             string
	RepositoryURL    string
	DefaultBranch    string
	WorkspaceDirname string
	BranchName       string
	HeadCommit       string
	HTTPBasicAuth    *HTTPBasicAuthRequest
}

RepoRequest is the parsed repository setup request.

type SetupInput

type SetupInput struct {
	WorkspaceRoot    string
	OrganizationSlug string
	ProjectSlug      string
	AgentName        string
	TicketIdentifier string
	Repos            []RepoInput
}

SetupInput is the raw boundary input for workspace preparation.

type SetupRequest

type SetupRequest struct {
	WorkspaceRoot    string
	OrganizationSlug string
	ProjectSlug      string
	TicketIdentifier string
	BranchName       string
	Repos            []RepoRequest
}

SetupRequest is the parsed workspace preparation request.

func ParseSetupRequest

func ParseSetupRequest(input SetupInput) (SetupRequest, error)

ParseSetupRequest validates raw workspace setup input into a parsed request.

type Workspace

type Workspace struct {
	Path       string
	BranchName string
	Repos      []PreparedRepo
}

Workspace describes a prepared ticket workspace on disk.

func PrepareWithCommandRunner

func PrepareWithCommandRunner(runner commandRunner, request SetupRequest) (Workspace, error)

Jump to

Keyboard shortcuts

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