validator

package
v2.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatResult

func FormatResult(result *ValidationResult) string

FormatResult formats a validation result for display

func Resolve added in v2.4.0

func Resolve(app *cli.App, args []string) string

Resolve walks args down app's command tree and returns why they do not resolve, or "" when they do — including when the check cannot tell.

The root is always judged: cidx dispatches to a command, and urfave replaces a nil root action with the help printer at run time (which exits non-zero on an unknown topic — the 12-second failure of #239), so app.Action says nothing about whether the root accepts free arguments.

Types

type Invocation added in v2.4.0

type Invocation struct {
	File string   // workflow file the invocation was found in
	Line int      // 1-based line in that file
	Step string   // name of the step, when the workflow gives one
	Args []string // arguments passed to cidx, in order
}

Invocation is a cidx command line found in a workflow step.

func ExtractInvocations added in v2.4.0

func ExtractInvocations(script string) []Invocation

ExtractInvocations returns the cidx invocations of a shell script, with Line set to the 1-based line of the script each was found on.

func WorkflowInvocations added in v2.4.0

func WorkflowInvocations(dir string) ([]Invocation, error)

WorkflowInvocations returns every cidx invocation found in the workflow files of dir, in file then line order. A missing directory is not an error: there is simply nothing to check.

func (Invocation) String added in v2.4.0

func (i Invocation) String() string

String renders the invocation the way it would be typed.

type Job

type Job struct {
	Name  string   // Job name
	Needs []string // Dependencies (needs: [job1, job2])
	Steps []Step   // Steps in the job
}

Job represents a GitHub Actions job

type StaleInvocation added in v2.4.0

type StaleInvocation struct {
	Invocation
	Reason string
}

StaleInvocation is an invocation that no longer resolves against the CLI.

type Step

type Step struct {
	Name string // Step name
	Run  string // Command to run
}

Step represents a GitHub Actions step

type ValidationResult

type ValidationResult struct {
	Pipeline       string   // Pipeline name (e.g., "ci")
	WorkflowFile   string   // Workflow file path
	Success        bool     // Whether validation passed
	MissingInGH    []string // Phases in cidx.toml but not in GitHub workflow
	MissingInLocal []string // Phases in GitHub workflow but not in cidx.toml
	OrderMismatch  bool     // Whether phase order differs
	LocalOrder     []string // Order in cidx.toml
	GitHubOrder    []string // Order in GitHub workflow
}

ValidationResult contains the comparison result between a pipeline and workflow

func ValidateAllWorkflows

func ValidateAllWorkflows(cfg *config.Config, workflowDir string) ([]*ValidationResult, error)

ValidateAllWorkflows validates all pipelines against their corresponding workflows

func ValidateWorkflow

func ValidateWorkflow(cfg *config.Config, pipelineName string, workflowPath string) (*ValidationResult, error)

ValidateWorkflow compares a pipeline definition with a GitHub Actions workflow

type WorkflowDefinition

type WorkflowDefinition struct {
	Name   string         // Workflow name (e.g., "ci", "release")
	File   string         // Workflow file path
	Jobs   map[string]Job // Jobs defined in the workflow
	Phases []string       // Extracted phases from "cidx run <phase>" commands
}

WorkflowDefinition represents a GitHub Actions workflow

func ParseWorkflow

func ParseWorkflow(workflowPath string) (*WorkflowDefinition, error)

ParseWorkflow parses a GitHub Actions workflow file and extracts phase information

type WorkflowJobYAML

type WorkflowJobYAML struct {
	Name  string             `yaml:"name"`
	Needs interface{}        `yaml:"needs"` // Can be string or []string
	Steps []WorkflowStepYAML `yaml:"steps"`
}

WorkflowJobYAML represents a job in the workflow YAML

type WorkflowStepYAML

type WorkflowStepYAML struct {
	Name string `yaml:"name"`
	Run  string `yaml:"run"`
}

WorkflowStepYAML represents a step in a job

type WorkflowYAML

type WorkflowYAML struct {
	Name string                     `yaml:"name"`
	Jobs map[string]WorkflowJobYAML `yaml:"jobs"`
}

WorkflowYAML represents the structure of a GitHub Actions workflow file

Jump to

Keyboard shortcuts

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