Documentation
¶
Index ¶
- Variables
- func GetMilestoneMessage(docCount int, lookup func(int) string) (string, bool)
- func IsFibonacciMilestone(n int) bool
- func IsMilestoneWithMessage(docCount int) bool
- func SaveState(path string, state EngagementState) error
- func ShouldShowStarPrompt(opts StarPromptOpts) bool
- func StatePath(workDir string) string
- type EngagementState
- type StarPromptOpts
Constants ¶
This section is empty.
Variables ¶
var MilestoneThresholds = []int{3, 8, 21, 55}
MilestoneThresholds are the Fibonacci thresholds that have assigned messages: 3, 8, 21, 55.
Functions ¶
func GetMilestoneMessage ¶
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
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
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.
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.