Documentation
¶
Index ¶
- func Skill(ctx context.Context, v any) string
- type AdditionalArgsCompleter
- type ArgInfo
- type ArgumentCompleter
- type Cache
- func (c *Cache) Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest
- func (c *Cache) Describe(ctx context.Context) CommandInfo
- func (c *Cache) Description() string
- func (c *Cache) Execute(ctx context.Context, r *readline.Readline) error
- func (c *Cache) Help(ctx context.Context, r *readline.Readline) string
- func (c *Cache) Name() string
- func (c *Cache) Skill(ctx context.Context) string
- type CacheGet
- type CacheList
- type CacheNamespace
- type Check
- func (c *Check) Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest
- func (c *Check) Describe(ctx context.Context) CommandInfo
- func (c *Check) Description() string
- func (c *Check) Execute(ctx context.Context, r *readline.Readline) error
- func (c *Check) Help(ctx context.Context, r *readline.Readline) string
- func (c *Check) Name() string
- func (c *Check) Skill(ctx context.Context) string
- type Command
- type CommandInfo
- type Commands
- func (c Commands) Add(commands ...Command)
- func (c Commands) Get(name string) Command
- func (c Commands) Has(name string) bool
- func (c Commands) List() []Command
- func (c Commands) Load(paths ...string) error
- func (c Commands) MustAdd(command Command, err error)
- func (c Commands) TryAdd(command Command, err error) error
- type Completer
- type Describer
- type Env
- func (c *Env) Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest
- func (c *Env) Describe(ctx context.Context) CommandInfo
- func (c *Env) Description() string
- func (c *Env) Execute(ctx context.Context, r *readline.Readline) error
- func (c *Env) Help(ctx context.Context, r *readline.Readline) string
- func (c *Env) Name() string
- func (c *Env) Skill(ctx context.Context) string
- type EnvGet
- type EnvList
- type EnvVar
- type Exit
- type FlagCompleter
- type FlagInfo
- type Help
- func (c *Help) Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest
- func (c *Help) Describe(ctx context.Context) CommandInfo
- func (c *Help) Description() string
- func (c *Help) Execute(ctx context.Context, r *readline.Readline) error
- func (c *Help) Name() string
- func (c *Help) Skill(ctx context.Context) string
- func (c *Help) Validate(ctx context.Context, r *readline.Readline) error
- type Helper
- type History
- type Option
- type PassThroughFlagsCompleter
- type Shutdowner
- type Skiller
- type Validator
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AdditionalArgsCompleter ¶
type ArgumentCompleter ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) Describe ¶ added in v0.21.0
func (c *Cache) Describe(ctx context.Context) CommandInfo
Describe implements the optional Describer interface, letting `posh agent catalog` describe this command's subtree.
func (*Cache) Description ¶
type CacheGet ¶ added in v0.21.0
type CacheGet struct {
Namespace string `json:"namespace"`
Key string `json:"key"`
Value any `json:"value"`
}
CacheGet is the result of `cache get`. Value is nil when the key is unset.
type CacheList ¶ added in v0.21.0
type CacheList struct {
Namespaces []CacheNamespace `json:"namespaces"`
}
CacheList is the result of `cache list`.
type CacheNamespace ¶ added in v0.21.0
CacheNamespace is a single cache namespace and the keys it holds. Values are deliberately excluded - use `cache get` to read one.
type Check ¶ added in v0.5.4
type Check struct {
// contains filtered or unexported fields
}
func (*Check) Describe ¶ added in v0.21.0
func (c *Check) Describe(ctx context.Context) CommandInfo
Describe implements the optional Describer interface, letting `posh agent catalog` describe this command's subtree.
func (*Check) Description ¶ added in v0.5.4
type CommandInfo ¶ added in v0.21.0
type CommandInfo = tree.CommandInfo
CommandInfo describes one command for the `posh agent catalog` catalog.
func Describe ¶ added in v0.21.0
func Describe(ctx context.Context, name, description string, v any) CommandInfo
Describe builds a CommandInfo for a single command. Commands implementing the optional Describer interface describe themselves; anything else becomes a leaf carrying only its name and description.
type Describer ¶ added in v0.21.0
type Describer interface {
Describe(ctx context.Context) CommandInfo
}
Describer is an optional Command extension: a command that describes its own structure for `posh agent catalog`, so an AI coding agent gets a machine-readable answer to "what can I run" without parsing help text.
The contract is CommandInfo, not a command tree: a command is free to model its structure however it likes and stays free to change that later. Tree based commands delegate to tree.Root.Describe like any other tree method:
func (c *Cache) Describe(ctx context.Context) command.CommandInfo {
return c.tree.Describe(ctx)
}
Commands that do not implement it are still listed, just without subcommand detail.
type Env ¶ added in v0.5.0
type Env struct {
// contains filtered or unexported fields
}
func (*Env) Describe ¶ added in v0.21.0
func (c *Env) Describe(ctx context.Context) CommandInfo
Describe implements the optional Describer interface, letting `posh agent catalog` describe this command's subtree.
func (*Env) Description ¶ added in v0.5.0
type EnvList ¶ added in v0.21.0
type EnvList struct {
Values []EnvVar `json:"values"`
}
EnvList is the result of `env list`.
type EnvVar ¶ added in v0.21.0
EnvVar is a single environment variable. Value is omitted unless the listing was requested with values.
type Exit ¶
type Exit struct {
// contains filtered or unexported fields
}
func (*Exit) Description ¶
type FlagCompleter ¶
type Help ¶
type Help struct {
// contains filtered or unexported fields
}
func (*Help) Describe ¶ added in v0.21.0
func (c *Help) Describe(ctx context.Context) CommandInfo
Describe implements the optional Describer interface. Help is not tree based, so it builds its own CommandInfo - otherwise it would be listed as a bare leaf and its optional command argument would not show up at all.
func (*Help) Description ¶
type History ¶ added in v0.4.0
type History struct {
// contains filtered or unexported fields
}
func (*History) Description ¶ added in v0.4.0
type Shutdowner ¶ added in v0.17.0
type Skiller ¶ added in v0.21.0
Skiller is an optional Command extension: a command that contributes extra markdown to the generated SKILL.md, beyond the structure Describer already provides - extended instructions, worked configuration examples, links to further docs.
The contract is deliberately a free-form string rather than a struct: what is worth telling an agent varies per command, and a fixed shape would constrain that without buying anything, since the destination is markdown either way.
The returned markdown is appended verbatim under the command's heading in SKILL.md, after its arguments, flags and subcommands. Use heading level 4 (####) or deeper - level 3 is the command heading itself.
Commands that do not implement it render exactly as they did before.
type Version ¶ added in v0.21.0
type Version struct {
Version string `json:"version"`
Commit string `json:"commit,omitempty"`
BuildTime string `json:"build_time,omitempty"`
}
Version is the result of `posh version`. Commit and BuildTime are only populated at debug level, matching the fields the human output prints there.