config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Task box heights
	TaskBoxHeight         = 5 // Compact view mode
	TaskBoxHeightExpanded = 9 // Expanded view mode

	// Task box width padding
	TaskBoxPaddingCompact  = 12 // Width padding in compact mode
	TaskBoxPaddingExpanded = 4  // Width padding in expanded mode
	TaskBoxMinWidth        = 10 // Minimum width fallback

	// Search box dimensions
	SearchBoxHeight = 3
)

Variables

View Source
var (
	// Version is the semantic version or commit hash.
	Version = "dev"

	// GitCommit is the full git commit hash.
	GitCommit = "unknown"

	// BuildDate is the ISO 8601 build timestamp.
	BuildDate = "unknown"
)

Build information variables injected via ldflags at compile time. These are set by the build process (Makefile or GoReleaser) using: -ldflags "-X tiki/config.Version=... -X tiki/config.GitCommit=... -X tiki/config.BuildDate=..."

View Source
var (
	// Caption title fallback: Royal Blue (end of gradient)
	FallbackTitleColor = tcell.NewRGBColor(65, 105, 225)
	// Task ID fallback: Deep Sky Blue (end of gradient)
	FallbackTaskIDColor = tcell.NewRGBColor(0, 191, 255)
	// Burndown chart fallback: Purple (start of gradient)
	FallbackBurndownColor = tcell.NewRGBColor(134, 90, 214)
	// Caption row fallback: Midpoint of Midnight Blue to Royal Blue
	FallbackCaptionColor = tcell.NewRGBColor(45, 65, 169)
)

Fallback solid colors for gradient scenarios (used when UseGradients = false)

View Source
var (
	// ErrNoHome indicates that the user's home directory could not be determined
	ErrNoHome = errors.New("unable to determine home directory")

	// ErrPathManagerInit indicates that the PathManager failed to initialize
	ErrPathManagerInit = errors.New("failed to initialize path manager")
)
View Source
var UseGradients bool

UseGradients controls whether gradients are rendered or solid colors are used Set during bootstrap based on terminal color count vs gradientThreshold

View Source
var UseWideGradients bool

UseWideGradients controls whether screen-wide gradients (like caption rows) are rendered Screen-wide gradients show more banding on 256-color terminals, so require truecolor

Functions

func BootstrapSystem

func BootstrapSystem() error

BootstrapSystem creates the task storage and seeds the initial tiki.

func ClearStatusRegistry added in v0.1.5

func ClearStatusRegistry()

ClearStatusRegistry removes the global registry. Intended for test teardown.

func EnsureDirs added in v0.0.7

func EnsureDirs() error

EnsureDirs creates all necessary directories with appropriate permissions

func EnsureProjectInitialized

func EnsureProjectInitialized(tikiSkillMdContent, dokiSkillMdContent string) (bool, error)

EnsureProjectInitialized bootstraps the project if .doc/tiki is missing. Returns (proceed, error). If proceed is false, the user canceled initialization.

func FindWorkflowFile added in v0.1.2

func FindWorkflowFile() string

FindWorkflowFile searches for workflow.yaml in config search paths. Returns the first found path with non-empty views, or empty string if not found. Convenience wrapper over FindWorkflowFiles for code that needs a single path.

func FindWorkflowFiles added in v0.1.3

func FindWorkflowFiles() []string

FindWorkflowFiles returns all workflow.yaml files that exist and have non-empty views. Ordering: user config file first (base), then project config file (overrides), then cwd. This lets LoadPlugins load the base and merge overrides on top.

func GenerateRandomID

func GenerateRandomID() string

GenerateRandomID generates a 6-character random alphanumeric ID (lowercase)

func GetArtTView

func GetArtTView() string

GetArtTView returns the art logo formatted for tview (with tview color codes) uses the current gradient colors

func GetBoardViewMode

func GetBoardViewMode() string

GetBoardViewMode loads the board view mode from workflow.yaml. Returns "expanded" as default if not found.

func GetCacheDir added in v0.0.7

func GetCacheDir() string

GetCacheDir returns the user cache directory

func GetConfigDir added in v0.0.7

func GetConfigDir() string

GetConfigDir returns the user config directory

func GetConfigFile added in v0.0.7

func GetConfigFile() string

GetConfigFile returns the path to the user config file

func GetContentBackgroundColor

func GetContentBackgroundColor() tcell.Color

GetContentBackgroundColor returns the background color for markdown content areas Dark theme needs black background for light text; light theme uses terminal default

