workspace

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkspaceSelectorNotFound     = "WKS_SELECTOR_NOT_FOUND"
	WorkspaceSelectorStale        = "WKS_SELECTOR_STALE"
	WorkspaceSelectorNotDirectory = "WKS_SELECTOR_NOT_DIRECTORY"
)

Variables

This section is empty.

Functions

func ApplyProjectTopology

func ApplyProjectTopology(registration model.WorkspaceRegistration, project model.ProjectFile) model.WorkspaceRegistration

func ComparableWorkspacePath added in v0.6.0

func ComparableWorkspacePath(path string) (string, bool)

func DefaultEntrypointForRepo

func DefaultEntrypointForRepo(project model.ProjectFile, repoID string) (model.WorkspaceEntrypoint, bool)

func DefaultIgnorePatterns

func DefaultIgnorePatterns() []string

func DetectWorkspace

func DetectWorkspace(path string) (model.WorkspaceRegistration, error)

func DetectWorkspaceLayout

func DetectWorkspaceLayout(path string, explicitName string) (model.WorkspaceRegistration, model.ProjectFile, error)

func EntrypointsForRepo

func EntrypointsForRepo(project model.ProjectFile, repoID string) []model.WorkspaceEntrypoint

func ExplicitWorkspaceCWDWarnings added in v0.3.0

func ExplicitWorkspaceCWDWarnings(selector string, callerCWD string) []string

func FindEntrypoint

func FindEntrypoint(project model.ProjectFile, selector string) (model.WorkspaceEntrypoint, bool)

func FindRepo

func FindRepo(project model.ProjectFile, selector string) (model.WorkspaceRepo, bool)

func FindRepoByFile

func FindRepoByFile(project model.ProjectFile, workspaceRoot string, filePath string) (model.WorkspaceRepo, bool)

func GlobalDir

func GlobalDir() (string, error)

func IsCaseInsensitivePlatform added in v0.6.0

func IsCaseInsensitivePlatform() bool

func ListWorkspaces

func ListWorkspaces() ([]model.WorkspaceRegistration, error)

func LoadProjectFile

func LoadProjectFile(root string) (model.ProjectFile, error)

func LoadProjectSummary added in v0.3.0

func LoadProjectSummary(root string, registration model.WorkspaceRegistration) (model.ProjectFile, error)

func LoadProjectTopology

func LoadProjectTopology(root string, registration model.WorkspaceRegistration) (model.ProjectFile, error)

func LoadRegistry

func LoadRegistry() (model.RegistryFile, error)

func LoadRegistryReadOnly added in v0.6.0

func LoadRegistryReadOnly() (model.RegistryFile, error)

func ProjectConfigPath

func ProjectConfigPath(root string) string

func RegisterWorkspace

func RegisterWorkspace(name string, registration model.WorkspaceRegistration) (model.RegistryFile, error)

func RegistryPath

func RegistryPath() (string, error)

func RegistryPathReadOnly added in v0.6.0

func RegistryPathReadOnly() (string, error)

func RemoveWorkspace

func RemoveWorkspace(name string) error

func ResolveRepositoryIdentity added in v0.5.13

func ResolveRepositoryIdentity(ctx context.Context, workspaceRoot string, repos []model.WorkspaceRepo) (string, error)

ResolveRepositoryIdentity returns the one canonical identity shared by every graph observation in a workspace. Explicit topology values take precedence; otherwise only local VCS metadata is consulted. No network or path-based fallback is permitted.

func ResolveWorkspace

func ResolveWorkspace(nameOrPath string) (model.WorkspaceRegistration, error)

func SaveProjectFile

func SaveProjectFile(root string, project model.ProjectFile) error

func SaveRegistry

func SaveRegistry(registry model.RegistryFile) error

func ScanCandidates

func ScanCandidates(startDir string) ([]model.WorkspaceRegistration, error)

func WorkspaceDisplayAndCanonicalRoot added in v0.6.0

func WorkspaceDisplayAndCanonicalRoot(path string) (string, string, error)

func WorkspaceStateDir

func WorkspaceStateDir(root string) string

Types

type BinaryCandidate added in v0.3.0

