sdd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeverityBlock = "BLOCK"
	SeverityWarn  = "WARN"
	SeverityInfo  = "INFO"
)

Variables

This section is empty.

Functions

func SDDID

func SDDID(document Document) string

SDDID exposes the deterministic identity for callers outside this package.

func WriteLockRoot

func WriteLockRoot(root *os.Root, documentDirectory string, document Document) error

WriteLockRoot replaces a lock through an already-opened filesystem root. documentDirectory is relative to root and never converted to an absolute path after the security boundary is established.

func WriteScope added in v0.4.0

func WriteScope(document Document) (allowed, forbidden []string)

WriteScope extracts the declared allowed and forbidden path lists from a parsed SDD. Callers that compare against a spec must use this extraction rather than a second parser.

Types

type DerivedStatus

type DerivedStatus struct {
	TasksTotal   int
	TasksDone    int
	TasksDoing   int
	Blocks       int
	ChangedPaths int
}

DerivedStatus is intentionally assembled from generated lock data and live repository state. It never trusts the hand-written task checkbox as status.

func DeriveStatusWithLock

func DeriveStatusWithLock(directory string, document, content []byte) (DerivedStatus, error)

DeriveStatusWithLock derives status from bytes read through an already-opened root. It keeps CLI status free of absolute-path SDD reads after confinement.

type Document

type Document struct {
	FrontMatter    map[string]string
	Sections       []Section
	Requirements   []Requirement
	AllowedPaths   []string
	ForbiddenPaths []string
	Raw            []byte
}

Document is the structural view of one hand-authored sdd.md. It deliberately keeps prose as text; the linter, not the parser, decides whether prose is complete or normative.

func Parse

func Parse(content []byte) (Document, error)

Parse extracts markdown structure without interpreting arbitrary prose as syntax. Malformed front matter or markdown is retained as best-effort text.

type Finding

type Finding struct {
	Code     string `json:"code"`
	Severity string `json:"severity"`
	Target   string `json:"target"`
	Message  string `json:"message"`
}

func LintSDDContentWithLock

func LintSDDContentWithLock(directory string, content, lock []byte) []Finding

LintSDDContentWithLock lints document and lock bytes that were obtained by one already-confined filesystem boundary. It deliberately never opens a path, so a caller cannot validate one lock and then follow a swapped symlink.

func LintSelectedSDDContentWithLock

func LintSelectedSDDContentWithLock(directory string, content, lock []byte) []Finding

LintSelectedSDDContentWithLock lints an SDD explicitly selected by the caller. Unlike repository-wide lint, selection is an assertion that this SDD owns the working-tree change, so its write scope is checked even when the SDD document itself was committed before the implementation changes.

type Lock

type Lock struct {
	SDDID         string              `json:"sdd_id"`
	ContentSHA256 string              `json:"content_sha256"`
	Requirements  []LockedRequirement `json:"requirements"`
	Tasks         []LockedTask        `json:"tasks"`
}

func GenerateLock

func GenerateLock(document Document) Lock

type LockedRequirement

type LockedRequirement struct {
	Name  string `json:"name"`
	Delta string `json:"delta"`
}

type LockedTask

type LockedTask struct {
	Number string `json:"number"`
	Verify string `json:"verify"`
	Status string `json:"status"`
}

type Requirement

type Requirement struct {
	Name      string
	Text      string
	Delta     string
	Scenarios []Scenario
}

type Scenario

type Scenario struct {
	Name string
	When string
	Then string
}

type Section

type Section struct {
	Level int
	Name  string
	Lines []string
}

type Task

type Task struct {
	Number   string
	Task     string
	Files    string
	Verify   string
	Status   string
	Evidence string
}

func Tasks added in v0.4.0

func Tasks(document Document) []Task

Tasks extracts the task table from a parsed SDD.

Jump to

Keyboard shortcuts

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