func GetContentTextColor

func GetContentTextColor() tcell.Color

GetContentTextColor returns the appropriate text color for content areas Dark theme uses white text; light theme uses black text

func GetDefaultNewTaskTemplate

func GetDefaultNewTaskTemplate() string

GetDefaultNewTaskTemplate returns the embedded new.md template

func GetDokiDir added in v0.0.7

func GetDokiDir() string

GetDokiDir returns the project-local documentation directory

func GetEffectiveTheme

func GetEffectiveTheme() string

GetEffectiveTheme resolves "auto" to actual theme based on terminal detection

func GetFireIcon

func GetFireIcon() string

GetFireIcon returns fire icon with tview color codes

func GetGradientThreshold added in v0.0.8

func GetGradientThreshold() int

GetGradientThreshold returns the minimum color count required for gradients Valid values: 16, 256, 16777216 (truecolor)

func GetHeaderVisible

func GetHeaderVisible() bool

GetHeaderVisible returns the header visibility setting

func GetMaxImageRows added in v0.2.0

func GetMaxImageRows() int

GetMaxImageRows returns the maximum rows for inline image rendering

func GetMaxPoints

func GetMaxPoints() int

GetMaxPoints returns the maximum points value for tasks

func GetPluginSearchPaths added in v0.0.7

func GetPluginSearchPaths() []string

GetPluginSearchPaths returns directories to search for plugin files

func GetProjectConfigDir added in v0.1.3

func GetProjectConfigDir() string

GetProjectConfigDir returns the project-level config directory (.doc/)

func GetProjectConfigFile added in v0.0.7

func GetProjectConfigFile() string

GetProjectConfigFile returns the path to the project-local config file

func GetTaskDir added in v0.0.7

func GetTaskDir() string

GetTaskDir returns the project-local task directory

func GetTemplateFile added in v0.0.7

func GetTemplateFile() string

GetTemplateFile returns the path to the user's custom new.md template

func GetTheme

func GetTheme() string

GetTheme returns the appearance theme setting

func GetUserConfigWorkflowFile added in v0.1.3

func GetUserConfigWorkflowFile() string

GetUserConfigWorkflowFile returns the path to workflow.yaml in the user config directory

func InitPaths added in v0.0.7

func InitPaths() error

InitPaths initializes the path manager. Must be called early in application startup. Returns an error if path initialization fails (e.g., cannot determine home directory).

func InstallDefaultWorkflow added in v0.1.3

func InstallDefaultWorkflow() error

InstallDefaultWorkflow installs the default workflow.yaml to the user config directory if it does not already exist. This runs on every launch to handle first-run and upgrade cases.

func IsProjectInitialized added in v0.0.9

func IsProjectInitialized() bool

IsProjectInitialized returns true if the project has been initialized (i.e., the .doc/tiki directory exists).

func LoadStatusRegistry added in v0.1.5

func LoadStatusRegistry() error

LoadStatusRegistry reads the statuses: section from workflow.yaml files. The first file from FindWorkflowFiles() that contains a non-empty statuses list wins. Returns an error if no statuses are defined anywhere (no Go fallback).

func NormalizeStatusKey added in v0.1.5

func NormalizeStatusKey(key string) string

NormalizeStatusKey lowercases, trims, and normalizes separators in a status key.

func PromptForProjectInit

func PromptForProjectInit() ([]string, bool, error)

PromptForProjectInit presents a Huh form for project initialization. Returns (selectedAITools, proceed, error)

func ResetPathManager added in v0.0.7

func ResetPathManager()

ResetPathManager resets the path manager singleton for testing purposes. This allows tests to reinitialize paths with different environment variables.

func ResetStatusRegistry added in v0.1.5

func ResetStatusRegistry(defs []StatusDef)

ResetStatusRegistry replaces the global registry with one built from the given defs. Intended for tests only.

func SaveHeaderVisible

func SaveHeaderVisible(visible bool) error

SaveHeaderVisible saves the header visibility setting to config.yaml

func SavePluginViewMode

func SavePluginViewMode(pluginName string, configIndex int, viewMode string) error

SavePluginViewMode saves a plugin's view mode to workflow.yaml. configIndex: index in workflow.yaml plugins array (-1 to find/create by name)

func SetColors

func SetColors(colors *ColorConfig)

SetColors sets a custom color configuration

Types

type ColorConfig