type BinaryCandidate struct {
	Path     string `json:"path"`
	Active   bool   `json:"active,omitempty"`
	Revision string `json:"revision,omitempty"`
	Modified string `json:"modified,omitempty"`
	GOOS     string `json:"goos,omitempty"`
	GOARCH   string `json:"goarch,omitempty"`
	Warning  string `json:"warning,omitempty"`
}

type ExplicitWorkspaceCWDMismatch added in v0.5.5

type ExplicitWorkspaceCWDMismatch struct {
	Selector           string `json:"selector"`
	SelectedAlias      string `json:"selected_alias"`
	SelectedRoot       string `json:"selected_root"`
	CallerCWD          string `json:"caller_cwd"`
	CWDWorkspaceAlias  string `json:"cwd_workspace_alias"`
	CWDWorkspaceRoot   string `json:"cwd_workspace_root"`
	RecommendedCommand string `json:"recommended_command,omitempty"`
	OverrideFlag       string `json:"override_flag,omitempty"`
	Warning            string `json:"warning,omitempty"`
}

func ExplicitWorkspaceCWDMismatchFor added in v0.5.5

func ExplicitWorkspaceCWDMismatchFor(selector string, callerCWD string) (ExplicitWorkspaceCWDMismatch, bool)

type GitCaseCollision added in v0.3.0

type GitCaseCollision struct {
	Root         string   `json:"root"`
	Aliases      []string `json:"aliases"`
	GitCommonDir string   `json:"git_common_dir,omitempty"`
	Paths        []string `json:"paths"`
	Warnings     []string `json:"warnings,omitempty"`
}

type IgnoreMatcher

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

func LoadIgnoreMatcher

func LoadIgnoreMatcher(root string, extraPatterns []string) (*IgnoreMatcher, error)

func (*IgnoreMatcher) ShouldIgnore

func (m *IgnoreMatcher) ShouldIgnore(root, path string) bool

type ResolutionSource added in v0.3.0

type ResolutionSource string
const (
	ResolutionSourceExplicit      ResolutionSource = "explicit"
	ResolutionSourcePath          ResolutionSource = "path"
	ResolutionSourceCallerCWD     ResolutionSource = "caller_cwd"
	ResolutionSourceGitTopLevel   ResolutionSource = "git_top_level"
	ResolutionSourceLastWorkspace ResolutionSource = "last_workspace"
)

type WorkspaceDoctorAction added in v0.3.0

type WorkspaceDoctorAction struct {
	ID       string `json:"id"`
	Severity string `json:"severity"`
	Command  string `json:"command"`
	Reason   string `json:"reason"`
}

type WorkspaceDoctorReport added in v0.3.0

type WorkspaceDoctorReport struct {
	AliasesSharingRoot       []WorkspaceRootGroup      `json:"aliases_sharing_root,omitempty"`
	WorktreeFamilies         []WorkspaceWorktreeFamily `json:"worktree_families,omitempty"`
	WorkspaceReadinessIssues []WorkspaceReadinessIssue `json:"workspace_readiness_issues,omitempty"`
	GitCaseCollisions        []GitCaseCollision        `json:"git_case_collisions,omitempty"`
	StalePaths               []WorkspaceStalePath      `json:"stale_paths,omitempty"`
	BinaryShadowing          []BinaryCandidate         `json:"binary_shadowing,omitempty"`
	Health                   string                    `json:"health,omitempty"`
	NextActions              []WorkspaceDoctorAction   `json:"next_actions,omitempty"`
	Suggestions              []string                  `json:"suggestions,omitempty"`
}

func DoctorWorkspaces added in v0.3.0

func DoctorWorkspaces() (WorkspaceDoctorReport, error)

type WorkspaceIdentity added in v0.6.0

type WorkspaceIdentity struct {
	DisplayRoot    string
	CanonicalRoot  string
	ComparableRoot string
	Exists         bool
}

WorkspaceIdentity keeps the user-facing root separate from the physical identity used for comparisons and state keys.

func InspectWorkspaceIdentity added in v0.6.0

func InspectWorkspaceIdentity(path string) (WorkspaceIdentity, error)

