types

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package types defines the core data types used throughout the skill-validator: validation results, severity levels, token counts, skill modes, and aggregated reports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContaminationReport

type ContaminationReport struct {
	MultiInterfaceTools  []string           `json:"multi_interface_tools"`
	CodeLanguages        []string           `json:"code_languages"`
	LanguageCategories   []string           `json:"language_categories"`
	PrimaryCategory      string             `json:"primary_category"`
	MismatchedCategories []string           `json:"mismatched_categories"`
	MismatchWeights      map[string]float64 `json:"mismatch_weights"`
	LanguageMismatch     bool               `json:"language_mismatch"`
	TechReferences       []string           `json:"tech_references"`
	ScopeBreadth         int                `json:"scope_breadth"`
	ContaminationScore   float64            `json:"contamination_score"`
	ContaminationLevel   string             `json:"contamination_level"`
}

ContaminationReport holds cross-language contamination metrics.

type ContentReport

type ContentReport struct {
	WordCount              int      `json:"word_count"`
	CodeBlockCount         int      `json:"code_block_count"`
	CodeBlockRatio         float64  `json:"code_block_ratio"`
	CodeLanguages          []string `json:"code_languages"`
	SentenceCount          int      `json:"sentence_count"`
	ImperativeCount        int      `json:"imperative_count"`
	ImperativeRatio        float64  `json:"imperative_ratio"`
	InformationDensity     float64  `json:"information_density"`
	StrongMarkers          int      `json:"strong_markers"`
	WeakMarkers            int      `json:"weak_markers"`
	InstructionSpecificity float64  `json:"instruction_specificity"`
	SectionCount           int      `json:"section_count"`
	ListItemCount          int      `json:"list_item_count"`
}

ContentReport holds content quality metrics computed by the content analyzer.

type DimensionScore

type DimensionScore struct {
	Label string // Display name, e.g., "Token Efficiency"
	Value int    // Score value, typically 1-5
}

DimensionScore holds a single scoring dimension's display name and value.

type Level

type Level int

Level represents the severity of a validation result.

const (
	// Pass indicates a check passed successfully.
	Pass Level = iota
	// Info indicates an informational finding that requires no action.
	Info
	// Warning indicates a non-blocking issue that should be reviewed.
	Warning
	// Error indicates a blocking issue that must be fixed.
	Error
)

func (Level) String

func (l Level) String() string

String returns the lowercase name of the level.

type MultiReport

type MultiReport struct {
	Skills   []*Report
	Errors   int
	Warnings int
}

MultiReport holds aggregated results from validating multiple skills.

type ReferenceFileReport

type ReferenceFileReport struct {
	File                string
	ContentReport       *ContentReport
	ContaminationReport *ContaminationReport
}

ReferenceFileReport holds per-file content and contamination analysis for a single reference file.

type Report

type Report struct {
	SkillDir                      string
	Results                       []Result
	TokenCounts                   []TokenCount
	OtherTokenCounts              []TokenCount
	ContentReport                 *ContentReport
	ReferencesContentReport       *ContentReport
	ContaminationReport           *ContaminationReport
	ReferencesContaminationReport *ContaminationReport
	ReferenceReports              []ReferenceFileReport
	Errors                        int
	Warnings                      int
}

Report holds all validation results and token counts.

func (*Report) Tally

func (r *Report) Tally()

Tally counts errors and warnings in the report.

type Result

type Result struct {
	Level    Level
	Category string
	Message  string
	File     string // path relative to skill dir, e.g. "SKILL.md", "references/guide.md"
	Line     int    // 0 = no line info
}

Result represents a single validation finding.

type ResultContext

type ResultContext struct {
	Category string
	File     string // default file; methods like ErrorFile override it
}

ResultContext is a builder that sets Category and a default File once, so individual results inherit location context automatically.

func (ResultContext) Error

func (c ResultContext) Error(msg string) Result

Error creates an error result using the default file.

func (ResultContext) ErrorAtLine

func (c ResultContext) ErrorAtLine(file string, line int, msg string) Result

ErrorAtLine creates an error result with an explicit file and line number.

func (ResultContext) ErrorAtLinef

func (c ResultContext) ErrorAtLinef(file string, line int, format string, args ...any) Result

ErrorAtLinef creates a formatted error result with an explicit file and line number.

func (ResultContext) ErrorFile

func (c ResultContext) ErrorFile(file, msg string) Result

ErrorFile creates an error result with an explicit file.

func (ResultContext) ErrorFilef

func (c ResultContext) ErrorFilef(file, format string, args ...any) Result

ErrorFilef creates a formatted error result with an explicit file.

func (ResultContext) Errorf

func (c ResultContext) Errorf(format string, args ...any) Result

Errorf creates a formatted error result using the default file.

func (ResultContext) Info

func (c ResultContext) Info(msg string) Result

Info creates an info result using the default file.

func (ResultContext) Infof

func (c ResultContext) Infof(format string, args ...any) Result

Infof creates a formatted info result using the default file.

func (ResultContext) Pass

func (c ResultContext) Pass(msg string) Result

Pass creates a pass result using the default file.

func (ResultContext) PassFile

func (c ResultContext) PassFile(file, msg string) Result

PassFile creates a pass result with an explicit file.

func (ResultContext) Passf

func (c ResultContext) Passf(format string, args ...any) Result

Passf creates a formatted pass result using the default file.

func (ResultContext) Warn

func (c ResultContext) Warn(msg string) Result

Warn creates a warning result using the default file.

func (ResultContext) WarnFile

func (c ResultContext) WarnFile(file, msg string) Result

WarnFile creates a warning result with an explicit file.

func (ResultContext) WarnFilef

func (c ResultContext) WarnFilef(file, format string, args ...any) Result

WarnFilef creates a formatted warning result with an explicit file.

func (ResultContext) Warnf

func (c ResultContext) Warnf(format string, args ...any) Result

Warnf creates a formatted warning result using the default file.

type Scored

type Scored interface {
	DimensionScores() []DimensionScore
	OverallScore() float64
	Assessment() string
	NovelDetails() string
}

Scored is the interface implemented by both SkillScores and RefScores. It allows formatting code to iterate dimensions generically.

type SkillMode

type SkillMode int

SkillMode indicates what kind of skill directory was detected.

const (
	// NoSkill means no SKILL.md was found in the directory.
	NoSkill SkillMode = iota
	// SingleSkill means the directory itself contains a SKILL.md.
	SingleSkill
	// MultiSkill means the directory contains subdirectories with SKILL.md files.
	MultiSkill
)

type TokenCount

type TokenCount struct {
	File   string
	Tokens int
}

TokenCount holds the token count for a single file.

Jump to

Keyboard shortcuts

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