rubrics

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package rubrics provides evaluation rubrics for spec types. Rubrics use the shared structured-evaluation rubric definition (rubric.RubricSet) as the one canonical format across the ecosystem — there is no visionspec-local rubric type. Flat rubrics use categorical scales; rich rubrics use weighted criteria with indicators. Both are the same rubric.RubricSet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() []types.SpecType

Available returns all spec types with registered rubrics.

func DefaultPassCriteria

func DefaultPassCriteria() rubric.RubricPassCriteria

DefaultPassCriteria returns the default pass criteria: no critical or high findings, unlimited medium/low, and all required categories must pass.

func Get

func Get(specType types.SpecType) (*rubric.RubricSet, error)

Get returns the rubric set for a spec type.

func HasRubric

func HasRubric(specType types.SpecType) bool

HasRubric returns true if a rubric exists for the spec type.

func LoadWithLoader

func LoadWithLoader(loader Loader, specType types.SpecType) (*rubric.RubricSet, error)

LoadWithLoader loads a rubric using a specific loader.

func MustGet

func MustGet(specType types.SpecType) *rubric.RubricSet

MustGet returns the rubric set for a spec type, panicking on error.

func NewFileLoader

func NewFileLoader(dir string) *fileLoader

NewFileLoader creates a loader that reads rubrics from YAML files. Rubrics are named: {spec-type}.rubric.yaml (e.g., prd.rubric.yaml)

func Register

func Register(specType types.SpecType, rs *rubric.RubricSet)

Register adds a rubric set for a spec type to the registry.

func StrictPassCriteria

func StrictPassCriteria() rubric.RubricPassCriteria

StrictPassCriteria returns stricter pass criteria: no critical or high findings, at most 3 medium, and every category must pass.

func WriteRubricYAML

func WriteRubricYAML(path string, rs *rubric.RubricSet) error

WriteRubricYAML writes a rubric.RubricSet to a YAML file in the canonical structured-evaluation format.

Types

type Loader

type Loader interface {
	// Load returns the rubric for a spec type.
	Load(specType types.SpecType) (*rubric.RubricSet, error)

	// Available returns all available spec types with rubrics.
	Available() []types.SpecType
}

Loader loads rubrics from various sources.

func DefaultLoader

func DefaultLoader() Loader

DefaultLoader returns the default rubric loader (embedded rubrics).

func EmbeddedLoader

func EmbeddedLoader() Loader

EmbeddedLoader returns a loader that uses embedded Go-defined rubrics.

func NewChainLoader

func NewChainLoader(loaders ...Loader) Loader

NewChainLoader creates a loader that tries multiple loaders in order. The first loader that can load a rubric wins.

func NewEmbedFSLoader

func NewEmbedFSLoader(fsys embed.FS, dir string) Loader

NewEmbedFSLoader creates a loader that reads rubrics from an embedded filesystem. This is useful for organizations that want to compile custom rubrics into their CLI.

Usage:

//go:embed rubrics/*.rubric.yaml
var orgRubrics embed.FS

loader := rubrics.NewEmbedFSLoader(orgRubrics, "rubrics")

func NewOverrideLoader added in v0.14.0

func NewOverrideLoader(files map[types.SpecType]string) Loader

NewOverrideLoader creates a loader that maps spec types to specific rubric file paths (e.g. a project's visionspec.yaml `rubrics.overrides`). Paths must already be resolved (absolute or relative to the working directory).

func NewSubFSLoader

func NewSubFSLoader(fsys fs.FS) Loader

NewSubFSLoader creates a loader from an fs.FS interface. This is useful when working with fs.Sub() results.

Jump to

Keyboard shortcuts

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