Documentation
¶
Overview ¶
Package cli provides the command-line interface for gryph.
Index ¶
- Constants
- func ErrAgentNotFound(agentName string) *cliError
- func ErrConfig(message string, err error) *cliError
- func ErrDatabase(message string, err error) *cliError
- func ErrHookFailed(message string, err error) *cliError
- func Execute() error
- func NewCLIError(code int, message string) *cliError
- func NewCatCmd() *cobra.Command
- func NewConfigCmd() *cobra.Command
- func NewCostCmd() *cobra.Command
- func NewDiffCmd() *cobra.Command
- func NewDoctorCmd() *cobra.Command
- func NewExportCmd() *cobra.Command
- func NewHookCmd() *cobra.Command
- func NewInstallCmd() *cobra.Command
- func NewLogsCmd() *cobra.Command
- func NewQueryCmd() *cobra.Command
- func NewRetentionCmd() *cobra.Command
- func NewRootCmd() *cobra.Command
- func NewSelfLogCmd() *cobra.Command
- func NewSessionCmd() *cobra.Command
- func NewSessionsCmd() *cobra.Command
- func NewStatsCmd() *cobra.Command
- func NewStatusCmd() *cobra.Command
- func NewStreamCmd() *cobra.Command
- func NewUninstallCmd() *cobra.Command
- func NewVersionCmd() *cobra.Command
- func RegisterCheckFactory(f func(cfg *config.Config) security.Check)
- func WrapError(code int, message string, err error) *cliError
- type App
- type ExitCoder
- type GlobalFlags
Constants ¶
const ( SelfAuditActionInstall = "install" SelfAuditActionUninstall = "uninstall" SelfAuditActionConfigChange = "config_change" SelfAuditActionPurge = "purge" SelfAuditActionDatabaseInit = "database_init" SelfAuditActionRetentionCleanup = "retention_cleanup" SelfAuditActionHookError = "hook_error" SelfAuditResultSuccess = "success" SelfAuditResultError = "error" SelfAuditResultSkipped = "skipped" )
SelfAuditAction constants for self-audit logging.
const ( ExitSuccess = 0 // Success ExitGeneral = 1 // General/unknown error ExitConfig = 2 // Invalid YAML, missing required config fields ExitDatabase = 3 // Database init fails, corrupt/locked ExitAgentNotFound = 4 // Agent not found or not detected ExitHookFailed = 5 // Hook installation/removal fails )
Exit codes per specification (Section 14.4).
Variables ¶
This section is empty.
Functions ¶
func ErrAgentNotFound ¶
func ErrAgentNotFound(agentName string) *cliError
ErrAgentNotFound creates an agent not found error.
func ErrDatabase ¶
ErrDatabase creates a database error.
func ErrHookFailed ¶
ErrHookFailed creates a hook operation failure error.
func NewCLIError ¶
NewCLIError creates a new CLIError with the given code and message.
func NewConfigCmd ¶
func NewCostCmd ¶ added in v0.4.0
NewCostCmd creates the cost command.
func NewRetentionCmd ¶
NewRetentionCmd creates the retention command.
func NewSelfLogCmd ¶
NewSelfLogCmd creates the self-log command.
func NewSessionsCmd ¶
NewSessionsCmd creates the sessions command.
func NewStatsCmd ¶ added in v0.2.8
func NewStreamCmd ¶
NewStreamCmd creates the hidden stream parent command.
func NewUninstallCmd ¶
NewUninstallCmd creates the uninstall command.
func NewVersionCmd ¶
func RegisterCheckFactory ¶ added in v0.7.0
RegisterCheckFactory registers a factory that produces a security.Check. Intended for external binaries that import gryph as a library and want to contribute additional security checks without modifying this package.
Call order: typically from init() in a package blank-imported by the external binary's main. Each registered factory is invoked once per NewApp() call, and the returned Check (if non-nil) is added to the evaluator. Factories that return nil are ignored — this lets callers conditionally enable/disable checks based on the provided *config.Config.
This function is not safe for concurrent use. Register factories before any goroutine calls NewApp.
Types ¶
type App ¶
type App struct {
Config *config.Config
Store storage.Store
Registry *agent.Registry
Presenter tui.Presenter
Paths *config.Paths
Security *security.Evaluator
PrivacyChecker *events.PrivacyChecker
}
App holds the application dependencies.