trace

package
v0.53.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package trace exposes the versioned, JSON-friendly SpecScore records used by code-intelligence providers. It owns document meaning; symbol discovery and attachment remain provider responsibilities.

Index

Constants

View Source
const ContractVersion = "specscore.trace/v1"

ContractVersion identifies the JSON contract. It belongs to the SpecScore trace provider contract and is intentionally explicit in every snapshot.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptanceCriterion

type AcceptanceCriterion = AcceptanceCriterionRecord

type AcceptanceCriterionRecord

type AcceptanceCriterionRecord struct {
	ID           string      `json:"id"`
	FeatureID    string      `json:"feature_id"`
	Slug         string      `json:"slug"`
	Title        string      `json:"title,omitempty"`
	Requirements []string    `json:"requirements,omitempty"`
	Source       SourceRange `json:"source"`
}

AcceptanceCriterionRecord is a stable, addressable AC inside a Feature.

type Document

type Document = Snapshot

type Feature

type Feature = FeatureRecord

Short aliases keep the public contract ergonomic for callers that already use the record names as domain types.

type FeatureRecord

type FeatureRecord struct {
	ID                 string                      `json:"id"`
	Path               string                      `json:"path"`
	Title              string                      `json:"title,omitempty"`
	Status             string                      `json:"status,omitempty"`
	Source             SourceRange                 `json:"source"`
	Requirements       []RequirementRecord         `json:"requirements,omitempty"`
	AcceptanceCriteria []AcceptanceCriterionRecord `json:"acceptance_criteria,omitempty"`
	Scenarios          []ScenarioRecord            `json:"scenarios,omitempty"`
}

FeatureRecord is a normalized Feature and its inline requirements and ACs.

func Discover

func Discover(specRoot string) ([]FeatureRecord, error)

Discover parses all Feature READMEs below specRoot/spec/features and returns deterministic records. It is useful for provider snapshots.

func ParseFeature

func ParseFeature(path string) (*FeatureRecord, error)

ParseFeature parses one Feature README. Metadata and section handling are delegated to pkg/feature; this package only adds the normalized child records that provider integrations need.

type Requirement

type Requirement = RequirementRecord

type RequirementRecord

type RequirementRecord struct {
	ID        string      `json:"id"`
	FeatureID string      `json:"feature_id"`
	Slug      string      `json:"slug"`
	Title     string      `json:"title,omitempty"`
	Source    SourceRange `json:"source"`
}

RequirementRecord is a stable, addressable REQ inside a Feature.

type Scenario

type Scenario = ScenarioRecord

type ScenarioRecord

type ScenarioRecord struct {
	ID        string      `json:"id"`
	FeatureID string      `json:"feature_id"`
	Slug      string      `json:"slug"`
	Title     string      `json:"title,omitempty"`
	Validates []string    `json:"validates,omitempty"`
	Source    SourceRange `json:"source"`
}

ScenarioRecord is a standalone executable scenario under a Feature's _tests directory. Whether its file contains an executable Rehearse block is intentionally left for the scenario runner/provider to determine.

func ParseScenario

func ParseScenario(path string) (*ScenarioRecord, error)

ParseScenario parses one standalone scenario file.

type Snapshot

type Snapshot struct {
	Version  string          `json:"version"`
	Features []FeatureRecord `json:"features"`
}

Snapshot is the top-level JSON exchange shape for a repository or feature.

func SnapshotForRoot

func SnapshotForRoot(specRoot string) (*Snapshot, error)

SnapshotForRoot builds the versioned provider exchange shape for one repository root.

type SourceRange

type SourceRange struct {
	Path        string `json:"path"`
	StartLine   int    `json:"start_line"`
	StartColumn int    `json:"start_column,omitempty"`
	EndLine     int    `json:"end_line"`
	EndColumn   int    `json:"end_column,omitempty"`
}

SourceRange is a 1-based, inclusive line and column range in one source file. EndColumn is exclusive on EndLine, matching common parser ranges.

Jump to

Keyboard shortcuts

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