Documentation
¶
Overview ¶
internal/tips/content.go
internal/tips/proactive.go
internal/tips/tips.go
Index ¶
- func ClearProactiveChecks()
- func GetPrimeUserTip(agentType string) string
- func GetTip(command string) string
- func MaybeRunProactiveCheck() (string, bool)
- func MaybeShow(command string, mode TriggerMode, quietMode, tipsDisabled, jsonMode bool)
- func ProactiveCheckCount() int
- func RegisterProactiveCheck(check ProactiveCheck)
- func RunProactiveCheck() (string, bool)
- func ShouldShow(mode TriggerMode, quietMode, tipsDisabled, jsonMode bool) bool
- type ProactiveCheck
- type TriggerMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearProactiveChecks ¶
func ClearProactiveChecks()
ClearProactiveChecks removes all registered checks (for testing)
func GetPrimeUserTip ¶ added in v0.2.0
GetPrimeUserTip returns a random product tip for the user, with agent name substituted.
func GetTip ¶
GetTip returns a random tip for the given command. Automatically selects from human or agent tip pools based on command. Has 20% chance to return a discovery tip instead of contextual.
func MaybeRunProactiveCheck ¶
MaybeRunProactiveCheck runs a check with the configured probability. Returns (tip, true) if an issue was detected and should be shown.
func MaybeShow ¶
func MaybeShow(command string, mode TriggerMode, quietMode, tipsDisabled, jsonMode bool)
MaybeShow conditionally displays a tip based on mode and flags. Proactive health check tips take priority over educational tips when an issue is detected. Parameters: command, mode, quietMode, tipsDisabled, jsonMode
func ProactiveCheckCount ¶
func ProactiveCheckCount() int
ProactiveCheckCount returns the number of registered checks (for testing)
func RegisterProactiveCheck ¶
func RegisterProactiveCheck(check ProactiveCheck)
RegisterProactiveCheck adds a check to the proactive check pool. Called from cmd/ox init functions to register doctor checks.
func RunProactiveCheck ¶
RunProactiveCheck selects and runs a weighted random check. Returns (tip, true) if an issue is detected, ("", false) otherwise. Tips are shown to both humans and agents since they're actionable.
func ShouldShow ¶
func ShouldShow(mode TriggerMode, quietMode, tipsDisabled, jsonMode bool) bool
ShouldShow determines if a tip should be displayed based on mode and flags Parameters: mode, quietMode, tipsDisabled, jsonMode
Types ¶
type ProactiveCheck ¶
type ProactiveCheck struct {
Name string // display name for debugging
Weight int // selection weight (higher = more likely to be selected)
Check func() bool // returns true if issue is detected
FixTip string // tip to show if issue detected (shown to both humans and agents)
Prereq func() bool // optional prerequisite - only run check if this returns true
}
ProactiveCheck represents a lightweight health check that can be run during tip display to surface actionable issues.
type TriggerMode ¶
type TriggerMode int
TriggerMode determines when tips should be shown
const ( // AlwaysShow displays a tip every time (for login, status, init) AlwaysShow TriggerMode = iota // WhenMinimal displays a tip when command output is short WhenMinimal // RandomChance displays a tip ~10% of the time RandomChance )