tips

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

internal/tips/content.go

internal/tips/proactive.go

internal/tips/tips.go

Index

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

func GetPrimeUserTip(agentType string) string

GetPrimeUserTip returns a random product tip for the user, with agent name substituted.

func GetTip

func GetTip(command string) string

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

func MaybeRunProactiveCheck() (string, bool)

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

func RunProactiveCheck() (string, bool)

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
)

Jump to

Keyboard shortcuts

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