compat

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewGroupCommand = cobracmd.NewGroupCommand

NewGroupCommand delegates to cobracmd.NewGroupCommand for backward compatibility.

Functions

func ApplyBindings

func ApplyBindings(cmd *cobra.Command, bindings []FlagBinding)

func ApplyTransform

func ApplyTransform(value any, transform string, args map[string]any) (any, error)

ApplyTransform applies a named transform rule to a value. Supported transforms: iso8601_to_millis, csv_to_array, json_parse, enum_map.

func BuildDynamicCommands

func BuildDynamicCommands(servers []market.ServerDescriptor, runner executor.Runner, detailsByID map[string][]market.DetailTool) []*cobra.Command

BuildDynamicCommands generates cobra commands from servers.json CLIOverlay metadata. Each server with non-skip CLIOverlay gets a top-level command with groups and tool overrides translated into subcommands with proper flag bindings and transforms.

detailsByID maps CLI server ID → []DetailTool from the MCP Detail API. When provided, tool Short/Long descriptions and typed flags are enriched from Detail API data.

Conversion rules reference: docs/mcp-to-cli-conversion.md

func CollectBindings

func CollectBindings(cmd *cobra.Command, bindings []FlagBinding, existing map[string]any) (map[string]any, error)

func MoveParam

func MoveParam(params map[string]any, from, to string)

func MustString

func MustString(params map[string]any, key string) (string, error)

func NewCuratedCommand

func NewCuratedCommand(route Route, runner executor.Runner) *cobra.Command

NewCuratedCommand creates a DirectCommand with override priority so it wins over auto-generated MCP overlay commands during command tree merging.

func NewDirectCommand

func NewDirectCommand(route Route, runner executor.Runner) *cobra.Command

func NewFallbackCommands

func NewFallbackCommands(runner executor.Runner) []*cobra.Command

func NewPublicCommands

func NewPublicCommands(runner executor.Runner) []*cobra.Command

func RegisterFallback

func RegisterFallback(factory CommandFactory)

func RegisterPublic

func RegisterPublic(factory CommandFactory)

func ServerEndpoints

func ServerEndpoints(servers []market.ServerDescriptor) map[string]string

ServerEndpoints extracts product ID → endpoint URL mapping from servers.

func ServerProductIDs

func ServerProductIDs(servers []market.ServerDescriptor) map[string]bool

ServerProductIDs extracts the set of product IDs from servers with CLI metadata.

Types

type CommandFactory

type CommandFactory func(runner executor.Runner) *cobra.Command

type FlagBinding

type FlagBinding struct {
	FlagName string
	Alias    string
	Short    string
	Property string
	Kind     ValueKind
	Usage    string
	Required bool
}

type Normalizer

type Normalizer func(cmd *cobra.Command, params map[string]any) error

type Route

type Route struct {
	Use        string
	Aliases    []string
	Short      string
	Long       string
	Example    string
	Hidden     bool
	Target     Target
	Bindings   []FlagBinding
	Normalizer Normalizer
}

type Target

type Target struct {
	CanonicalProduct string
	Tool             string
}

type ValueKind

type ValueKind string
const (
	ValueString      ValueKind = "string"
	ValueInt         ValueKind = "int"
	ValueFloat       ValueKind = "float"
	ValueBool        ValueKind = "bool"
	ValueStringSlice ValueKind = "string_slice"
	ValueIntSlice    ValueKind = "int_slice"
	ValueFloatSlice  ValueKind = "float_slice"
	ValueBoolSlice   ValueKind = "bool_slice"
	ValueJSON        ValueKind = "json"
)

Jump to

Keyboard shortcuts

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