type ColorConfig struct {
	// Caption colors
	CaptionFallbackGradient Gradient

	// Task box colors
	TaskBoxSelectedBackground   tcell.Color
	TaskBoxSelectedText         tcell.Color
	TaskBoxSelectedBorder       tcell.Color
	TaskBoxUnselectedBorder     tcell.Color
	TaskBoxUnselectedBackground tcell.Color
	TaskBoxIDColor              Gradient
	TaskBoxTitleColor           string // tview color string like "[#b8b8b8]"
	TaskBoxLabelColor           string // tview color string like "[#767676]"
	TaskBoxDescriptionColor     string // tview color string like "[#767676]"
	TaskBoxTagValueColor        string // tview color string like "[#5a6f8f]"

	// Task detail view colors
	TaskDetailIDColor           Gradient
	TaskDetailTitleText         string // tview color string like "[yellow]"
	TaskDetailLabelText         string // tview color string like "[green]"
	TaskDetailValueText         string // tview color string like "[white]"
	TaskDetailCommentAuthor     string // tview color string like "[yellow]"
	TaskDetailEditDimTextColor  string // tview color string like "[#808080]"
	TaskDetailEditDimLabelColor string // tview color string like "[#606060]"
	TaskDetailEditDimValueColor string // tview color string like "[#909090]"
	TaskDetailEditFocusMarker   string // tview color string like "[yellow]"
	TaskDetailEditFocusText     string // tview color string like "[white]"
	TaskDetailTagForeground     tcell.Color
	TaskDetailTagBackground     tcell.Color

	// Search box colors
	SearchBoxLabelColor      tcell.Color
	SearchBoxBackgroundColor tcell.Color
	SearchBoxTextColor       tcell.Color

	// Input field colors (used in task detail edit mode)
	InputFieldBackgroundColor tcell.Color
	InputFieldTextColor       tcell.Color

	// Completion prompt colors
	CompletionHintColor tcell.Color

	// Burndown chart colors
	BurndownChartAxisColor     tcell.Color
	BurndownChartLabelColor    tcell.Color
	BurndownChartValueColor    tcell.Color
	BurndownChartBarColor      tcell.Color
	BurndownChartGradientFrom  Gradient
	BurndownChartGradientTo    Gradient
	BurndownHeaderGradientFrom Gradient // Header-specific chart gradient
	BurndownHeaderGradientTo   Gradient

	// Header view colors
	HeaderInfoLabel  string // tview color string like "[orange]"
	HeaderInfoValue  string // tview color string like "[white]"
	HeaderKeyBinding string // tview color string like "[yellow]"
	HeaderKeyText    string // tview color string like "[white]"

	// Points visual bar colors
	PointsFilledColor   string // tview color string for filled segments
	PointsUnfilledColor string // tview color string for unfilled segments

	// Header context help action colors
	HeaderActionGlobalKeyColor   string // tview color string for global action keys
	HeaderActionGlobalLabelColor string // tview color string for global action labels
	HeaderActionPluginKeyColor   string // tview color string for plugin action keys
	HeaderActionPluginLabelColor string // tview color string for plugin action labels
	HeaderActionViewKeyColor     string // tview color string for view action keys
	HeaderActionViewLabelColor   string // tview color string for view action labels
}

ColorConfig holds all color and style definitions per view

func DefaultColors

func DefaultColors() *ColorConfig

DefaultColors returns the default color configuration

func GetColors

func GetColors() *ColorConfig

GetColors returns the global color configuration with theme-aware overrides

type Config

type Config struct {
	// Logging configuration
	Logging struct {
		Level string `mapstructure:"level"` // "debug", "info", "warn", "error"
	} `mapstructure:"logging"`

	// Board view configuration
	Board struct {
		View string `mapstructure:"view"` // "compact" or "expanded"
	} `mapstructure:"board"`

	// Header configuration
	Header struct {
		Visible bool `mapstructure:"visible"`
	} `mapstructure:"header"`

	// Tiki configuration
	Tiki struct {
		MaxPoints    int `mapstructure:"maxPoints"`
		MaxImageRows int `mapstructure:"maxImageRows"`
	} `mapstructure:"tiki"`

	// Appearance configuration
	Appearance struct {
		Theme             string `mapstructure:"theme"`             // "dark", "light", "auto"
		GradientThreshold int    `mapstructure:"gradientThreshold"` // Minimum color count for gradients (16, 256, 16777216)
	} `mapstructure:"appearance"`
}

Config holds all application configuration loaded from config.yaml

func GetConfig

func GetConfig() *Config

