workspace

package
v0.19.786 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanupAll

func CleanupAll(ctx context.Context) error

func IsCommitHash

func IsCommitHash(s string) bool

IsCommitHash checks if a string matches the pattern of a git commit hash (5-40 hexadecimal characters).

func New

func New(v *validator.Validate, opts ...workspaceOption) (*workspace, error)

func WithGitSource

func WithGitSource(src *plantypes.GitSource) workspaceOption

WithGitSource sets a git source

func WithLogger

func WithLogger(l *zap.Logger) workspaceOption

func WithTmpRoot

func WithTmpRoot(root string) workspaceOption

WithTmpRoot sets a root temp directory for the workspace

func WithWorkspaceID

func WithWorkspaceID(workspaceID string) workspaceOption

WithWorkspaceID sets an ID on the workspace

Types

type CloneErr

type CloneErr struct {
	Url string
	Ref string
	Err error
}

func (CloneErr) Error

func (c CloneErr) Error() string

func (CloneErr) Unwrap

func (c CloneErr) Unwrap() error

type PathExistsErr

type PathExistsErr struct {
	Path string
}

func (PathExistsErr) Error

func (p PathExistsErr) Error() string

type Source

type Source struct {
	// the user provided directory
	Path string

	// the root of the workspace
	Root string

	// whether this is a git source
	IsGit bool
}

func (Source) AbsPath

func (s Source) AbsPath() string

type Workspace

type Workspace interface {
	Init(context.Context) error
	Source() *Source
	Cleanup(context.Context) error

	// helpers
	Root() string
	AbsPath(string) string
	IsFile(string) bool
	IsDir(string) bool
	RmDir(string) error
	IsExecutable(string) bool
}

Jump to

Keyboard shortcuts

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