patterns

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: 5 Imported by: 0

Documentation

Overview

Package patterns provides specification pattern detection across projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AntiPattern

type AntiPattern struct {
	Type        string            `json:"type"`
	Severity    string            `json:"severity"` // high, medium, low
	Description string            `json:"description"`
	Instances   []PatternInstance `json:"instances"`
	Suggestion  string            `json:"suggestion"`
}

AntiPattern represents a detected specification anti-pattern.

type ContentPattern

type ContentPattern struct {
	Type        string            `json:"type"`
	Pattern     string            `json:"pattern"`
	Description string            `json:"description"`
	Occurrences int               `json:"occurrences"`
	Examples    []PatternInstance `json:"examples"`
}

ContentPattern represents a common content pattern.

type Detector

type Detector struct {
	// contains filtered or unexported fields
}

Detector identifies common patterns in specification files.

func NewDetector

func NewDetector(specsDir string) *Detector

NewDetector creates a new pattern detector.

func (*Detector) Detect

func (d *Detector) Detect() (*PatternReport, error)

Detect runs all pattern detection algorithms.

type PatternInstance

type PatternInstance struct {
	Project  string `json:"project"`
	SpecType string `json:"spec_type"`
	Line     int    `json:"line"`
	Text     string `json:"text"`
}

PatternInstance is a specific occurrence of a pattern.

type PatternReport

type PatternReport struct {
	StructuralPatterns []StructuralPattern `json:"structural_patterns"`
	ContentPatterns    []ContentPattern    `json:"content_patterns"`
	AntiPatterns       []AntiPattern       `json:"anti_patterns"`
	Summary            PatternSummary      `json:"summary"`
}

PatternReport contains all detected patterns.

type PatternSummary

type PatternSummary struct {
	TotalSpecs       int            `json:"total_specs"`
	StructuralCount  int            `json:"structural_pattern_count"`
	ContentCount     int            `json:"content_pattern_count"`
	AntiPatternCount int            `json:"anti_pattern_count"`
	CommonSections   []string       `json:"common_sections"`
	PatternsByType   map[string]int `json:"patterns_by_type"`
	QualityScore     float64        `json:"quality_score"` // 0-100
}

PatternSummary provides aggregate statistics.

type SpecInfo

type SpecInfo struct {
	Project  string
	SpecType string
	Path     string
	Sections []string
	Content  string
	Lines    []string
}

SpecInfo holds extracted information about a spec file.

type StructuralPattern

type StructuralPattern struct {
	Type        string   `json:"type"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Projects    []string `json:"projects"`
	Occurrences int      `json:"occurrences"`
	Example     string   `json:"example,omitempty"`
}

StructuralPattern represents a common document structure pattern.

Jump to

Keyboard shortcuts

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