substrate

package
v0.0.437 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package substrate classifies effective process docs (workflows, skills, principles) as default|edited|authored for the CLI list surface and the web effective-process view (sty_29e5a9a5 / sty_ba0eb5c6).

Pure over a docindex.Store + embedded defaults — no I/O beyond reading disk bodies when a path is real. documents and tasks are excluded (free-form and workitem plane).

Index

Constants

View Source
const StampKey = "embedded_sha"

StampKey is the frontmatter key carrying the seed provenance hash.

Variables

This section is empty.

Functions

func ApplyStamp

func ApplyStamp(body, sha string) string

ApplyStamp inserts the seed-provenance stamp as the LAST frontmatter line of body, in whichever form the file is authored in (sty_81bb0dde):

---                          [meta]
name: x                      name = "x"
embedded_sha: <sha>          embedded_sha = "<sha>"
---

FORMAT IS SNIFFED, the same way docindex.Frontmatter sniffs it: a body opening with `---` is markdown, anything else is TOML. A file with neither is returned unchanged — an unstampable body is operator-authored by definition, and the reconcile table already treats "no stamp" as untouchable.

ApplyStamp and StripStamp must remain EXACT byte inverses in both forms, or re-stamping an unedited seed registers as an operator edit and the file is backed up and surfaced on every init.

func Classify

func Classify(d docindex.Doc, emb map[string]string) string

Classify returns default|edited|authored for one List row.

func EmbeddedBodies

func EmbeddedBodies() map[string]string

EmbeddedBodies maps kind\x00name → body for non-task embedded defaults.

func IsUneditedSeed

func IsUneditedSeed(diskBody, embeddedBody string) bool

IsUneditedSeed reports whether on-disk body is an unedited copy of embedded (stamped or stampless identical). Shared with prune.

func SHA

func SHA(body string) string

SHA is the hex sha256 of an embedded body — the same hashing docindex uses.

func StripStamp

func StripStamp(body string) (stripped, stamp string, stamped bool)

StripStamp removes the single stamp line from body's frontmatter. Exact inverse of ApplyStamp, in both forms.

Types

type Row

type Row struct {
	Kind       string `json:"kind"`
	Name       string `json:"name"`
	Source     string `json:"source"`
	Provenance string `json:"provenance"` // default | edited | authored
	Embedded   bool   `json:"embedded"`
}

Row is one effective substrate item with provenance.

func List

func List(ctx context.Context, idx *docindex.Store) ([]Row, error)

List returns effective process rows (workflows/skills/principles), classified and sorted by kind then name. Skips documents and tasks.

Jump to

Keyboard shortcuts

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