Documentation
¶
Index ¶
- Constants
- type CacheConfig
- type ColorConfig
- type Config
- func (c *Config) ApplyDefaults()
- func (c *Config) EnsureDirectories() error
- func (c *Config) GetAutoLockDuration() time.Duration
- func (c *Config) GetCaptureTimeout() time.Duration
- func (c *Config) GetHashCollectionTimeoutDuration() time.Duration
- func (c *Config) GetIntegrityCheckFrequencyDuration() time.Duration
- func (c *Config) GetLaunchTimeout() time.Duration
- func (c *Config) GetMaxCacheAge() time.Duration
- func (c *Config) GetRefreshDuration() time.Duration
- func (c *Config) GetSessionTimeoutDuration() time.Duration
- func (c *Config) GetSyncInterval() time.Duration
- func (cfg *Config) GetSyncServerURL() string
- func (c *Config) GetSyncTimeout() time.Duration
- func (c *Config) IsPerfectSyncEnabled() bool
- func (c *Config) Save(configPath string) error
- func (c *Config) ShouldUseIntegrityVerification() bool
- func (c *Config) Validate() error
- type DaemonConfig
- type DatabaseConfig
- type ImportExportConfig
- type OutputConfig
- type SecurityConfig
- type SentryConfig
- type ShellConfig
- type SyncConfig
- type TUIConfig
Constants ¶
const DefaultSyncServerURL = "https://api.commandchronicles.dev"
Hardcoded sync server URL for SaaS model const DefaultSyncServerURL = "https://sync.commandchronicles.dev"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheConfig ¶
type CacheConfig struct {
// Number of recent commands always kept in RAM
HotCacheSize int `toml:"hot_cache_size"`
// Batch size for loading additional commands during search
SearchBatchSize int `toml:"search_batch_size"`
// Maximum memory usage in MB during search operations
MaxMemoryMB int `toml:"max_memory_mb"`
// Interval between cache refreshes in seconds
RefreshInterval int `toml:"refresh_interval"`
// Enable cache compression
Compression bool `toml:"compression"`
// Percentage of max memory to trigger eviction (0.0 to 1.0)
EvictionThreshold float64 `toml:"eviction_threshold"`
// Maximum age for cache entries in hours
MaxCacheAgeHours int `toml:"max_cache_age_hours"`
// Percentage of entries to remove during eviction (0.0 to 1.0)
EvictionPercentage float64 `toml:"eviction_percentage"`
}
CacheConfig contains memory cache settings
type ColorConfig ¶
type ColorConfig struct {
Success string `toml:"success"` // Bright Green
Error string `toml:"error"` // Bright Red
Warning string `toml:"warning"` // Orange
Info string `toml:"info"` // Bright Blue
Tip string `toml:"tip"` // Bright Cyan
Auth string `toml:"auth"` // Bright Blue
Setup string `toml:"setup"` // Bright Magenta
Sync string `toml:"sync"` // Bright Blue
Stats string `toml:"stats"` // Bright Cyan
Done string `toml:"done"` // Bright Green
}
ColorConfig contains color definitions for different output types
type Config ¶
type Config struct {
// Database configuration
Database DatabaseConfig `toml:"database"`
// Cache configuration
Cache CacheConfig `toml:"cache"`
// Security configuration
Security SecurityConfig `toml:"security"`
// TUI configuration
TUI TUIConfig `toml:"tui"`
// Shell integration configuration
Shell ShellConfig `toml:"shell"`
// Import/Export configuration
ImportExport ImportExportConfig `toml:"import_export"`
// Sync configuration
Sync SyncConfig `toml:"sync"`
// Daemon configuration
Daemon DaemonConfig `toml:"daemon"`
// Sentry configuration
Sentry SentryConfig `toml:"sentry"`
// Output configuration
Output OutputConfig `toml:"output"`
// Directory paths (computed, not stored in TOML)
DataDir string `toml:"-"`
ConfigDir string `toml:"-"`
}
Config represents the complete configuration for CommandChronicles CLI
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a configuration with sensible defaults
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults applies default values for all configuration sections This ensures that TOML decoding doesn't override defaults with zero values
func (*Config) EnsureDirectories ¶
EnsureDirectories creates necessary directories for the configuration
func (*Config) GetAutoLockDuration ¶
GetAutoLockDuration returns the auto-lock timeout as a time.Duration
func (*Config) GetCaptureTimeout ¶
GetCaptureTimeout returns the shell capture timeout as a time.Duration
func (*Config) GetHashCollectionTimeoutDuration ¶
GetHashCollectionTimeoutDuration returns the hash collection timeout as a time.Duration
func (*Config) GetIntegrityCheckFrequencyDuration ¶
GetIntegrityCheckFrequencyDuration returns the integrity check frequency as a time.Duration
func (*Config) GetLaunchTimeout ¶
GetLaunchTimeout returns the TUI launch timeout as a time.Duration
func (*Config) GetMaxCacheAge ¶
GetMaxCacheAge returns the maximum cache age as a time.Duration
func (*Config) GetRefreshDuration ¶
GetRefreshDuration returns the cache refresh interval as a time.Duration
func (*Config) GetSessionTimeoutDuration ¶
GetSessionTimeoutDuration returns the session timeout as a time.Duration
func (*Config) GetSyncInterval ¶
GetSyncInterval returns the sync interval as a time.Duration
func (*Config) GetSyncServerURL ¶
GetSyncServerURL returns the hardcoded sync server URL
func (*Config) GetSyncTimeout ¶
GetSyncTimeout returns the sync timeout as a time.Duration
func (*Config) IsPerfectSyncEnabled ¶
IsPerfectSyncEnabled returns true if Perfect Sync is enabled and properly configured
func (*Config) ShouldUseIntegrityVerification ¶
ShouldUseIntegrityVerification returns true if integrity verification should be used
type DaemonConfig ¶
type DaemonConfig struct {
// Sync interval in seconds
SyncInterval time.Duration `toml:"sync_interval"`
// Retry interval on failure
RetryInterval time.Duration `toml:"retry_interval"`
// Maximum retries before giving up
MaxRetries int `toml:"max_retries"`
// Log level for daemon
LogLevel string `toml:"log_level"`
// PID file path
PIDFile string `toml:"pid_file"`
// Log file path
LogFile string `toml:"log_file"`
// Daemonize process
Daemonize bool `toml:"daemonize"`
// Auto-start daemon when commands are run
AutoStart bool `toml:"auto_start"`
// System service is installed
SystemService bool `toml:"system_service"`
}
DaemonConfig contains daemon-related settings
type DatabaseConfig ¶
type DatabaseConfig struct {
// Path to the SQLite database file
Path string `toml:"path"`
// Connection pool settings
MaxOpenConns int `toml:"max_open_conns"`
MaxIdleConns int `toml:"max_idle_conns"`
// WAL mode settings
WALMode bool `toml:"wal_mode"`
// Synchronous mode (NORMAL, FULL)
SyncMode string `toml:"sync_mode"`
}
DatabaseConfig contains database-related settings
type ImportExportConfig ¶
type ImportExportConfig struct {
// Default import format (auto, bash, zsh, fish)
DefaultFormat string `toml:"default_format"`
// Enable deduplication during import
Deduplicate bool `toml:"deduplicate"`
// Batch size for large imports
BatchSize int `toml:"batch_size"`
// Supported formats
SupportedFormats []string `toml:"supported_formats"`
}
ImportExportConfig contains import/export settings
type OutputConfig ¶
type OutputConfig struct {
// Enable colored output
ColorsEnabled bool `toml:"colors_enabled"`
// Color scheme: "modern", "conservative", "custom"
ColorScheme string `toml:"color_scheme"`
// Automatically disable colors when not in a TTY
AutoDetectTTY bool `toml:"auto_detect_tty"`
// Verbosity level: "minimal", "normal", "verbose"
Verbosity string `toml:"verbosity"`
// Custom color definitions (used when color_scheme = "custom")
Colors ColorConfig `toml:"colors"`
}
OutputConfig contains CLI output formatting settings
type SecurityConfig ¶
type SecurityConfig struct {
// Session key file path
SessionKeyPath string `toml:"session_key_path"`
// Session timeout in seconds (default: 3 months)
SessionTimeout int `toml:"session_timeout"`
// Argon2id parameters
Argon2Time uint32 `toml:"argon2_time"`
Argon2Memory uint32 `toml:"argon2_memory"`
Argon2Threads uint8 `toml:"argon2_threads"`
// Auto-lock on inactivity (seconds, 0 = disabled)
AutoLockTimeout int `toml:"auto_lock_timeout"`
// Secure memory clearing
SecureMemoryClear bool `toml:"secure_memory_clear"`
}
SecurityConfig contains security-related settings
type SentryConfig ¶
type SentryConfig struct {
// Enable Sentry error monitoring
Enabled bool `toml:"enabled"`
// Sentry DSN for error reporting
DSN string `toml:"dsn"`
// Environment name (development, staging, production)
Environment string `toml:"environment"`
// Sample rate for error reporting (0.0 to 1.0)
SampleRate float64 `toml:"sample_rate"`
// Release version for error grouping
Release string `toml:"release"`
// Debug mode for Sentry SDK
Debug bool `toml:"debug"`
}
SentryConfig contains Sentry error monitoring settings
type ShellConfig ¶
type ShellConfig struct {
// Enable shell integration
Enabled bool `toml:"enabled"`
// Supported shells
SupportedShells []string `toml:"supported_shells"`
// Hook installation paths
BashHookPath string `toml:"bash_hook_path"`
ZshHookPath string `toml:"zsh_hook_path"`
// Command capture overhead limit in milliseconds
CaptureTimeoutMS int `toml:"capture_timeout_ms"`
// Enable graceful degradation
GracefulDegradation bool `toml:"graceful_degradation"`
// Auto-installation settings
AutoInstall bool `toml:"auto_install"`
// Backup configuration
BackupDir string `toml:"backup_dir"`
BackupRetention int `toml:"backup_retention_days"`
}
ShellConfig contains shell integration settings
type SyncConfig ¶
type SyncConfig struct {
// Enable synchronization
Enabled bool `toml:"enabled"`
// Sync server URL
ServerURL string `toml:"server_url"`
// User email for authentication
Email string `toml:"email"`
// Sync interval in seconds
SyncInterval int `toml:"sync_interval"`
// Advanced options
MaxRetries int `toml:"max_retries"`
Timeout int `toml:"timeout_seconds"`
BatchSize int `toml:"batch_size"`
// Auto-sync on startup
AutoSync bool `toml:"auto_sync"`
// Enable conflict resolution
ConflictResolution bool `toml:"conflict_resolution"`
// Perfect Sync options
PerfectSync bool `toml:"perfect_sync"`
IntegrityVerification bool `toml:"integrity_verification"`
HashCompression bool `toml:"hash_compression"`
MaxHashesPerRequest int `toml:"max_hashes_per_request"`
IntegrityCheckFrequency int `toml:"integrity_check_frequency"`
HashCollectionTimeout int `toml:"hash_collection_timeout"`
}
SyncConfig contains synchronization settings
type TUIConfig ¶
type TUIConfig struct {
// Launch performance target in milliseconds
LaunchTimeoutMS int `toml:"launch_timeout_ms"`
// Enable syntax highlighting
SyntaxHighlighting bool `toml:"syntax_highlighting"`
// Color scheme (dark, light, auto)
ColorScheme string `toml:"color_scheme"`
// Enable animations
Animations bool `toml:"animations"`
// Results per page
ResultsPerPage int `toml:"results_per_page"`
// Fuzzy search threshold (0.0 to 1.0)
FuzzyThreshold float64 `toml:"fuzzy_threshold"`
}
TUIConfig contains TUI interface settings