Documentation
¶
Overview ¶
Package workspace provides unified skill workspace detection for waza commands. It analyzes directory structures to identify single-skill or multi-skill workspaces and locates eval.yaml files using a priority-based search.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindEval ¶
func FindEval(ctx *WorkspaceContext, skillName string) (string, error)
FindEval finds eval.yaml for a skill using priority order: 1. {root}/evals/{skill-name}/eval.yaml (separated convention) 2. {skill-dir}/evals/eval.yaml (nested subdir) 3. {skill-dir}/eval.yaml (co-located/legacy) Returns empty string if none found (not an error).
func LooksLikePath ¶
LooksLikePath returns true if the string appears to be a file path rather than a skill name. Exported so that CLI packages (cmd/waza, cmd/waza/dev) can share the same heuristic without duplication.
Types ¶
type ContextType ¶
type ContextType int
ContextType represents the type of workspace detected.
const ( ContextNone ContextType = iota ContextSingleSkill // CWD is inside a single skill directory ContextMultiSkill // Workspace contains multiple skills )
type DetectOption ¶
type DetectOption func(*detectOptions)
DetectOption configures workspace detection behavior.
func WithEvalsDir ¶
func WithEvalsDir(dir string) DetectOption
WithEvalsDir overrides the evals subdirectory name used during detection.
func WithSkillsDir ¶
func WithSkillsDir(dir string) DetectOption
WithSkillsDir overrides the skills subdirectory name used during detection.
type SkillInfo ¶
type SkillInfo struct {
Name string // skill name from SKILL.md frontmatter
Dir string // absolute path to the skill directory (containing SKILL.md)
SkillPath string // absolute path to SKILL.md
EvalPath string // absolute path to eval.yaml (empty if not found)
}
SkillInfo holds information about a discovered skill.
type WorkspaceContext ¶
type WorkspaceContext struct {
Type ContextType
Root string // workspace root directory
Skills []SkillInfo // discovered skills
EvalsDir string // configured evals subdirectory name (default "evals")
}
WorkspaceContext represents the detected workspace.
func DetectContext ¶
func DetectContext(dir string, opts ...DetectOption) (*WorkspaceContext, error)
DetectContext analyzes the given directory to determine workspace type. It checks: 1. CWD for SKILL.md → single-skill 2. Walk up parents for SKILL.md → single-skill (nested inside skill dir) 3. Check for skills/ directory with SKILL.md children → multi-skill 4. Scan CWD for child dirs containing SKILL.md → multi-skill