cmd

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 71 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitCodeNoDiff  = 0
	ExitCodeHasDiff = 1
	ExitCodeError   = 2
)

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately.

func GetAgentMode added in v0.14.0

func GetAgentMode() bool

GetAgentMode returns the current agent mode setting

func GetChunkSize

func GetChunkSize() int64

GetChunkSize returns the current chunk size setting for pagination

func GetPlainMode

func GetPlainMode() bool

GetPlainMode returns the current plain mode setting

func LoadConfig

func LoadConfig() (*config.Config, error)

LoadConfig loads the config and applies the --context flag override if provided

func NewClientFromConfig

func NewClientFromConfig(cfg *config.Config) (*client.Client, error)

NewClientFromConfig creates a new client from config with verbose mode configured

func NewDQLExecutorFromConfig added in v0.22.0

func NewDQLExecutorFromConfig(cfg *config.Config, c *client.Client) *exec.DQLExecutor

NewDQLExecutorFromConfig creates a DQL executor from a config and client, with OAuth token refresh support. When the OAuth token expires during a long-running query poll (which can exceed the 5-minute token lifetime), the executor automatically fetches a fresh token and retries without aborting the query.

func NewPrinter

func NewPrinter() output.Printer

NewPrinter creates a new printer respecting agent and plain mode settings

func NewSafetyChecker added in v0.6.0

func NewSafetyChecker(cfg *config.Config) (*safety.Checker, error)

NewSafetyChecker creates a new safety checker for the current context

func Setup added in v0.22.0

func Setup() (*config.Config, *client.Client, output.Printer, error)

Setup creates a Config, Client, and Printer for read-only commands. It consolidates the common LoadConfig → NewClientFromConfig → NewPrinter boilerplate.

func SetupClient added in v0.22.0

func SetupClient() (*config.Config, *client.Client, error)

SetupClient creates a Config and Client without a Printer. Use this for commands that need the client but handle output differently (e.g., exec commands, log streaming, or commands with conditional printers).

func SetupWithSafety added in v0.22.0

func SetupWithSafety(op safety.Operation) (*config.Config, *client.Client, error)

SetupWithSafety creates a Config + Client for mutating commands, performing a safety check before the client is created. Use this for commands where ownership is unknown (i.e., the resource doesn't need to be fetched first to determine the owner). A Printer is not included because many mutating commands don't use one.

Types

type ContextListItem added in v0.6.0

type ContextListItem struct {
	Current     string `table:"CURRENT"`
	Name        string `table:"NAME"`
	Environment string `table:"ENVIRONMENT"`
	SafetyLevel string `table:"SAFETY-LEVEL"`
	Description string `table:"DESCRIPTION,wide"`
}

ContextListItem is a flattened view of a context for table display

type DocumentTypeCount added in v0.15.0

type DocumentTypeCount struct {
	Type  string `table:"TYPE" json:"type" yaml:"type"`
	Count int    `table:"COUNT" json:"count" yaml:"count"`
}

DocumentTypeCount holds a count per document type (for --types flag)

type SessionStatus added in v0.25.0

type SessionStatus struct {
	Context               string     `json:"context" yaml:"context"`
	Environment           string     `json:"environment" yaml:"environment"`
	IsOAuth               bool       `json:"isOAuth" yaml:"isOAuth"`
	Storage               string     `json:"storage,omitempty" yaml:"storage,omitempty"`
	AccessTokenPresent    bool       `json:"accessTokenPresent" yaml:"accessTokenPresent"`
	AccessTokenExpiresAt  *time.Time `json:"accessTokenExpiresAt,omitempty" yaml:"accessTokenExpiresAt,omitempty"`
	RefreshTokenPresent   bool       `json:"refreshTokenPresent" yaml:"refreshTokenPresent"`
	RefreshTokenExpiresAt *time.Time `json:"refreshTokenExpiresAt,omitempty" yaml:"refreshTokenExpiresAt,omitempty"`
	GrantedScopes         []string   `json:"grantedScopes,omitempty" yaml:"grantedScopes,omitempty"`
}

SessionStatus summarizes OAuth token state for display by `auth status` and `doctor`.

type WhoamiResult

type WhoamiResult struct {
	UserID       string `json:"userId" yaml:"userId"`
	UserName     string `json:"userName,omitempty" yaml:"userName,omitempty"`
	EmailAddress string `json:"emailAddress,omitempty" yaml:"emailAddress,omitempty"`
	Context      string `json:"context" yaml:"context"`
	Environment  string `json:"environment" yaml:"environment"`
}

WhoamiResult contains the current user information for output

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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