scaffold

package
v0.31.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package scaffold resolves AC references, extracts Given/When/Then text, and generates scaffold scenario files for the rehearse new command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(featureSlug, acSlug string, extracted *ExtractedAC) string

Generate assembles the full scaffold markdown file content for a Rehearse scenario. It combines the feature/AC slugs and extracted Given/When/Then text into a seven-part structure: YAML frontmatter, title heading, metadata block, scenario source line, extracted text, and placeholder bash block. The returned string has no trailing newline.

Types

type ExtractedAC

type ExtractedAC struct {
	HasGWT bool     // true if Given/When/Then lines were found
	Text   []string // extracted lines (Given/When/Then, or fallback raw)
}

ExtractedAC holds the result of extracting Given/When/Then text from an AC body.

func Extract

func Extract(acBody []string) *ExtractedAC

Extract parses acBody for Given/When/Then lines, stripping ** bold markers. An optional leading "Scenario: <name>" line is included. If no GWT lines are found the raw body is returned as-is with HasGWT false. Extraction stops at the next ### or ## heading.

type ResolveResult

type ResolveResult struct {
	FeatureSlug string
	ACSlug      string
	RawBody     []string // AC body lines after the ### AC: heading
}

ResolveResult holds the parsed components and raw body of a resolved AC.

func Resolve

func Resolve(acRef string, readFile func(path string) (string, error)) (*ResolveResult, error)

Resolve maps an acRef of the form "<feature-slug>#ac:<ac-slug>" to the raw body lines of that AC in spec/features/<feature-slug>/README.md.

readFile is a seam for filesystem access so unit tests never touch disk.

Jump to

Keyboard shortcuts

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