InspectWorkspaceIdentity resolves an existing path through symlinks/junctions while preserving the cleaned absolute spelling supplied by the caller.

type WorkspacePruneReport added in v0.3.0

type WorkspacePruneReport struct {
	DryRun       bool                 `json:"dry_run"`
	Registry     string               `json:"registry,omitempty"`
	Candidates   []WorkspaceStalePath `json:"candidates,omitempty"`
	Removed      []WorkspaceStalePath `json:"removed,omitempty"`
	Skipped      []WorkspaceStalePath `json:"skipped,omitempty"`
	RemovedCount int                  `json:"removed_count"`
	Warnings     []string             `json:"warnings,omitempty"`
}

func GarbageCollectRegistry added in v0.5.11

func GarbageCollectRegistry(apply bool) (WorkspacePruneReport, error)

func PruneStaleWorkspaces added in v0.3.0

func PruneStaleWorkspaces(apply bool) (WorkspacePruneReport, error)

type WorkspaceReadinessIssue added in v0.5.5

type WorkspaceReadinessIssue struct {
	Alias             string   `json:"alias"`
	Root              string   `json:"root"`
	GovernanceBlocked bool     `json:"governance_blocked"`
	DocsReady         bool     `json:"docs_ready"`
	DocCount          int      `json:"doc_count"`
	Reasons           []string `json:"reasons,omitempty"`
	Commands          []string `json:"commands,omitempty"`
}

type WorkspaceResolution added in v0.3.0

type WorkspaceResolution struct {
	Registration model.WorkspaceRegistration
	Source       ResolutionSource
	Warnings     []string
	Synthetic    bool
}

func ResolveWorkspaceSelection added in v0.3.0

func ResolveWorkspaceSelection(nameOrPath string, callerCWD string) (WorkspaceResolution, error)

func ResolveWorkspaceSelectionReadOnly added in v0.6.0

func ResolveWorkspaceSelectionReadOnly(nameOrPath string, callerCWD string) (WorkspaceResolution, error)

type WorkspaceResolutionError added in v0.4.2

type WorkspaceResolutionError struct {
	Selector          string
	CallerCWD         string
	Fallback          WorkspaceResolution
	FallbackAvailable bool
	Warnings          []string
}

func AsWorkspaceResolutionError added in v0.4.2

func AsWorkspaceResolutionError(err error) (*WorkspaceResolutionError, bool)

func (*WorkspaceResolutionError) Error added in v0.4.2

func (e *WorkspaceResolutionError) Error() string

type WorkspaceRootGroup added in v0.3.0

type WorkspaceRootGroup struct {
	Root            string   `json:"root"`
	AliasCount      int      `json:"alias_count"`
	Aliases         []string `json:"aliases"`
	CanonicalAlias  string   `json:"canonical_alias"`
	SelectionReason string   `json:"selection_reason"`
	Kind            string   `json:"kind,omitempty"`
	Warnings        []string `json:"warnings,omitempty"`
}

func GroupWorkspacesByRoot added in v0.3.0

func GroupWorkspacesByRoot() ([]WorkspaceRootGroup, error)

type WorkspaceSelectorError added in v0.6.0

type WorkspaceSelectorError struct {
	Code     string
	Selector string
	Root     string
	Cause    error
}

func AsWorkspaceSelectorError added in v0.6.0

func AsWorkspaceSelectorError(err error) (*WorkspaceSelectorError, bool)

func (*WorkspaceSelectorError) Error added in v0.6.0

func (e *WorkspaceSelectorError) Error() string

func (*WorkspaceSelectorError) Unwrap added in v0.6.0

func (e *WorkspaceSelectorError) Unwrap() error

type WorkspaceStalePath added in v0.3.0

type WorkspaceStalePath struct {
	Alias string `json:"alias"`
	Root  string `json:"root"`
	Error string `json:"error"`
}

type WorkspaceWorktreeFamily added in v0.3.0

type WorkspaceWorktreeFamily struct {
	GitCommonDir string   `json:"git_common_dir"`
	Roots        []string `json:"roots"`
	Aliases      []string `json:"aliases"`
	Warnings     []string `json:"warnings,omitempty"`
}

Jump to

Keyboard shortcuts

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