workspace

package
v0.40.0 Latest Latest
Warning

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

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

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).

func (*RepoEntry) UnmarshalYAML

func (e *RepoEntry) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML accepts both entry forms: a scalar string decodes into Path; anything else decodes as the mapping form.

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

func Load(path string) (*Workspace, error)

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

func (ws *Workspace) DefaultDBPath() string

DefaultDBPath returns the default fact-store path for the workspace: <workspace-dir>/.specscore-studio/facts.db.

func (*Workspace) DefaultIngrDir

func (ws *Workspace) DefaultIngrDir() string

DefaultIngrDir returns the default INGR export root for the workspace: <workspace-dir>/.specscore-studio/ingr (REQ: ingr-export).

func (*Workspace) ResolveRegistries

func (ws *Workspace) ResolveRegistries() map[string][]string

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

func (ws *Workspace) ResolveRepos() (repos, missing []string, err error)

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).

Jump to

Keyboard shortcuts

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