component

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: AGPL-3.0, AGPL-3.0-only Imports: 7 Imported by: 0

Documentation

Overview

Package component provides GitLab CI component spec parsing and documentation generation for the `stagefreight component` command family.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDocs

func GenerateDocs(specs []*SpecFile) string

GenerateDocs renders markdown documentation for one or more parsed spec files. Each spec file gets its own section with grouped input tables.

func InjectIntoReadme

func InjectIntoReadme(readmePath, section, content string) (string, error)

InjectIntoReadme reads a README file and replaces the named sf:section with the provided content. Returns the updated README text.

Types

type SpecFile

type SpecFile struct {
	Name   string      // display name (filename without extension)
	Path   string      // original file path
	Inputs []SpecInput // parsed inputs in order
}

SpecFile bundles a parsed component spec with its source filename.

func ParseSpec

func ParseSpec(path string) (*SpecFile, error)

ParseSpec reads a GitLab CI component spec YAML file and extracts inputs with group metadata from custom comments.

The parser is line-oriented (not full YAML) to preserve comment-based group metadata that standard YAML parsers discard. It understands the custom comment conventions:

# input_section_name- Group Title
# input_section_desc- Group description text

type SpecInput

type SpecInput struct {
	Name        string // input key name
	Type        string // "string", "boolean", "number", "array" (default: "string")
	Default     string // default value; empty means required
	Description string
	Required    bool   // true if no default was specified
	Group       string // from # input_section_name- comment
	GroupDesc   string // from # input_section_desc- comment
}

SpecInput represents a single input extracted from a GitLab CI component spec file, including group metadata from custom comments.

Jump to

Keyboard shortcuts

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