cli

package
v0.0.0-...-34a72f7 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var As = errors.As

Functions

func ApplyProfileToFlags

func ApplyProfileToFlags(cmd *cobra.Command, profile *Profile) error

ApplyProfileToFlags overlays profile values onto flags that the user has not set explicitly on the command line. Used from root.go's PersistentPreRunE so profile values feed the whole command tree.

func Deliver

func Deliver(sink DeliverSink, body []byte, compact bool) error

Deliver routes a captured output buffer to the configured sink. stdout is a no-op because the buffer has already been streamed to stdout via the MultiWriter set up in root.go.

func Execute

func Execute() error

Execute runs the CLI in non-interactive mode: never prompts, all values via flags or stdin.

func ExitCode

func ExitCode(err error) int

func FeedbackEndpointConfigured

func FeedbackEndpointConfigured() bool

FeedbackEndpointConfigured reports whether an upstream feedback URL is available. Surfaced via agent-context so introspecting agents know whether their feedback will ship upstream.

func ListProfileNames

func ListProfileNames() []string

ListProfileNames returns profile names sorted alphabetically. Used by the agent-context subcommand to expose available_profiles at runtime.

func RootCmd

func RootCmd() *cobra.Command

RootCmd returns the Cobra command tree without executing it. The MCP server uses this to mirror every user-facing command as an agent tool.

Types

type DataProvenance

type DataProvenance struct {
	Source       string     `json:"source"`                  // "live" or "local"
	SyncedAt     *time.Time `json:"synced_at,omitempty"`     // when local data was last synced
	Reason       string     `json:"reason,omitempty"`        // why local was used: "user_requested", "api_unreachable", "no_search_endpoint"
	ResourceType string     `json:"resource_type,omitempty"` // which resource type was queried
	Freshness    any        `json:"freshness,omitempty"`     // optional machine-owned freshness metadata for covered command paths
}

DataProvenance describes where data came from and when it was last synced.

type DeliverSink

type DeliverSink struct {
	Scheme string
	Target string
}

DeliverSink describes where command output should be routed when --deliver is set. Parsed from the sink specifier "scheme:target".

func ParseDeliverSink

func ParseDeliverSink(spec string) (DeliverSink, error)

ParseDeliverSink parses a --deliver value. Supported schemes:

stdout          -> default, no redirection
file:<path>     -> write output atomically to <path>
webhook:<url>   -> POST output body to <url>

Returns an error for unknown schemes with a message naming the supported set, so agents see a structured refusal rather than a silent misroute.

type FeedbackEntry

type FeedbackEntry struct {
	Text      string    `json:"text"`
	CLI       string    `json:"cli"`
	Version   string    `json:"version"`
	AgentID   string    `json:"agent_id,omitempty"`
	Timestamp time.Time `json:"timestamp"`
}

FeedbackEntry is one line in the local feedback ledger. Every run of the feedback command appends one entry; upstream POST is a separate, optional step.

type Profile

type Profile struct {
	Name        string            `json:"name"`
	Description string            `json:"description,omitempty"`
	Values      map[string]string `json:"values"`
}

Profile is a named set of flag values saved for reuse across invocations. HeyGen's "Beacon" pattern: one named context that a scheduled agent reuses day after day with the same voice/format but different input each run.

func GetProfile

func GetProfile(name string) (*Profile, error)

GetProfile returns a profile by name, or (nil, nil) if not found.

Jump to

Keyboard shortcuts

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