Help us shape the future of Go! Take the 2026 Go Developer Survey

scribe

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: AGPL-3.0, AGPL-3.0-only Imports: 18 Imported by: 0

Documentation

Overview

Package scribe is the scribe engine: it resolves a config's scribe.content / scribe.files into rendered modules and injects them into the workspace's marked regions. It is domain logic — it returns structured results and never renders terminal output (the CLI owns presentation). This is the seam the planned phase split wires: scribe runs in perform, the commit ("flush") at the end of publish.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegionElementIDs

func RegionElementIDs(f config.FileDef) []string

RegionElementIDs returns the stencil ids a region references — the body's {id} embeds for a freeform body, or the item refs (minus "br") for the items sugar.

func RenderContent

func RenderContent(appCfg *config.Config, rootDir, contentID string) (string, error)

RenderContent resolves a single stencil (by id) to its markdown fragment. It is the ad-hoc, read-only counterpart to Run: it renders one stencil and returns the markdown; it never writes artifacts or mutates files. Resolution honors the shadowing order: a user-declared stencil first, then SF's shipped defaults (modality-resolved — {summary}/{postmortem} always mean this run's arc bodies).

func RenderContentWith

func RenderContentWith(appCfg *config.Config, rootDir, contentID string, extra map[string]string) (string, error)

RenderContentWith is RenderContent with caller-supplied CONTEXT ELEMENTS — extra name→text resolutions layered ahead of the run facts. The release flow uses this to make {release.*} elements resolvable inside embedded stencils, so an AI stencil can ingest {release.changes} and hand back a reworded take.

func RenderText

func RenderText(appCfg *config.Config, rootDir, body string) string

RenderText renders a freeform body — a notification subject/body, or any other one-off audience text — through the full stencil grammar: run facts, stencil embeds (user then shipped), then the gitver leaf-pass. Best-effort: on a version or render error it degrades toward the raw body rather than failing the caller.

Types

type FileResult

type FileResult struct {
	File   string
	Region string // the scribe files: id (e.g. "readme.badges") — distinguishes regions that share one File
	Status string // "success" | "skipped"
	Detail string // "updated" | "would update" | "unchanged"
	// Reason explains a skipped (unchanged) region so identical-path lines are legible:
	// "content identical" (markers matched, no change) or "markers not found" (the span
	// was never placed). Empty for an updated region.
	Reason  string
	Preview string // dry-run: the would-be file content ("" when unchanged or writing)
}

FileResult is the outcome for one scribe files: region. Data only — the CLI renders it.

type Preview

type Preview struct {
	Path    string
	Content string
}

Preview is a dry-run standalone write (a build-contents output_file), returned as data so the CLI — never the engine — decides how to present it.

type Result

type Result struct {
	Files    []FileResult
	Previews []Preview
}

Result is the structured output of a scribe run.

func Run

func Run(appCfg *config.Config, rootDir string, dryRun, verbose bool) (*Result, error)

Run renders every scribe files: region from config, returning structured results. It performs the workspace mutations (or, in dry-run, computes previews) but never renders terminal output — that is the CLI's job.

func RunItems

func RunItems(appCfg *config.Config, rootDir string, itemIDs []string, dryRun, verbose bool) (*Result, error)

RunItems renders only the scribe files: regions that reference at least one of the given content item ids. It is the perform-time seam: a build-fed item (e.g. a generated-doc include) composes BEFORE the build that bakes it, while late items (badges needing registry/status) stay untouched for the publish pass. A no-match is a clean no-op (empty result), not an error.

Directories

Path Synopsis
Package render holds scribe's element producers.
Package render holds scribe's element producers.

Jump to

Keyboard shortcuts

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