Documentation
¶
Index ¶
- func IsCommitHash(s string) bool
- type CloneErr
- type GitSource
- type Option
- type PathExistsErr
- type Workspace
- func (w *Workspace) AbsPath(path string) string
- func (w *Workspace) Cleanup(ctx context.Context) error
- func (w *Workspace) Init(ctx context.Context) error
- func (w *Workspace) IsDir(path string) bool
- func (w *Workspace) IsExecutable(path string) bool
- func (w *Workspace) IsFile(path string) bool
- func (w *Workspace) RmDir(path string) error
- func (w *Workspace) Root() string
- func (w *Workspace) SourceDir() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsCommitHash ¶
IsCommitHash checks if a string matches the pattern of a git commit hash (5-40 hexadecimal characters).
Types ¶
type GitSource ¶
type GitSource struct {
URL string `json:"url" validate:"required"`
Ref string `json:"ref" validate:"required"`
Path string `json:"path"` // subdirectory within the repo
}
GitSource defines the git repository to clone.
func GitSourceFromPlanTypes ¶
GitSourceFromPlanTypes converts a plantypes.GitSource to a workspace.GitSource.
type Option ¶
type Option func(*Workspace)
Option configures a Workspace.
func WithCleanup ¶
WithCleanup configures whether to remove the workspace directory before initialization. If true, Init() will delete any existing directory at the workspace path before creating it. This is useful when re-using workspace IDs or recovering from failed clones.
func WithGitSource ¶
WithGitSource sets a git source for cloning.
func WithTmpRoot ¶
WithTmpRoot sets the root temp directory for the workspace.
type PathExistsErr ¶
type PathExistsErr struct {
Path string
}
func (PathExistsErr) Error ¶
func (p PathExistsErr) Error() string
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Workspace provides a temporary directory with optional git clone support.
func (*Workspace) Init ¶
Init creates the workspace directory and clones the git source if configured.
func (*Workspace) IsExecutable ¶
IsExecutable returns true if the path exists and is executable.