Help us shape the future of Go! Take the 2026 Go Developer Survey

specgraph

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package specgraph provides requirement graph extraction from visionspec specs. It integrates with graphize to build knowledge graphs from spec documents.

Index

Constants

View Source
const (
	NodeTypeRequirement    = "requirement"
	NodeTypeUserStory      = "user_story"
	NodeTypeConstraint     = "constraint"
	NodeTypeAcceptanceCrit = "acceptance_criteria"
	NodeTypeDecision       = "decision"
	NodeTypeTradeoff       = "tradeoff"
	NodeTypeCapability     = "capability"
	NodeTypeSection        = "section"
	NodeTypeSpec           = "spec"
)

Node types for spec graphs.

View Source
const (
	EdgeTypeTracesTo      = "traces_to"
	EdgeTypeDerivedFrom   = "derived_from"
	EdgeTypeConflictsWith = "conflicts_with"
	EdgeTypeSatisfies     = "satisfies"
	EdgeTypeDependsOn     = "depends_on"
	EdgeTypeBlocks        = "blocks"
	EdgeTypeSupersedes    = "supersedes"
	EdgeTypeContains      = "contains"
)

Edge types for spec relationships.

Variables

This section is empty.

Functions

func LoadJSON

func LoadJSON(path string) (*graph.Graph, error)

LoadJSON loads a graph from a JSON file.

func SaveJSON

func SaveJSON(g *graph.Graph, path string) error

SaveJSON saves a graph to a JSON file.

Types

type ExportFormat

type ExportFormat string

ExportFormat specifies the output format for graph export.

const (
	FormatHTML    ExportFormat = "html"
	FormatGraphML ExportFormat = "graphml"
	FormatJSON    ExportFormat = "json"
)

type ExportOptions

type ExportOptions struct {
	Format    ExportFormat
	OutputDir string
	Title     string
}

ExportOptions configures graph export behavior.

type ExportResult

type ExportResult struct {
	OutputPath string
	Format     ExportFormat
	NodeCount  int
	EdgeCount  int
}

ExportResult contains information about the export operation.

func Export

func Export(g *graph.Graph, opts ExportOptions) (*ExportResult, error)

Export exports a graph to the specified format.

type ExtractedContent

type ExtractedContent struct {
	Nodes []*graph.Node
	Edges []*graph.Edge
}

ExtractedContent holds nodes and edges extracted from a section.

type Metrics

type Metrics struct {
	TotalRequirements int
	TotalUserStories  int
	TotalConstraints  int
	TotalDecisions    int
	TraceCoverage     float64 // Percentage of requirements traced to TRD
	ConflictCount     int
}

Metrics contains computed statistics from a spec graph.

func ComputeMetrics

func ComputeMetrics(g *graph.Graph) *Metrics

ComputeMetrics computes metrics from a graph.

type QueryFilter

type QueryFilter struct {
	NodeType string // Filter by node type (e.g., "requirement", "user_story")
	SpecType string // Filter by spec type (e.g., "prd", "trd")
}

QueryFilter specifies filtering criteria for graph queries.

type QueryResult

type QueryResult struct {
	Nodes []*graph.Node
	Count int
}

QueryResult contains filtered nodes from a query.

func Query

func Query(g *graph.Graph, filter QueryFilter) *QueryResult

Query filters nodes in a graph based on the provided filter criteria.

type Section

type Section struct {
	Title   string
	Level   int
	Content string
}

Section represents a markdown section.

type SpecExtractor

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

SpecExtractor extracts requirement graphs from visionspec projects.

func NewSpecExtractor

func NewSpecExtractor(projectPath string) *SpecExtractor

NewSpecExtractor creates a new spec extractor for a project.

func (*SpecExtractor) Extract

func (e *SpecExtractor) Extract() (*graph.Graph, error)

Extract builds a requirement graph from all specs in the project.

Jump to

Keyboard shortcuts

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