cli

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 37 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cli implements the ki commands. cmd/ki only wires it to the process: standard streams, environment, signal context and exit code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// Stdin is read by the hidden `ki skill guard` and `ki session guard`; nil means os.Stdin.
	Stdin   io.Reader
	Stdout  io.Writer
	Stderr  io.Writer
	Getenv  func(string) string
	Version string
	// GOOS selects the platform-specific service integration; empty uses runtime.GOOS.
	GOOS string
	// Exec replaces the process with the agent; tests substitute a recorder.
	Exec func(bin string, argv, env []string) error
	// Environ is the environment the agent inherits.
	Environ func() []string
	// Data replaces the agent instructions and skills embedded in the binary
	// (agent/, skills/); nil means the embedded copy.
	Data fs.FS
	// Dir is where ki looks for the current repo; empty means the process's directory.
	Dir string
	// Executable is this ki binary, handed to agents so they can start
	// `ki vault mcp`; nil means os.Executable.
	Executable func() (string, error)
	// Tmux runs tmux for `ki mecca`; nil means the tmux on PATH.
	Tmux Tmux
	// GitHubToken returns an account's token; nil means gh's stored one.
	GitHubToken func(ctx context.Context, user string) string
	// GitHubAPI is the REST and GraphQL base URL; empty means api.github.com.
	GitHubAPI string
	// GitHubHTTP optionally replaces the bounded HTTP client for GitHub requests.
	GitHubHTTP *http.Client
	// StallAfter is how long a streaming delegate worker may be silent before ki
	// warns; zero means five minutes.
	StallAfter time.Duration
	// ResultGrace is how long a streaming worker may run on after its final
	// result before ki ends it; zero means a minute.
	ResultGrace time.Duration
	// EventClock is the clock the stall and linger checks of a streaming worker
	// read; nil means time.Now.
	EventClock func() time.Time
	// Notify shows a desktop notification when a job stalls and the machine asks
	// for one; nil means osascript on macOS and nothing elsewhere.
	Notify func(title, body string)
	// ClaudeMCPList returns `claude mcp list`'s output for `ki mcp ls`; nil means the claude on PATH.
	ClaudeMCPList func(ctx context.Context) (string, error)
	// GH runs gh for `ki approve` as one account (its token in GH_TOKEN); nil means the gh on PATH.
	GH ghRun
	// Now is the clock provider picks and the queue read; nil means time.Now.
	Now func() time.Time
	// StartQueued hands a queued job to a ki process; nil means a detached `ki queue start <job>`.
	StartQueued func(ctx context.Context, e ki.QueueEntry) error
	// contains filtered or unexported fields
}

App holds everything a command touches outside its arguments, so tests can run commands against temporary directories and fake environments.

func New

func New(stdout, stderr io.Writer, version string) *App

New returns an App bound to this process.

func (*App) Run

func (a *App) Run(ctx context.Context, args []string) error

Run dispatches one ki command.

type Tmux

type Tmux func(ctx context.Context, args ...string) (string, error)

Tmux runs one tmux command (several when separated by ";") and returns its stdout.

type UserError

type UserError struct{ Msg string }

UserError is a problem the user has to fix; printed without noise.

func (UserError) Error

func (e UserError) Error() string

type VaultListInput

type VaultListInput struct {
	Folder string `json:"folder,omitempty" jsonschema:"vault-relative folder, e.g. projects/acme; empty for the root"`
}

VaultListInput is the vault_list tool input.

type VaultReadInput

type VaultReadInput struct {
	Title string `json:"title" jsonschema:"note name without .md"`
}

VaultReadInput is the vault_read tool input.

type VaultSearchInput

type VaultSearchInput struct {
	Query string `json:"query"`
	Limit int    `json:"limit,omitempty" jsonschema:"max notes, default 20"`
}

VaultSearchInput is the vault_search tool input.

type VaultWriteInput

type VaultWriteInput struct {
	Area      string `json:"area" jsonschema:"projects, engineering, reference, writing or ideas"`
	Project   string `json:"project,omitempty" jsonschema:"folder under projects/, e.g. acme; required with area projects"`
	Kind      string `` /* 138-byte string literal not displayed */
	Title     string `json:"title" jsonschema:"note name in Title Case, without a date prefix or .md"`
	Body      string `json:"body" jsonschema:"markdown body without frontmatter or an H1; wikilinks [[Note Name]] are fine"`
	Overwrite bool   `json:"overwrite,omitempty" jsonschema:"replace an existing note of this name at the same place"`
}

VaultWriteInput is the vault_write tool input.

Jump to

Keyboard shortcuts

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