cmds

package
v0.4.19 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: MIT Imports: 35 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCobraCommandWithGeppettoMiddlewares

func BuildCobraCommandWithGeppettoMiddlewares(
	cmd cmds.Command,
	options ...cli.CobraParserOption,
) (*cobra.Command, error)

func CreateGeppettoLayers

func CreateGeppettoLayers(stepSettings *settings.StepSettings, opts ...GeppettoLayerOption) ([]layers.ParameterLayer, error)

func GetCobraCommandGeppettoMiddlewares

func GetCobraCommandGeppettoMiddlewares(
	commandSettings *cli.GlazedCommandSettings,
	cmd *cobra.Command,
	args []string,
) ([]middlewares.Middleware, error)

func LoadConfig

func LoadConfig() (*settings.StepSettings, error)

func LoadConfigFromSettings

func LoadConfigFromSettings(settings_ cli.GlazedCommandSettings) (*settings.StepSettings, error)

LoadConfigFromSettings loads the geppetto step settings from the given profile and config file.

func LoadFromYAML added in v0.4.17

func LoadFromYAML(b []byte) ([]cmds.Command, error)

Types

type GeppettoLayerOption added in v0.4.19

type GeppettoLayerOption func(*geppettoLayerOptions)

func WithHelpersLayer added in v0.4.19

func WithHelpersLayer() GeppettoLayerOption

type PinocchioCommand added in v0.4.17

type PinocchioCommand struct {
	*glazedcmds.CommandDescription `yaml:",inline"`
	Prompt                         string                  `yaml:"prompt,omitempty"`
	Messages                       []*conversation.Message `yaml:"messages,omitempty"`
	SystemPrompt                   string                  `yaml:"system-prompt,omitempty"`
}

func NewPinocchioCommand added in v0.4.17

func NewPinocchioCommand(
	description *glazedcmds.CommandDescription,
	options ...PinocchioCommandOption,
) (*PinocchioCommand, error)

func (*PinocchioCommand) CreateConversationManager added in v0.4.17

func (g *PinocchioCommand) CreateConversationManager(
	variables map[string]interface{},
	options ...builder.ConversationManagerOption,
) (conversation.Manager, error)

CreateConversationManager creates a new conversation manager with the given settings

func (*PinocchioCommand) RunIntoWriter added in v0.4.17

func (g *PinocchioCommand) RunIntoWriter(
	ctx context.Context,
	parsedLayers *layers.ParsedLayers,
	w io.Writer,
) error

RunIntoWriter runs the command and writes the output into the given writer.

func (*PinocchioCommand) RunWithOptions added in v0.4.17

func (g *PinocchioCommand) RunWithOptions(ctx context.Context, options ...run.RunOption) ([]*conversation.Message, error)

RunWithOptions executes the command with the given options

type PinocchioCommandDescription added in v0.4.17

type PinocchioCommandDescription struct {
	Name      string                            `yaml:"name"`
	Short     string                            `yaml:"short"`
	Long      string                            `yaml:"long,omitempty"`
	Flags     []*parameters.ParameterDefinition `yaml:"flags,omitempty"`
	Arguments []*parameters.ParameterDefinition `yaml:"arguments,omitempty"`
	Layers    []layers.ParameterLayer           `yaml:"layers,omitempty"`

	Prompt       string                  `yaml:"prompt,omitempty"`
	Messages     []*conversation.Message `yaml:"messages,omitempty"`
	SystemPrompt string                  `yaml:"system-prompt,omitempty"`
}

type PinocchioCommandLoader added in v0.4.17

type PinocchioCommandLoader struct {
}

func (*PinocchioCommandLoader) IsFileSupported added in v0.4.17

func (g *PinocchioCommandLoader) IsFileSupported(f fs.FS, fileName string) bool

func (*PinocchioCommandLoader) LoadCommands added in v0.4.17

func (scl *PinocchioCommandLoader) LoadCommands(
	f fs.FS, entryName string,
	options []cmds.CommandDescriptionOption,
	aliasOptions []alias.Option,
) ([]cmds.Command, error)

type PinocchioCommandOption added in v0.4.17

type PinocchioCommandOption func(*PinocchioCommand)

func WithMessages

func WithMessages(messages []*conversation.Message) PinocchioCommandOption

func WithPrompt

func WithPrompt(prompt string) PinocchioCommandOption

func WithSystemPrompt

func WithSystemPrompt(systemPrompt string) PinocchioCommandOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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