Documentation
¶
Index ¶
- Constants
- Variables
- func GetAllTagColors() []struct{ ... }
- func GetTagColorByIndex(index int) string
- func GetTagColorIndex(colorCode string) int
- func GetTagColorName(colorCode string) string
- func IsValidTagColor(colorCode string) bool
- type CacheConfig
- type ColorConfig
- type Config
- func (c *Config) ApplyDefaults()
- func (c *Config) CleanupOldTagColors(maxAge time.Duration)
- 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) GetTagColor(tagName string, commandTagColors map[string]string) string
- func (c *Config) GetTagColorPreferences() map[string]string
- func (c *Config) HasTagColorPreference(tagName string) bool
- func (c *Config) RemoveTagColorPreference(tagName string)
- func (c *Config) Save(configPath string) error
- func (c *Config) SetTagColor(tagName, color string)
- func (c *Config) ShouldUseIntegrityVerification() bool
- func (c *Config) Validate() error
- type DaemonConfig
- type DatabaseConfig
- type DeletionConfig
- type ImportExportConfig
- type OutputConfig
- type SecurityConfig
- type SentryConfig
- type ShellConfig
- type SyncConfig
- type TUIConfig
- type TagsConfig
Constants ¶
const DefaultSyncServerURL = "https://api.commandchronicles.dev"
Hardcoded sync server URL for SaaS model const DefaultSyncServerURL = "https://sync.commandchronicles.dev"
const DefaultTagColor = "#00FFFF" // cyan
DefaultTagColor is the default color for new tags
Variables ¶
var TagColorCodes = []string{
"#888888",
"#FF0000",
"#00FF00",
"#FFFF00",
"#0000FF",
"#FF00FF",
"#00FFFF",
"#FFFFFF",
"#A0A0A0",
"#FF8080",
"#80FF80",
"#FFFF80",
"#8080FF",
"#FF80FF",
"#80FFFF",
"#F0F0F0",
}
TagColorCodes defines the available colors for tags
var TagColorNames = []string{
"Gray",
"Red",
"Green",
"Yellow",
"Blue",
"Magenta",
"Cyan",
"White",
"Light Gray",
"Bright Red",
"Bright Green",
"Bright Yellow",
"Bright Blue",
"Bright Magenta",
"Bright Cyan",
"Bright White",
}
TagColorNames provides human-readable names for colors (for UI display)
Functions ¶
func GetAllTagColors ¶ added in v0.3.0
GetAllTagColors returns all available tag colors with their names
func GetTagColorByIndex ¶ added in v0.3.0
GetTagColorByIndex returns the color code for a given index
func GetTagColorIndex ¶ added in v0.3.0
GetTagColorIndex returns the index of a color in TagColorCodes, or -1 if not found
func GetTagColorName ¶ added in v0.3.0
GetTagColorName returns the human-readable name for a color code
func IsValidTagColor ¶ added in v0.3.0
IsValidTagColor checks if a color code is valid
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"` // Deletion configuration Deletion DeletionConfig `toml:"deletion"` // Tags configuration Tags TagsConfig `toml:"tags"` // 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) CleanupOldTagColors ¶ added in v0.3.0
CleanupOldTagColors removes tag colors that haven't been used recently
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) GetTagColor ¶ added in v0.3.0
GetTagColor returns the color for a given tag name, checking command override first, then global preferences, then default color
func (*Config) GetTagColorPreferences ¶ added in v0.3.0
GetTagColorPreferences returns all currently set tag color preferences
func (*Config) HasTagColorPreference ¶ added in v0.3.0
HasTagColorPreference checks if a tag has a color preference set
func (*Config) RemoveTagColorPreference ¶ added in v0.3.0
RemoveTagColorPreference removes a tag color preference
func (*Config) SetTagColor ¶ added in v0.3.0
SetTagColor sets the color for a tag in global preferences
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 DeletionConfig ¶ added in v0.2.0
type DeletionConfig struct { // Reset sync timestamp after full wipe operations ResetSyncOnWipe bool `toml:"reset_sync_on_wipe"` // Require explicit confirmation for wipe operations RequireConfirmation bool `toml:"require_confirmation"` // Export backup before deletion by default AutoExportBeforeWipe bool `toml:"auto_export_before_wipe"` }
DeletionConfig contains deletion operation 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"` // Integrity verification options 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
type TagsConfig ¶ added in v0.3.0
type TagsConfig struct { // Enable tag functionality Enabled bool `toml:"enabled"` // Show tags in TUI command display ShowInTUI bool `toml:"show_in_tui"` // Maximum number of tags to display in compact view MaxDisplayTags int `toml:"max_display_tags"` // Enable auto-tagging based on command patterns AutoTagging bool `toml:"auto_tagging"` // Auto-tagging rules (command prefix -> tag name) AutoTagRules map[string]string `toml:"auto_tag_rules"` // Visual indicators for tagged commands ShowIndicators bool `toml:"show_indicators"` // Separator for tag display (default: ", ") DisplaySeparator string `toml:"display_separator"` // Tag color preferences (tag name -> hex color code) TagColors map[string]string `toml:"tag_colors"` // Last updated timestamps for tag colors (tag name -> unix timestamp) TagColorsUpdated map[string]int64 `toml:"tag_colors_updated"` // Default color for new tags (hex color code) DefaultColor string `toml:"default_color"` }
TagsConfig contains tag-related settings