welcome

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPromptTemplateNotFound is returned when a prompt template path that the
	// caller supplied explicitly does not exist. The default path is not covered:
	// it falls back to the embedded template instead of failing.
	ErrPromptTemplateNotFound = errors.New("prompt template not found")

	// ErrPromptTemplateInvalid is returned when a prompt template does not
	// contain the README placeholder.
	ErrPromptTemplateInvalid = errors.New("invalid prompt template")

	// ErrNoLLMProvider is returned when generation is attempted without a
	// configured LLM provider. Callers are expected to downgrade this to a
	// warning: welcome page generation is optional.
	ErrNoLLMProvider = errors.New("no LLM provider configured for welcome page generation")
)

Functions

func AssetExists added in v1.0.2

func AssetExists(declaredPath, siteRoot string) bool

AssetExists resolves a declared asset path (as _config.yml would write it, e.g. "/assets/images/logo.png") against siteRoot -- the directory the generated site is published from -- and reports whether the file is actually there. AC-002's rule is "every declared asset path exists, or it is not declared": a config that declares a logo the generator never wrote renders a broken image on the one page everyone reads first.

func DeclaredAssetPath added in v1.0.2

func DeclaredAssetPath(configYML string) (string, bool)

DeclaredAssetPath extracts the value of a top-level "logo:" key from a Jekyll _config.yml, if one is declared. It returns ("", false) when no logo key is present: an undeclared asset is compliant with AC-002 by definition (the rule is "every declared asset path exists, or it is not declared"); only a declared-but-missing asset is the defect this reports.

func PublishedTags added in v1.0.2

func PublishedTags() []string

PublishedTags returns the declared, repository-local set of tags this package treats as real. It comes from neither the network nor the git binary (AUR-472 Non-goals): it is a value declared in this source file.

func SanitizeActionRef added in v1.0.2

func SanitizeActionRef(content string) (string, bool)

SanitizeActionRef rewrites every Mpaape/AurumCode@<ref> in content so the ref is either a tag that actually exists in the published set or a full commit SHA. Anything else -- @main, @master, an unpublished v2, or any other ref an LLM might echo back from a consumer's own README's own Quick Start -- is not provably immutable, so it is normalized to the published major tag (AUR-465, AC-001; AUR-472 fixed what "actually exists" means). This is the back-compat two-value entry point AUR-465 already depends on; it always validates against publishedTags, the declared default. Callers that want an explicit tag list or the rewrite notices should call SanitizeActionRefTags directly.

func SanitizeInternalLinks(content string) (string, bool)

SanitizeInternalLinks neutralizes any markdown link whose target is a relative, local path that is not the getting-started guide. AC-003 requires every internal link on the generated index to point to a file the generator itself produced. Nothing in this package can confirm that an LLM-invented relative path (e.g. the prompt template's own example "Section 1"/"link/" placeholders, if echoed back literally) names a real sibling page the site scaffold is about to write, so an unrecognized relative link is turned into plain text instead of shipped as a dangling link. External URLs, mailto links, and in-page anchors are untouched: they are not the class of link AC-003 is about.

Types

type GenerateOptions

type GenerateOptions struct {
	ReadmePath string // Path to README.md file
	OutputPath string // Path for generated welcome page
	ProjectDir string // Project root directory for resolving paths
	Title      string // Optional custom title override
	NavOrder   int    // Navigation order in site
}

GenerateOptions provides configuration for welcome page generation

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator creates AI-powered welcome pages from README content

func NewGenerator

func NewGenerator(orchestrator *llm.Orchestrator) *Generator

NewGenerator creates a new welcome page generator

func NewGeneratorWithPrompt

func NewGeneratorWithPrompt(orchestrator *llm.Orchestrator, promptPath string) *Generator

NewGeneratorWithPrompt creates a generator with custom prompt path

func (*Generator) Generate

func (g *Generator) Generate(ctx context.Context, opts GenerateOptions) (string, error)

Generate creates a welcome page from README content using LLM

type PromptSource

type PromptSource string

PromptSource identifies which prompt template a generation run used.

const (
	// PromptSourceRepository means the template came from the target repository.
	PromptSourceRepository PromptSource = "repository"

	// PromptSourceEmbedded means the template compiled into the binary was used.
	PromptSourceEmbedded PromptSource = "embedded"
)

type TagSanitizeResult added in v1.0.2

type TagSanitizeResult struct {
	Content string
	Changed bool
	Notices []string
}

TagSanitizeResult is SanitizeActionRefTags' outcome: the possibly rewritten content, whether anything changed, and one human-readable notice per rewrite explaining why it happened. AC-001 and AC-003 both require a rewrite to be announced, never silent.

func SanitizeActionRefTags added in v1.0.2

func SanitizeActionRefTags(content string, tags []string) TagSanitizeResult

SanitizeActionRefTags is AUR-472's fix for the form-versus-value defect a 2026-08-14 adversarial review found in this file: the previous implementation accepted any ref shaped like a semver tag (v2, v10, v1.99) as though it were the real, published v1 -- the same validate-the-shape/conclude-the-value mistake that showed up twice the same day as strings.Contains gate checks (AUR-457, AUR-465). A ref now passes only when it is a full commit SHA (the strictest possible pin, always accepted regardless of tags) or an EXACT match against `tags`, the caller-supplied roster of tags that actually exist.

An empty tags means "no list is available". Per the card's Non-goals, the safe behavior with no roster to check against is to rewrite every ref that is not a full SHA to the published major tag and say so -- never to trust an unverifiable ref's shape, and never to fail the build over it.

Jump to

Keyboard shortcuts

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