cli

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandResponseSchema = GenerateSchema[Command]()
View Source
var ExtractCommandPrompt = `` /* 580-byte string literal not displayed */
View Source
var ExtractSubCommandsPrompt = `` /* 329-byte string literal not displayed */
View Source
var IsSubCommandPrompt = `` /* 2261-byte string literal not displayed */
View Source
var IsSubCommandResponseSchema = GenerateSchema[IsSubCommand]()

RunCommand is the public interface that uses the current CommandRunner

View Source
var SubCommandsResponseSchema = GenerateSchema[SubCommands]()

Functions

func ConvertCommandsToMCPFile

func ConvertCommandsToMCPFile(commandItems *[]CommandItem) (*mcpserver.MCPServer, error)

func DetectSubCommand

func DetectSubCommand(cliCommand string) (bool, error)

func ExtractCLICommandInfo

func ExtractCLICommandInfo(cliCommand string, commandItems *[]CommandItem) (bool, error)

func ExtractSubCommands

func ExtractSubCommands(cliCommand string) ([]string, error)

func GenerateSchema

func GenerateSchema[T any]() interface{}

func NewOpenAIClient

func NewOpenAIClient() (openai.Client, error)

func RunInference

func RunInference(
	system_prompt string,
	user_prompt string,
) (string, error)

Types

type Argument

type Argument struct {
	Name     string `json:"name"`
	Optional bool   `json:"optional"`
}

type Command

type Command struct {
	Description string     `json:"description"`
	Arguments   []Argument `json:"arguments"`
	Options     []Option   `json:"options"`
}

type CommandItem

type CommandItem struct {
	Command string  `json:"command"`
	Data    Command `json:"data"`
}

func ExtractCommand

func ExtractCommand(cliCommand string) (CommandItem, error)

type CommandRunner

type CommandRunner func(string) (string, error)

CommandRunner is a function type for running commands

var DefaultCommandRunner CommandRunner = runCommandImpl

DefaultCommandRunner is the default implementation that actually executes commands

type IsSubCommand

type IsSubCommand struct {
	Bool_Value bool `json:"bool_value"`
}

type Option

type Option struct {
	Flag        string `json:"flag"`
	Description string `json:"description"`
	Type        string `json:"type"`
}

type SubCommands

type SubCommands struct {
	Commands []string `json:"commands"`
}

Jump to

Keyboard shortcuts

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