GetConfig returns the loaded configuration If config hasn't been loaded yet, it loads it first

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig loads configuration from config.yaml Priority order (first found wins): project config → user config → current directory (dev) If config.yaml doesn't exist, it uses default values

type Gradient

type Gradient struct {
	Start [3]int // R, G, B (0-255)
	End   [3]int // R, G, B (0-255)
}

Gradient defines a start and end RGB color for a gradient transition

type PathManager added in v0.0.7

type PathManager struct {
	// contains filtered or unexported fields
}

PathManager manages all file system paths for tiki

func (*PathManager) CacheDir added in v0.0.7

func (pm *PathManager) CacheDir() string

CacheDir returns the user cache directory

func (*PathManager) ConfigDir added in v0.0.7

func (pm *PathManager) ConfigDir() string

ConfigDir returns the user config directory

func (*PathManager) ConfigFile added in v0.0.7

func (pm *PathManager) ConfigFile() string

ConfigFile returns the path to the user config file

func (*PathManager) DokiDir added in v0.0.7

func (pm *PathManager) DokiDir() string

DokiDir returns the project-local documentation directory

func (*PathManager) EnsureDirs added in v0.0.7

func (pm *PathManager) EnsureDirs() error

EnsureDirs creates all necessary directories with appropriate permissions

func (*PathManager) PluginSearchPaths added in v0.0.7

func (pm *PathManager) PluginSearchPaths() []string

PluginSearchPaths returns directories to search for plugin files Search order: project config dir → user config dir

func (*PathManager) ProjectConfigDir added in v0.1.3

func (pm *PathManager) ProjectConfigDir() string

ProjectConfigDir returns the project-level config directory (.doc/)

func (*PathManager) ProjectConfigFile added in v0.0.7

func (pm *PathManager) ProjectConfigFile() string

ProjectConfigFile returns the path to the project-local config file

func (*PathManager) TaskDir added in v0.0.7

func (pm *PathManager) TaskDir() string

TaskDir returns the project-local task directory

func (*PathManager) TemplateFile added in v0.0.7

func (pm *PathManager) TemplateFile() string

TemplateFile returns the path to the user's custom new.md template

func (*PathManager) UserConfigWorkflowFile added in v0.1.3

func (pm *PathManager) UserConfigWorkflowFile() string

UserConfigWorkflowFile returns the path to workflow.yaml in the user config directory

type StatusDef added in v0.1.5

type StatusDef struct {
	Key     string `yaml:"key"`
	Label   string `yaml:"label"`
	Emoji   string `yaml:"emoji"`
	Active  bool   `yaml:"active"`
	Default bool   `yaml:"default"`
	Done    bool   `yaml:"done"`
}

StatusDef defines a single workflow status loaded from workflow.yaml.

type StatusRegistry added in v0.1.5

type StatusRegistry struct {
	// contains filtered or unexported fields
}

StatusRegistry is the central, ordered collection of valid statuses. It is loaded once from workflow.yaml during bootstrap and accessed globally.

func GetStatusRegistry added in v0.1.5

func GetStatusRegistry() *StatusRegistry

GetStatusRegistry returns the global StatusRegistry. Panics if LoadStatusRegistry() was never called — this is a programming error, not a user-facing path.

func (*StatusRegistry) All added in v0.1.5

func (r *StatusRegistry) All() []StatusDef

All returns the ordered list of status definitions.

func (*StatusRegistry) DefaultKey added in v0.1.5

func (r *StatusRegistry) DefaultKey() string

DefaultKey returns the key of the status with default: true.

func (*StatusRegistry) DoneKey added in v0.1.5

func (r *StatusRegistry) DoneKey() string

DoneKey returns the key of the status with done: true.

func (*StatusRegistry) IsActive added in v0.1.5

func (r *StatusRegistry) IsActive(key string) bool

IsActive reports whether the status has the active flag set.

func (*StatusRegistry) IsDone added in v0.1.5

func (r *StatusRegistry) IsDone(key string) bool

IsDone reports whether the status has the done flag set.

func (*StatusRegistry) IsValid added in v0.1.5

func (r *StatusRegistry) IsValid(key string) bool

IsValid reports whether key is a recognized status.

func (*StatusRegistry) Keys added in v0.1.5

func (r *StatusRegistry) Keys() []string

Keys returns all status keys in definition order.

func (*StatusRegistry) Lookup added in v0.1.5

func (r *StatusRegistry) Lookup(key string) (StatusDef, bool)

Lookup returns the StatusDef for a given key (normalized) and whether it exists.

Jump to

Keyboard shortcuts

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