spec

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package spec reads and fingerprints respex spec files.

Index

Constants

View Source
const Skeleton = `` /* 237-byte string literal not displayed */

Skeleton is the spec file written by `respex init` without a description.

Variables

This section is empty.

Functions

func CleanSpecPath added in v0.1.6

func CleanSpecPath(p string) (string, error)

CleanSpecPath validates and normalizes a config/proposal spec path. Paths are slash-separated in configuration regardless of platform. The returned path is relative, clean, and cannot escape the project root.

func EncodeFiles added in v0.1.6

func EncodeFiles(files []File) []byte

EncodeFiles serializes a bundle for storage in spec_versions.content.

func Hash

func Hash(content []byte) string

Hash returns the sha256 hex digest of the contents.

func HashFiles added in v0.1.6

func HashFiles(files []File) string

HashFiles fingerprints a bundle over both paths and contents, so renames and reordering are detected alongside edits.

func MissingSections added in v0.1.5

func MissingSections(content []byte) []string

func Read

func Read(path string) ([]byte, error)

Read returns the spec file contents; empty files are an error.

Types

type File added in v0.1.6

type File struct {
	Path    string `json:"path"`
	Content []byte `json:"content"`
}

File is one member of a spec bundle: a repository-relative slash path and its contents. The first file of a bundle is always the master spec.

func DecodeFiles added in v0.1.6

func DecodeFiles(b []byte) ([]File, bool)

DecodeFiles interprets stored version content. The second return is false for legacy single-file rows (raw Markdown), true for encoded bundles.

func ReadFiles added in v0.1.6

func ReadFiles(root string, paths []string) ([]File, error)

ReadFiles reads each path under root into an ordered bundle. Paths are slash-separated; empty files are an error, same as Read.

Jump to

Keyboard shortcuts

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