Documentation
¶
Index ¶
- func Skill(ctx context.Context, v any, name string) 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, name string) 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, name string) 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, name string) 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) Validate(ctx context.Context, r *readline.Readline) error
- type Helper
- type History
- type Option
- type PassThroughFlagsCompleter
- type Shutdowner
- type SkillMetadata
- type SkillMetadataer
- 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 SkillMetadata ¶ added in v0.22.0
type SkillMetadata struct {
// Name defaults to "posh" for the root skill, "posh-<command>" for a
// command's own.
Name string `yaml:"name"`
// Description defaults to a generic one. A description naming concrete
// triggering conditions is what makes the skill load at all.
Description string `yaml:"description"`
// AllowedTools are granted without a permission prompt for the turn that
// invokes the skill, e.g. "Bash(posh execute:*)".
AllowedTools []string `yaml:"allowed-tools,omitempty"`
}
SkillMetadata is the frontmatter of a generated SKILL.md.
The fields are restricted to the Agent Skills spec allowlist (https://agentskills.io) so a generated skill stays valid if it is ever uploaded to claude.ai or the Skills API, both of which reject unknown keys.
func SkillMetadataOf ¶ added in v0.22.0
func SkillMetadataOf(ctx context.Context, v any, name string) SkillMetadata
SkillMetadataOf returns the skill frontmatter v supplies for name, or the zero value - which renders the derived defaults - when it does not implement SkillMetadataer.
type SkillMetadataer ¶ added in v0.22.0
type SkillMetadataer interface {
SkillMetadata(ctx context.Context, name string) SkillMetadata
}
SkillMetadataer is an optional Command extension supplying the frontmatter of that command's own generated skill.
Unset fields fall back to values derived from the command: the name to "posh-<name>", the description to a generic "Use when running ..." line. The description is the only thing an agent runtime sees when deciding whether to load a skill at all, so a generic one effectively means the skill never triggers - name the conditions that should reach for this command.
name is the registered command name, as for Skiller.
type Skiller ¶ added in v0.21.0
Skiller is an optional Command extension: a command that contributes extra markdown to its 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.
name is the command name the contribution is rendered under, which is not necessarily the command's default one: the same provider can be registered under another name. Write the prose against name rather than hardcoding a literal, or the generated skill tells an agent to run a command that does not exist in this project.
The returned markdown is appended verbatim under the command's heading. Use heading level 4 (####) or deeper - level 3 is the command heading itself.
Commands that do not implement it render as just their paths and descriptions.
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.