cli

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const SchemaVersion = 1

Variables

This section is empty.

Functions

func Execute

func Execute(ctx context.Context, args []string, stdout, stderr io.Writer, factory RegistryFactory) error

func ExitStatus

func ExitStatus(err error) (int, bool)

func IsCommand

func IsCommand(value string) bool

func ParseDirList added in v0.3.0

func ParseDirList(value string) []string

func ResolveDirs added in v0.3.0

func ResolveDirs(explicit []string, environment string) []string

func ValidateAgentDirs added in v0.3.0

func ValidateAgentDirs(agent string, claudeDirs, codexDirs []string) error

Types

type Compact

type Compact struct {
	Trigger    string `json:"trigger"`
	PostTokens int64  `json:"post_tokens"`
}

type Cost

type Cost struct {
	USD            float64  `json:"usd"`
	Complete       bool     `json:"complete"`
	Estimated      bool     `json:"estimated"`
	MissingPricing []string `json:"missing_pricing"`
}

type DirList added in v0.3.0

type DirList []string

func (*DirList) Set added in v0.3.0

func (d *DirList) Set(value string) error

func (*DirList) String added in v0.3.0

func (d *DirList) String() string

type ErrorCandidate

type ErrorCandidate struct {
	Ref       string `json:"ref"`
	Agent     string `json:"agent"`
	Project   string `json:"project"`
	Title     string `json:"title"`
	UpdatedAt string `json:"updated_at"`
}

type ErrorDetail

