Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDiffFound = errors.New("DiffFound")
View Source
var ErrNoDiffCommand = errors.New("NoDiffCommand")

Functions

func HelpMarkdown added in v0.13.1

func HelpMarkdown() string

HelpMarkdown returns the markdown help string.

func Usage added in v0.13.1

func Usage() string

Usage returns the CLI usage string.

Types

type Config

type Config struct {
	Context              int       `name:"context" short:"C" default:"3" usage:"diff context"`
	Separator            string    `name:"separator" short:"d" default:">" usage:"object id separator"`
	Indent               int       `name:"indent" short:"n" default:"2" usage:"yaml indent"`
	Out                  string    `name:"out" short:"o" default:"text" usage:"output format: text,yaml,id,idlist,markdown,template"`
	Debug                bool      `name:"debug" usage:"enable debug log"`
	Quiet                bool      `name:"quiet" short:"q" usage:"quiet log"`
	Color                bool      `name:"color" short:"c" usage:"colored diff"`
	DiffSuccess          bool      `name:"success" usage:"exit with 0 even if inputs differ"`
	AllowDuplicateKey    bool      `name:"allow-duplicate-key" default:"true" usage:"allow the use of keys with the same name in the same map"`
	DiffCommand          string    `name:"diff-cmd" short:"x" usage:"invoke this to get diff instead of builtin differ"`
	Verbose              bool      `name:"verbose" short:"v" usage:"enable verbose output; annotate diff type and display summary"`
	Labels               []string  `` /* 136-byte string literal not displayed */
	MarkdownHeadingLevel uint      `name:"markdown-heading" default:"1" usage:"highest heading level in markdown"`
	MarkdownTitle        string    `` /* 164-byte string literal not displayed */
	Template             string    `name:"template" short:"T" usage:"template string or file (prefix with '@') for template output mode"`
	Stdin                io.Reader `name:"-"`
	IgnoreMatchingLines  []string  `` /* 150-byte string literal not displayed */
	IgnoreFields         []string  `` /* 150-byte string literal not displayed */
	IgnoreLabels         []string  `` /* 132-byte string literal not displayed */
	IgnoreAnnotations    []string  `` /* 142-byte string literal not displayed */
	IgnoreManagedFields  bool      `name:"ignore-managed-fields" short:"m" usage:"ignore metadata.managedFields"`
	IgnoreStatus         bool      `name:"ignore-status" short:"s" usage:"ignore status field"`
	MCP                  bool      `name:"mcp" usage:"start MCP server over stdio"`
}

func (*Config) Clone added in v0.19.0

func (c *Config) Clone() *Config

Clone returns a deep copy of the Config with independent slices. Note: Stdin (io.Reader) is shallow-copied because stream readers maintain internal state. In MCP server mode, Stdin is not consumed because inputs are loaded via openInput.

func (*Config) NewMCPServer added in v0.15.0

func (c *Config) NewMCPServer() *mcp.Server

NewMCPServer creates and returns a configured MCP Server for objdiff.

func (*Config) OutMode

func (c *Config) OutMode() OutMode

func (*Config) Run

func (c *Config) Run(w io.Writer, left, right string) error

func (*Config) RunMCP added in v0.15.0

func (c *Config) RunMCP(ctx context.Context) error

RunMCP starts the MCP server over stdio.

type DiffStats added in v0.17.0

type DiffStats struct {
	Add, Change, Destroy int
}

DiffStats holds counts of each diff type.

type DiffToolParams added in v0.15.0

type DiffToolParams struct {
	Left                 string   `json:"left" jsonschema:"left manifest YAML content or file path"`
	Right                string   `json:"right" jsonschema:"right manifest YAML content or file path"`
	Out                  string   `json:"out,omitempty" jsonschema:"output format: text, yaml, id, idlist, markdown, template (default: text)"`
	Context              *int     `json:"context,omitempty" jsonschema:"number of diff context lines (default: 3)"`
	Separator            string   `json:"separator,omitempty" jsonschema:"object id separator (default: >)"`
	Indent               *int     `json:"indent,omitempty" jsonschema:"yaml indent (default: 2)"`
	Verbose              bool     `json:"verbose,omitempty" jsonschema:"enable verbose output; annotate diff type and display summary"`
	MarkdownHeadingLevel *uint    `json:"markdownHeadingLevel,omitempty" jsonschema:"highest heading level in markdown (default: 1)"`
	MarkdownTitle        string   `` /* 146-byte string literal not displayed */
	Template             string   `json:"template,omitempty" jsonschema:"template string or file path (prefix with '@') for template output mode"`
	IgnoreMatchingLines  []string `json:"ignoreMatchingLines,omitempty" jsonschema:"ignore lines matching regexp"`
	IgnoreFields         []string `json:"ignoreFields,omitempty" jsonschema:"ignore field by path or yq expression"`
	IgnoreLabels         []string `json:"ignoreLabels,omitempty" jsonschema:"ignore label by key"`
	IgnoreAnnotations    []string `json:"ignoreAnnotations,omitempty" jsonschema:"ignore annotation by key"`
	IgnoreManagedFields  bool     `json:"ignoreManagedFields,omitempty" jsonschema:"ignore metadata.managedFields"`
	IgnoreStatus         bool     `json:"ignoreStatus,omitempty" jsonschema:"ignore status field"`
}

DiffToolParams defines the input parameters for the diff_k8s_manifests tool.

type DiffToolResult added in v0.15.0

type DiffToolResult struct {
	Diff    string `json:"diff" jsonschema:"the formatted diff output"`
	HasDiff bool   `json:"hasDiff" jsonschema:"true if differences were found"`
}

DiffToolResult defines the output of the diff_k8s_manifests tool.

type OutMode

type OutMode string
const (
	OutModeUnknown  OutMode = "unknown"
	OutModeText     OutMode = "text"
	OutModeYaml     OutMode = "yaml"
	OutModeID       OutMode = "id"
	OutModeIDList   OutMode = "idlist"
	OutModeMarkdown OutMode = "markdown"
	OutModeTemplate OutMode = "template"
)

type TemplateData added in v0.18.0

type TemplateData struct {
	Left    string
	Right   string
	HasDiff bool
	Stats   DiffStats
	Diffs   []*TemplateDiffItem
}

TemplateData is the root data passed to custom templates in template mode.

type TemplateDiffItem added in v0.18.0

type TemplateDiffItem struct {
	ID       string
	Diff     string
	DiffType string
	Left     *internal.Object
	Right    *internal.Object
}

TemplateDiffItem represents a diff of an object for templates.

Jump to

Keyboard shortcuts

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