Documentation
¶
Overview ¶
Package cli is the gskill command-line view. It parses commands with Kong, renders human or JSON output through a shared harness, and translates errors into process exit codes. It depends only on the app service layer.
Index ¶
- func DocsModel() (*kong.Application, error)
- func ListJSON(skills []app.ListedSkill) map[string]any
- func Run(ctx context.Context, args []string, stdout, stderr io.Writer, ...) int
- type Globals
- type Output
- func (o *Output) Confirm(prompt string, assumeYes bool) bool
- func (o *Output) Diag(format string, args ...any)
- func (o *Output) ErrDiag(format string, args ...any)
- func (o *Output) Hint(format string, args ...any)
- func (o *Output) Info(format string, args ...any)
- func (o *Output) Interactive() bool
- func (o *Output) JSON() bool
- func (o *Output) Result(human string, v any) error
- func (o *Output) Warn(format string, args ...any)
- type OutputOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DocsModel ¶
func DocsModel() (*kong.Application, error)
DocsModel builds the Kong model for the gskill grammar without parsing arguments or exiting. It mirrors the parser constructed in Run, so generated reference documentation always reflects the real command surface. It exists solely for the reference generator (cmd/gen-reference) and changes nothing about the shipped CLI behavior.
func ListJSON ¶
func ListJSON(skills []app.ListedSkill) map[string]any
ListJSON builds the stable --json object for a list result. `agents` keeps its existing shape (plain agent-ID strings); `active`, `agent_health`, `commit`, and `content_hash` are additive fields carrying what `gskill status --json` used to report on its own (spec 013 FR-005, clarification Q2).
Types ¶
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Output renders primary results to stdout and diagnostics to stderr, keeping the two channels separate so --json stdout stays machine-parseable (FR-035, FR-036).
func NewOutput ¶
func NewOutput(stdout, stderr io.Writer, opts OutputOptions) *Output
NewOutput builds an Output. Interactive is forced off when stdout is not a TTY, so non-interactive (CI-safe) behavior is the default outside a terminal.
func (*Output) Confirm ¶ added in v0.2.0
Confirm prompts on stderr for a yes/no answer read from stdin, defaulting to No. It returns true without prompting when assumeYes is set or the session is non-interactive, so unattended and CI runs never block (FR-012).
func (*Output) ErrDiag ¶ added in v0.3.0
ErrDiag writes an error-severity diagnostic to stderr, red on an interactive terminal. Unlike a command's returned error (which Run maps to an exit code), this is for error-severity lines a command reports without failing the whole run — and for Run's own error-reporting lines.
func (*Output) Hint ¶ added in v0.3.0
Hint writes a dimmed, actionable follow-up line to stderr — the arrow-prefixed suggestion shown after an error (e.g. "→ run 'gskill doctor'").
func (*Output) Info ¶ added in v0.3.0
Info writes a neutral diagnostic to stderr, dimmed on an interactive terminal.
func (*Output) Interactive ¶
Interactive reports whether interactive UI (prompts, colors) is enabled.