cilint

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cilint implements MCP tool handlers for GitLab CI/CD configuration linting. It supports validating a project's existing .gitlab-ci.yml and arbitrary YAML content via the CI Lint API.

markdown.go provides Markdown formatting functions for CI lint MCP tool output.

register.go wires cilint MCP tools to the MCP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatOutputMarkdown

func FormatOutputMarkdown(v Output) string

FormatOutputMarkdown renders a CI lint result as Markdown.

func RegisterTools

func RegisterTools(server *mcp.Server, client *gitlabclient.Client)

RegisterTools registers all CI lint MCP tools on the given server.

Types

type ContentInput

type ContentInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path (namespace context),required"`
	Content     string               `json:"content" jsonschema:"CI/CD YAML content to validate,required"`
	DryRun      *bool                `json:"dry_run" jsonschema:"Run pipeline creation simulation"`
	IncludeJobs *bool                `json:"include_jobs" jsonschema:"Include expanded job list in the response"`
	Ref         string               `json:"ref" jsonschema:"Branch or tag to use for CI includes resolution"`
}

ContentInput holds parameters for linting arbitrary CI/CD YAML within a project namespace.

type Include

type Include struct {
	Type           string `json:"type"`
	Location       string `json:"location"`
	ContextProject string `json:"context_project,omitempty"`
}

Include represents an include block found in the CI configuration.

type Output

type Output struct {
	toolutil.HintableOutput
	Valid      bool      `json:"valid"`
	Errors     []string  `json:"errors,omitempty"`
	Warnings   []string  `json:"warnings,omitempty"`
	MergedYaml string    `json:"merged_yaml,omitempty"`
	Includes   []Include `json:"includes,omitempty"`
}

Output represents the result of a CI lint operation.

func LintContent

func LintContent(ctx context.Context, client *gitlabclient.Client, input ContentInput) (Output, error)

LintContent validates content for the cilint package.

func LintProject

func LintProject(ctx context.Context, client *gitlabclient.Client, input ProjectInput) (Output, error)

LintProject validates project for the cilint package.

type ProjectInput

type ProjectInput struct {
	ProjectID   toolutil.StringOrInt `json:"project_id" jsonschema:"Project ID or URL-encoded path,required"`
	ContentRef  string               `json:"content_ref" jsonschema:"Branch or tag to use for the CI configuration content"`
	DryRun      *bool                `json:"dry_run" jsonschema:"Run pipeline creation simulation"`
	DryRunRef   string               `json:"dry_run_ref" jsonschema:"Branch or tag to use as context for the dry run"`
	IncludeJobs *bool                `json:"include_jobs" jsonschema:"Include expanded job list in the response"`
	Ref         string               `json:"ref" jsonschema:"Branch or tag to use for CI includes resolution"`
}

ProjectInput holds parameters for linting a project's CI/CD configuration.

Jump to

Keyboard shortcuts

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