specdoc

package
v0.9.1 Latest Latest
Warning

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

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

Documentation

Overview

Package specdoc is a thin codegrapher-owned adapter over the specscore-cli artifact parsers (github.com/specscore/specscore-cli). It turns a SpecScore artifact file (Feature, Idea, or Plan) into a single normalized Doc that codegrapher's extractor consumes.

This package copies no parsing logic: the body of each artifact is parsed by specscore-cli's exported parsers. The only thing read here directly is the leading YAML frontmatter `format:` value, used solely to classify the artifact kind before dispatching — that is classification, not body parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Doc

type Doc struct {
	Kind   Kind
	Slug   string
	Title  string
	Status string
	Grade  string // only populated for ideas (header field); empty otherwise

	// Items are the artifact's child structural elements — plan tasks, or
	// section headings for features/ideas. ID is a stable within-doc handle
	// (e.g. task number); Title is the human label.
	Items []Item

	// Refs are raw cross-references to other artifacts, as (Kind, Target)
	// pairs. Resolution into graph edges happens in a later layer.
	Refs []Ref
}

Doc is the normalized, kind-agnostic view of a SpecScore artifact that codegrapher's extractor consumes. Fields not reachable through specscore-cli's exported API for a given kind are left zero.

func Parse

func Parse(path string) (*Doc, error)

Parse reads a SpecScore artifact file, classifies it by its frontmatter `format:` value, dispatches to the matching specscore-cli parser, and maps the result into a normalized Doc.

func ParseContent

func ParseContent(logicalPath string, content []byte) (*Doc, error)

ParseContent is Parse for callers that already hold the artifact bytes (the indexer extract path). logicalPath is the artifact's project-relative path — used only to derive the artifact slug (idea/plan slug = filename stem; feature slug = README.md's parent directory) and for error messages, NOT to read the file. Because the underlying specscore-cli parsers read by path, the content is spilled to a temp file that mirrors the tail of logicalPath so slug derivation stays correct regardless of the indexer's working directory.

type Item

type Item struct {
	ID    string
	Title string
}

Item is a child structural element of a Doc.

type Kind

type Kind string

Kind is the SpecScore artifact kind.

const (
	KindFeature Kind = "feature"
	KindIdea    Kind = "idea"
	KindPlan    Kind = "plan"
)

type Ref

type Ref struct {
	Kind   string
	Target string
}

Ref is one raw cross-reference. Kind is the relationship (e.g. "promotes_to", "supersedes", "depends_on", "source", "verifies"); Target is the referenced slug or AC id as written.

Jump to

Keyboard shortcuts

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