cmd

package
v0.1.0-rc2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cmd implements the CLI subcommands.

Commands are designed to be embeddable: smithy-cli embeds Commands directly into its own root CLI so that `smithy agent <subcommand>` routes to the same code paths as `agentsmithy <subcommand>`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseLogLevel

func ParseLogLevel(l LogLevel) slog.Level

ParseLogLevel maps the CLI log-level flag to slog.Level.

Types

type CLI

type CLI struct {
	LogLevel LogLevel `help:"Log level (one of: ${enum})." default:"info" enum:"debug,info,warn,error" short:"l"`
	Commands
}

CLI is the root Kong CLI struct for the standalone agentsmithy binary.

type Commands

type Commands struct {
	Serve    ServeCmd    `cmd:"" help:"Start the agent server."`
	Validate ValidateCmd `cmd:"" help:"Validate config file."`
	Setup    SetupCmd    `cmd:"" help:"Start the config-authoring MCP assistant."`
}

Commands holds the subcommands, safe to embed into a host CLI.

type ConfigFlag

type ConfigFlag struct {
	Config string `help:"Path to config." default:".agentsmithy.yaml" type:"path" short:"c"`
}

ConfigFlag is the standard config-path mixin for subcommands that load an .agentsmithy.yaml file.

type LogLevel

type LogLevel string

LogLevel represents a supported log verbosity level.

const (
	LogLevelDebug LogLevel = "debug"
	LogLevelInfo  LogLevel = "info"
	LogLevelWarn  LogLevel = "warn"
	LogLevelError LogLevel = "error"
)

type ServeCmd

type ServeCmd struct {
	ConfigFlag
	Transport string `help:"Transport to use (one of: ${enum})." enum:"a2a,stdio,mcp-stdio,mcp-http,none" default:"a2a"`
	Addr      string `help:"Listen address (HTTP-like transports)." default:":8080"`
	Watch     bool   `help:"Watch config file and hot-reload on change." default:"false"`
	Once      string `help:"(stdio only) Send a single prompt, print the reply, then exit." short:"o"`
	Verbose   bool   `help:"(stdio only) Print tool calls and intermediate steps." short:"v"`
}

ServeCmd starts the agent server.

`--transport` selects the wire protocol:

  • a2a (default): A2A JSON-RPC server over HTTP.
  • stdio: line REPL over stdin/stdout for dev/CI use.
  • mcp-stdio: expose the agent as an MCP tool over stdin/stdout. This is the path VS Code, Claude Desktop, etc. spawn. Required for `provider: borrowed`, which round-trips completions back to the connecting client via sampling/createMessage.
  • mcp-http: same MCP surface over streamable HTTP.

func (*ServeCmd) Run

func (cmd *ServeCmd) Run(ctx context.Context) error

Run executes the serve command.

type SetupCmd

type SetupCmd struct{}

SetupCmd starts an MCP server for config-authoring sessions. It does not require an existing .agentsmithy.yaml.

func (*SetupCmd) Run

func (s *SetupCmd) Run(ctx context.Context) error

Run starts the setup MCP server on stdio.

type ValidateCmd

type ValidateCmd struct {
	ConfigFlag
}

ValidateCmd validates the config file.

func (*ValidateCmd) Run

func (cmd *ValidateCmd) Run(ctx context.Context) error

Run executes validate.

Jump to

Keyboard shortcuts

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