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 ¶
- func RegionElementIDs(f config.FileDef) []string
- func RenderContent(appCfg *config.Config, rootDir, contentID string) (string, error)
- func RenderContentWith(appCfg *config.Config, rootDir, contentID string, extra map[string]string) (string, error)
- func RenderText(appCfg *config.Config, rootDir, body string) string
- type FileResult
- type Preview
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegionElementIDs ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.