Documentation
¶
Overview ¶
Package workspace loads and resolves SpecScore Studio workspace files (studio.yaml): an ecosystem name plus a list of repo entries — directory paths or glob patterns, absolute or workspace-relative, each optionally carrying a per-repo `registries:` file list for the registries adapter.
Feature: cli/studio/index (REQ: workspace-config, REQ: workspace-errors, REQ: adapter-registries)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RepoEntry ¶
type RepoEntry struct {
// Path is the absolute or workspace-relative repo directory path; glob
// patterns allowed (required).
Path string `yaml:"path"`
// Registries are optional repo-relative ops-registry file paths for the
// registries adapter to parse in addition to its discovered defaults.
Registries []string `yaml:"registries"`
}
RepoEntry is one raw entry of the workspace `repos` list. It accepts two YAML forms — a plain string path, or a mapping `{path: ..., registries: [...]}` — so existing string-only workspaces keep parsing unchanged (REQ: adapter-registries).
type Workspace ¶
type Workspace struct {
// Name is the ecosystem name (required).
Name string `yaml:"name"`
// Repos are the raw repo entries (required, non-empty).
Repos []RepoEntry `yaml:"repos"`
// Path is the absolute path of the workspace file.
Path string `yaml:"-"`
// Dir is the absolute directory containing the workspace file; relative
// repo entries and workspace-relative defaults resolve against it.
Dir string `yaml:"-"`
}
Workspace is a parsed studio.yaml workspace file.
func Load ¶
Load reads and parses the workspace file at path (absolute or relative to the working directory). A missing or unparsable file, a missing ecosystem name, or an empty repos list returns an exit-2 error with a one-line actionable message naming the expected workspace path.
func (*Workspace) DefaultDBPath ¶
DefaultDBPath returns the default fact-store path for the workspace: <workspace-dir>/.specscore-studio/facts.db.
func (*Workspace) DefaultIngrDir ¶
DefaultIngrDir returns the default INGR export root for the workspace: <workspace-dir>/.specscore-studio/ingr (REQ: ingr-export).
func (*Workspace) ResolveRegistries ¶
ResolveRegistries maps each resolved repo directory (the paths ResolveRepos returns) to the per-repo `registries:` file lists configured for it. Duplicate repo entries merge; per-repo file lists dedupe, first occurrence wins the order. Bad globs and entries naming no existing directory are skipped silently — they are ResolveRepos's errors to report.
func (*Workspace) ResolveRepos ¶
ResolveRepos expands the workspace's repo entries into a deduplicated, entry-ordered list of existing absolute directory paths, plus the deduplicated absolute paths of literal (non-glob) entries that name no existing directory. Relative entries resolve against the workspace directory; entries containing glob metacharacters expand via filepath.Glob (matches sorted) and match nothing silently. Missing literal paths are NOT an error here — the ingestion pipeline surfaces them as repo-level warnings (REQ: partial-tolerance). Zero resolved directories returns an exit-2 error naming the workspace path (REQ: workspace-errors).