type ErrorDetail struct {
	Code       string           `json:"code"`
	Message    string           `json:"message"`
	Candidates []ErrorCandidate `json:"candidates,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	SchemaVersion int         `json:"schema_version"`
	Error         ErrorDetail `json:"error"`
}

type Event

type Event struct {
	Index       int          `json:"index"`
	Timestamp   string       `json:"timestamp"`
	Kind        string       `json:"kind"`
	Text        string       `json:"text"`
	Model       string       `json:"model"`
	Tool        *EventTool   `json:"tool,omitempty"`
	Usage       *EventUsage  `json:"usage,omitempty"`
	Cost        *EventCost   `json:"cost,omitempty"`
	Truncated   []string     `json:"truncated"`
	Record      *EventRecord `json:"record,omitempty"`
	Harness     bool         `json:"harness,omitempty"`
	SubagentRef string       `json:"subagent_ref,omitempty"`
	Compact     *Compact     `json:"compact,omitempty"`
}

type EventCost

type EventCost struct {
	USD       float64 `json:"usd"`
	Complete  bool    `json:"complete"`
	Estimated bool    `json:"estimated"`
}

type EventRecord

type EventRecord struct {
	Path   string `json:"path"`
	Offset int64  `json:"offset"`
	Length int64  `json:"length"`
}

type EventTool

type EventTool struct {
	Name       string `json:"name"`
	CallID     string `json:"call_id"`
	Summary    string `json:"summary"`
	Input      string `json:"input"`
	Diff       string `json:"diff"`
	Output     string `json:"output"`
	DurationMS int64  `json:"duration_ms"`
}

type EventUsage

type EventUsage struct {
	UncachedInput int64 `json:"uncached_input"`
	Output        int64 `json:"output"`
	CacheWrite    int64 `json:"cache_write"`
	CacheRead     int64 `json:"cache_read"`
	Flow          int64 `json:"flow"`
	Context       int64 `json:"context"`
}

type ExitError

type ExitError struct {
	Status int
	Detail ErrorDetail
}

func (*ExitError) Error

func (e *ExitError) Error() string

type HitEvent

type HitEvent struct {
	Index     int    `json:"index"`
	Timestamp string `json:"timestamp"`
	Kind      string `json:"kind"`
	Tool      string `json:"tool"`
}

type HitSession

type HitSession struct {
	Ref       string `json:"ref"`
	Agent     string `json:"agent"`
	Project   string `json:"project"`
	Title     string `json:"title"`
	UpdatedAt string `json:"updated_at"`
}

type ListPage

type ListPage struct {
	Offset     int  `json:"offset"`
	Limit      int  `json:"limit"`
	Returned   int  `json:"returned"`
	Total      int  `json:"total"`
	HasMore    bool `json:"has_more"`
	NextOffset int  `json:"next_offset"`
}

type ListResponse

type ListResponse struct {
	SchemaVersion int       `json:"schema_version"`
	Command       string    `json:"command"`
	Sessions      []Session `json:"sessions"`
	Page          ListPage  `json:"page"`
	Warnings      []Warning `json:"warnings"`
}

type Options

type Options struct {
	Offline       bool
	RefreshPrices bool
	Agent         string
	ClaudeDirs    []string
	CodexDirs     []string
}

type RawRecord

type RawRecord struct {
	Index   int    `json:"index"`
	Path    string `json:"path"`
	Offset  int64  `json:"offset"`
	Length  int64  `json:"length"`
	RawJSON string `json:"raw_json"`
}

type RawResponse

type RawResponse struct {
	SchemaVersion int       `json:"schema_version"`
	Command       string    `json:"command"`
	RawRecord     RawRecord `json:"raw_record"`
	Warnings      []Warning `json:"warnings"`
}

type Registry

type Registry interface {
	DiscoverWithDiagnostics(context.Context) ([]*model.Session, []source.DiscoveryDiagnostic, error)
	LoadDetail(context.Context, *model.Session) error
}

type RegistryFactory

type RegistryFactory func(context.Context, Options) (Registry, error)

type ScopedCost

type ScopedCost struct {
	Self        Cost `json:"self"`
	Descendants Cost `json:"descendants"`
	Total       Cost `json:"total"`
}

type ScopedTokens

type ScopedTokens struct {
	Self        TokenTotals `json:"self"`
	Descendants TokenTotals `json:"descendants"`
	Total       TokenTotals `json:"total"`
}

type SearchHit

type SearchHit struct {
	Session HitSession `json:"session"`
	Event   HitEvent   `json:"event"`
	Field   string     `json:"field"`
	Range   [2]int     `json:"range"`
	Snippet string     `json:"snippet"`
	Matches int        `json:"matches"`
}

type SearchPage

type SearchPage struct {
	Offset          int  `json:"offset"`
	Limit           int  `json:"limit"`
	Returned        int  `json:"returned"`
	HasMore         bool `json:"has_more"`
	NextOffset      int  `json:"next_offset"`
	Complete        bool `json:"complete"`
	Total           *int `json:"total,omitempty"`
	SessionsScanned int  `json:"sessions_scanned"`
	SessionsMatched int  `json:"sessions_matched"`
}

type SearchResponse

type SearchResponse struct {
	SchemaVersion int         `json:"schema_version"`
	Command       string      `json:"command"`
	Hits          []SearchHit `json:"hits"`
	Page          SearchPage  `json:"page"`
	Warnings      []Warning   `json:"warnings"`
}

type Session

type Session struct {
	Ref       string      `json:"ref"`
	Agent     string      `json:"agent"`
	Project   string      `json:"project"`
	CWD       string      `json:"cwd"`
	Title     string      `json:"title"`
	GitBranch string      `json:"git_branch"`
	Models    []string    `json:"models"`
	StartedAt string      `json:"started_at"`
	UpdatedAt string      `json:"updated_at"`
	Messages  int         `json:"messages"`
	Subagents int         `json:"subagents"`
	HasError  bool        `json:"has_error"`
	Tokens    TokenTotals `json:"tokens"`
	Cost      Cost        `json:"cost"`
	Path      string      `json:"path"`
}

type ShowPage

type ShowPage struct {
	Offset     int  `json:"offset"`
	Limit      int  `json:"limit"`
	Returned   int  `json:"returned"`
	Total      int  `json:"total"`
	HasMore    bool `json:"has_more"`
	NextOffset int  `json:"next_offset"`
	Complete   bool `json:"complete"`
}

type ShowResponse

type ShowResponse struct {
	SchemaVersion int        `json:"schema_version"`
	Command       string     `json:"command"`
	Session       Session    `json:"session"`
	SubagentRefs  []string   `json:"subagent_refs"`
	Totals        ShowTotals `json:"totals"`
	Events        []Event    `json:"events"`
	Page          ShowPage   `json:"page"`
	Warnings      []Warning  `json:"warnings"`
}

type ShowTotals

type ShowTotals struct {
	Tokens ScopedTokens `json:"tokens"`
	Cost   ScopedCost   `json:"cost"`
}

type TokenTotals

type TokenTotals struct {
	UncachedInput int64 `json:"uncached_input"`
	Output        int64 `json:"output"`
	CacheWrite    int64 `json:"cache_write"`
	CacheRead     int64 `json:"cache_read"`
	Total         int64 `json:"total"`
}

type Warning

type Warning struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Ref     string `json:"ref,omitempty"`
	Path    string `json:"path,omitempty"`
}

Jump to

Keyboard shortcuts

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