engagement

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MilestoneThresholds = []int{3, 8, 21, 55}

MilestoneThresholds are the Fibonacci thresholds that have assigned messages: 3, 8, 21, 55.

Functions

func GetMilestoneMessage

func GetMilestoneMessage(docCount int, lookup func(int) string) (string, bool)

GetMilestoneMessage returns the reinforcement message from the i18n catalog. The caller provides the message lookup function to keep this package free of i18n dependency. Returns ("", false) for non-milestone counts.

Usage: engagement.GetMilestoneMessage(count, milestoneMessageFromI18N)

func IsFibonacciMilestone added in v1.0.0

func IsFibonacciMilestone(n int) bool

IsFibonacciMilestone reports whether n is a Fibonacci number >= 3. Uses the generate-and-check approach with seed (1, 2) producing: 3, 5, 8, 13, 21, 34, 55, 89... Exported for use by the star prompt feature.

func IsMilestoneWithMessage added in v1.0.0

func IsMilestoneWithMessage(docCount int) bool

IsMilestoneWithMessage returns true if docCount matches a threshold that has an assigned message (3, 8, 21, 55).

func SaveState added in v1.0.0

func SaveState(path string, state EngagementState) error

SaveState persists .lore/state.json atomically.

func ShouldShowStarPrompt added in v1.0.0

func ShouldShowStarPrompt(opts StarPromptOpts) bool

ShouldShowStarPrompt returns true if conditions are met for showing the one-time star prompt. It fires exactly once at the threshold.

func StatePath added in v1.0.0

func StatePath(workDir string) string

StatePath returns the path to .lore/state.json for the given work directory.

Types

type EngagementState added in v1.0.0

type EngagementState struct {
	StarPromptShown bool `json:"star_prompt_shown"`
}

EngagementState holds lightweight flags persisted in .lore/state.json. The documented commit count comes from the store/filesystem, not here.

func LoadState added in v1.0.0

func LoadState(path string) EngagementState

LoadState reads .lore/state.json. Returns zero-value state on any error.

type StarPromptOpts added in v1.0.0

type StarPromptOpts struct {
	DocCount     int
	Threshold    int  // default 5, configurable via hooks.star_prompt_after
	AlreadyShown bool // from EngagementState.StarPromptShown
	Enabled      bool // from hooks.star_prompt config (default true)
	IsTTY        bool
	IsQuiet      bool
}

StarPromptOpts controls whether the star prompt should be shown.

Jump to

Keyboard shortcuts

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