coach

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllAchievements = []AchievementDefinition{}/* 111 elements not displayed */

AllAchievements contains all achievement definitions

View Source
var DailyChallenges = []ChallengeDefinition{

	{ID: "daily_speed_demon", Name: "Speed Demon", Description: "Complete 20 commands in under 5 minutes", Type: ChallengeTypeDaily, Category: "speed", Icon: "⚡", XPReward: 50, Requirement: 20, Metric: "commands_in_5min", Difficulty: DifficultyEasy},
	{ID: "daily_blazing_fast", Name: "Blazing Fast", Description: "Execute 10 commands under 30ms each", Type: ChallengeTypeDaily, Category: "speed", Icon: "🔥", XPReward: 75, Requirement: 10, Metric: "fast_commands_30ms", Difficulty: DifficultyMedium},
	{ID: "daily_rapid_fire", Name: "Rapid Fire", Description: "Execute 50 commands in 10 minutes", Type: ChallengeTypeDaily, Category: "speed", Icon: "💨", XPReward: 100, Requirement: 50, Metric: "commands_in_10min", Difficulty: DifficultyHard},

	{ID: "daily_error_free", Name: "Error-Free", Description: "Execute 25 commands without errors", Type: ChallengeTypeDaily, Category: "accuracy", Icon: "🎯", XPReward: 50, Requirement: 25, Metric: "consecutive_success", Difficulty: DifficultyEasy},
	{ID: "daily_perfect_aim", Name: "Perfect Aim", Description: "Achieve 98% accuracy today", Type: ChallengeTypeDaily, Category: "accuracy", Icon: "🏹", XPReward: 75, Requirement: 98, Metric: "daily_accuracy_pct", Difficulty: DifficultyMedium},
	{ID: "daily_no_mistakes", Name: "No Mistakes", Description: "Execute 100 commands with zero errors", Type: ChallengeTypeDaily, Category: "accuracy", Icon: "✨", XPReward: 150, Requirement: 100, Metric: "total_success_no_error", Difficulty: DifficultyHard},

	{ID: "daily_alias_advocate", Name: "Alias Advocate", Description: "Use aliases for 10 commands", Type: ChallengeTypeDaily, Category: "productivity", Icon: "🔗", XPReward: 50, Requirement: 10, Metric: "alias_usage_count", Difficulty: DifficultyEasy},
	{ID: "daily_pipe_dream", Name: "Pipe Dream", Description: "Create 5 command pipelines", Type: ChallengeTypeDaily, Category: "productivity", Icon: "🔀", XPReward: 75, Requirement: 5, Metric: "pipelines_used", Difficulty: DifficultyMedium},
	{ID: "daily_efficiency_expert", Name: "Efficiency Expert", Description: "Save 500 keystrokes via predictions/aliases", Type: ChallengeTypeDaily, Category: "productivity", Icon: "💎", XPReward: 100, Requirement: 500, Metric: "keystrokes_saved", Difficulty: DifficultyHard},

	{ID: "daily_new_horizons", Name: "New Horizons", Description: "Use 3 commands you haven't used this week", Type: ChallengeTypeDaily, Category: "exploration", Icon: "🌅", XPReward: 75, Requirement: 3, Metric: "new_commands_week", Difficulty: DifficultyMedium},
	{ID: "daily_directory_explorer", Name: "Directory Explorer", Description: "Work in 5 different directories", Type: ChallengeTypeDaily, Category: "exploration", Icon: "🗺️", XPReward: 50, Requirement: 5, Metric: "unique_directories", Difficulty: DifficultyEasy},
	{ID: "daily_flag_finder", Name: "Flag Finder", Description: "Use 10 different command flags", Type: ChallengeTypeDaily, Category: "exploration", Icon: "🚩", XPReward: 75, Requirement: 10, Metric: "unique_flags", Difficulty: DifficultyMedium},

	{ID: "daily_warm_up", Name: "Warm Up", Description: "Execute 25 commands today", Type: ChallengeTypeDaily, Category: "volume", Icon: "🏃", XPReward: 25, Requirement: 25, Metric: "daily_commands", Difficulty: DifficultyEasy},
	{ID: "daily_active", Name: "Stay Active", Description: "Execute 50 commands today", Type: ChallengeTypeDaily, Category: "volume", Icon: "💪", XPReward: 50, Requirement: 50, Metric: "daily_commands", Difficulty: DifficultyEasy},
	{ID: "daily_power_hour", Name: "Power Hour", Description: "Execute 100 commands today", Type: ChallengeTypeDaily, Category: "volume", Icon: "⚡", XPReward: 75, Requirement: 100, Metric: "daily_commands", Difficulty: DifficultyMedium},
}

DailyChallenges contains all daily challenge definitions

View Source
var LevelTitles = map[int]string{
	1:   "Shell Novice",
	11:  "Command Apprentice",
	21:  "Terminal Journeyman",
	36:  "Shell Artisan",
	51:  "Command Master",
	71:  "Terminal Virtuoso",
	86:  "Shell Sage",
	100: "Terminal Transcendent",
}

Level titles for each level range

View Source
var SpecialChallenges = []ChallengeDefinition{

	{ID: "special_monthly_marathon", Name: "Monthly Marathon", Description: "30-day streak this month", Type: ChallengeTypeSpecial, Category: "streak", Icon: "🏅", XPReward: 1000, Requirement: 30, Metric: "monthly_streak", Difficulty: DifficultyHard},
	{ID: "special_10k_month", Name: "10K Month", Description: "Execute 10,000 commands this month", Type: ChallengeTypeSpecial, Category: "milestone", Icon: "🎯", XPReward: 1000, Requirement: 10000, Metric: "monthly_commands", Difficulty: DifficultyHard},

	{ID: "special_hacktoberfest", Name: "Hacktoberfest Hero", Description: "500 git commands in October", Type: ChallengeTypeSpecial, Category: "seasonal", Icon: "🎃", XPReward: 500, Requirement: 500, Metric: "october_git_commands", Difficulty: DifficultyMedium},
	{ID: "special_new_year", Name: "New Year New You", Description: "Complete 7-day streak starting Jan 1", Type: ChallengeTypeSpecial, Category: "seasonal", Icon: "🎆", XPReward: 300, Requirement: 7, Metric: "jan_streak", Difficulty: DifficultyMedium},

	{ID: "special_first_1000", Name: "First Thousand", Description: "Reach 1000 total commands", Type: ChallengeTypeSpecial, Category: "milestone", Icon: "🎊", XPReward: 200, Requirement: 1000, Metric: "total_commands", Difficulty: DifficultyEasy},
	{ID: "special_level_25", Name: "Quarter Century", Description: "Reach level 25", Type: ChallengeTypeSpecial, Category: "milestone", Icon: "🌟", XPReward: 300, Requirement: 25, Metric: "level", Difficulty: DifficultyMedium},
	{ID: "special_level_50", Name: "Halfway There", Description: "Reach level 50", Type: ChallengeTypeSpecial, Category: "milestone", Icon: "💫", XPReward: 500, Requirement: 50, Metric: "level", Difficulty: DifficultyHard},
	{ID: "special_level_100", Name: "Centurion Level", Description: "Reach level 100", Type: ChallengeTypeSpecial, Category: "milestone", Icon: "👑", XPReward: 1000, Requirement: 100, Metric: "level", Difficulty: DifficultyHard},
}

SpecialChallenges contains special/seasonal challenges

View Source
var StaticTips = []StaticTip{

	{ID: "prod_ctrl_r", Category: TipCategoryProductivity, Icon: "💡", Title: "Search History", Content: "Use Ctrl+R to search your command history", Priority: 10},
	{ID: "prod_bang_bang", Category: TipCategoryProductivity, Icon: "💡", Title: "Repeat Command", Content: "Use !! to repeat the last command", Priority: 9},
	{ID: "prod_bang_dollar", Category: TipCategoryProductivity, Icon: "💡", Title: "Last Argument", Content: "Use !$ to reuse the last argument from the previous command", Priority: 9},
	{ID: "prod_chain_and", Category: TipCategoryProductivity, Icon: "💡", Title: "Chain Commands", Content: "Use && to chain commands that depend on each other", Priority: 8},
	{ID: "prod_pipe", Category: TipCategoryProductivity, Icon: "💡", Title: "Pipe Output", Content: "Use | (pipe) to pass output between commands", Priority: 8},
	{ID: "prod_ctrl_a", Category: TipCategoryProductivity, Icon: "💡", Title: "Jump to Start", Content: "Use Ctrl+A to jump to the beginning of the line", Priority: 7},
	{ID: "prod_ctrl_e", Category: TipCategoryProductivity, Icon: "💡", Title: "Jump to End", Content: "Use Ctrl+E to jump to the end of the line", Priority: 7},
	{ID: "prod_ctrl_w", Category: TipCategoryProductivity, Icon: "💡", Title: "Delete Word", Content: "Use Ctrl+W to delete the word before the cursor", Priority: 7},
	{ID: "prod_ctrl_u", Category: TipCategoryProductivity, Icon: "💡", Title: "Clear Line", Content: "Use Ctrl+U to clear the line before the cursor", Priority: 6},
	{ID: "prod_ctrl_k", Category: TipCategoryProductivity, Icon: "💡", Title: "Clear After", Content: "Use Ctrl+K to clear the line after the cursor", Priority: 6},
	{ID: "prod_alt_dot", Category: TipCategoryProductivity, Icon: "💡", Title: "Insert Last Arg", Content: "Use Alt+. to insert the last argument of the previous command", Priority: 6},
	{ID: "prod_pushd", Category: TipCategoryProductivity, Icon: "💡", Title: "Directory Stack", Content: "Use pushd/popd to manage a directory stack for quick navigation", Priority: 5},
	{ID: "prod_ctrl_z", Category: TipCategoryProductivity, Icon: "💡", Title: "Suspend Process", Content: "Use Ctrl+Z to suspend and 'fg' to resume a process", Priority: 5},

	{ID: "short_ctrl_l", Category: TipCategoryShortcut, Icon: "⌨️", Title: "Clear Screen", Content: "Ctrl+L clears the screen (same as 'clear')", Priority: 8},
	{ID: "short_tab", Category: TipCategoryShortcut, Icon: "⌨️", Title: "Tab Complete", Content: "Tab completes commands and file paths automatically", Priority: 10},
	{ID: "short_double_tab", Category: TipCategoryShortcut, Icon: "⌨️", Title: "Show All", Content: "Double-Tab shows all possible completions", Priority: 7},
	{ID: "short_ctrl_c", Category: TipCategoryShortcut, Icon: "⌨️", Title: "Cancel Command", Content: "Ctrl+C cancels the current command", Priority: 9},
	{ID: "short_ctrl_d", Category: TipCategoryShortcut, Icon: "⌨️", Title: "Exit Shell", Content: "Ctrl+D exits the shell (or sends EOF)", Priority: 6},
	{ID: "short_alt_bf", Category: TipCategoryShortcut, Icon: "⌨️", Title: "Word Movement", Content: "Alt+B/F moves backward/forward word by word", Priority: 6},
	{ID: "short_ctrl_t", Category: TipCategoryShortcut, Icon: "⌨️", Title: "Swap Chars", Content: "Ctrl+T swaps the last two characters", Priority: 4},
	{ID: "short_alt_t", Category: TipCategoryShortcut, Icon: "⌨️", Title: "Swap Words", Content: "Alt+T swaps the last two words", Priority: 4},

	{ID: "cmd_cd_dash", Category: TipCategoryCommand, Icon: "📚", Title: "Previous Directory", Content: "'cd -' takes you to your previous directory", Priority: 9},
	{ID: "cmd_mkdir_p", Category: TipCategoryCommand, Icon: "📚", Title: "Nested Dirs", Content: "'mkdir -p' creates nested directories in one command", Priority: 8},
	{ID: "cmd_cp_r", Category: TipCategoryCommand, Icon: "📚", Title: "Copy Recursive", Content: "'cp -r' copies directories recursively", Priority: 7},
	{ID: "cmd_rm_i", Category: TipCategoryCommand, Icon: "📚", Title: "Safe Delete", Content: "'rm -i' asks before deleting each file", Priority: 7},
	{ID: "cmd_less", Category: TipCategoryCommand, Icon: "📚", Title: "Better Pager", Content: "'less' is better than 'more' for viewing files (q to quit)", Priority: 6},
	{ID: "cmd_tail_f", Category: TipCategoryCommand, Icon: "📚", Title: "Follow Logs", Content: "'tail -f' follows file updates in real-time (great for logs)", Priority: 8},
	{ID: "cmd_head_n", Category: TipCategoryCommand, Icon: "📚", Title: "First Lines", Content: "'head -n 5' shows only the first 5 lines of a file", Priority: 5},
	{ID: "cmd_wc_l", Category: TipCategoryCommand, Icon: "📚", Title: "Count Lines", Content: "'wc -l' counts lines in a file", Priority: 5},
	{ID: "cmd_sort_u", Category: TipCategoryCommand, Icon: "📚", Title: "Sort Unique", Content: "'sort -u' sorts and removes duplicate lines", Priority: 5},
	{ID: "cmd_xargs", Category: TipCategoryCommand, Icon: "📚", Title: "Build Commands", Content: "'xargs' converts input into arguments for another command", Priority: 6},
	{ID: "cmd_tee", Category: TipCategoryCommand, Icon: "📚", Title: "Split Output", Content: "'tee' writes output to both file and stdout simultaneously", Priority: 5},
	{ID: "cmd_watch", Category: TipCategoryCommand, Icon: "📚", Title: "Repeat Command", Content: "'watch' runs a command repeatedly and shows the output", Priority: 5},

	{ID: "git_oneline", Category: TipCategoryGit, Icon: "🌿", Title: "Compact Log", Content: "'git log --oneline' shows compact history", Priority: 8},
	{ID: "git_staged", Category: TipCategoryGit, Icon: "🌿", Title: "Staged Changes", Content: "'git diff --staged' shows staged changes", Priority: 8},
	{ID: "git_stash", Category: TipCategoryGit, Icon: "🌿", Title: "Save Work", Content: "'git stash' saves your work without committing", Priority: 7},
	{ID: "git_amend", Category: TipCategoryGit, Icon: "🌿", Title: "Fix Last Commit", Content: "'git commit --amend' modifies the last commit", Priority: 7},
	{ID: "git_cherry", Category: TipCategoryGit, Icon: "🌿", Title: "Cherry Pick", Content: "'git cherry-pick' applies specific commits to current branch", Priority: 5},
	{ID: "git_bisect", Category: TipCategoryGit, Icon: "🌿", Title: "Find Bug", Content: "'git bisect' helps find the commit that introduced a bug", Priority: 5},
	{ID: "git_reflog", Category: TipCategoryGit, Icon: "🌿", Title: "Undo History", Content: "'git reflog' shows all recent actions (even undone ones)", Priority: 6},
	{ID: "git_blame", Category: TipCategoryGit, Icon: "🌿", Title: "Line History", Content: "'git blame' shows who changed each line and when", Priority: 6},
	{ID: "git_worktree", Category: TipCategoryGit, Icon: "🌿", Title: "Multiple Branches", Content: "'git worktree' lets you work on multiple branches at once", Priority: 4},
	{ID: "git_rebase_i", Category: TipCategoryGit, Icon: "🌿", Title: "Edit History", Content: "'git rebase -i' for interactive history editing", Priority: 5},

	{ID: "fun_unix_1971", Category: TipCategoryFunFact, Icon: "🎲", Title: "Unix History", Content: "The first Unix shell was written in 1971", Priority: 3},
	{ID: "fun_grep", Category: TipCategoryFunFact, Icon: "🎲", Title: "grep Origin", Content: "'grep' stands for 'Global Regular Expression Print'", Priority: 4},
	{ID: "fun_awk", Category: TipCategoryFunFact, Icon: "🎲", Title: "awk Origin", Content: "'awk' is named after its creators: Aho, Weinberger, Kernighan", Priority: 3},
	{ID: "fun_sudo", Category: TipCategoryFunFact, Icon: "🎲", Title: "sudo Origin", Content: "'sudo' stands for 'superuser do'", Priority: 4},
	{ID: "fun_root", Category: TipCategoryFunFact, Icon: "🎲", Title: "Root Directory", Content: "The '/' root directory is called 'slash'", Priority: 3},
	{ID: "fun_daemon", Category: TipCategoryFunFact, Icon: "🎲", Title: "Daemon Origin", Content: "'daemon' processes are named after Greek spirits that work in the background", Priority: 3},
	{ID: "fun_bash", Category: TipCategoryFunFact, Icon: "🎲", Title: "Bash Origin", Content: "Bash stands for 'Bourne Again SHell' (a pun on Bourne shell)", Priority: 4},
	{ID: "fun_tty", Category: TipCategoryFunFact, Icon: "🎲", Title: "tty Origin", Content: "The 'tty' command comes from 'teletypewriter'", Priority: 3},
	{ID: "fun_null", Category: TipCategoryFunFact, Icon: "🎲", Title: "Bit Bucket", Content: "'/dev/null' is called the 'bit bucket' - data goes in, nothing comes out", Priority: 4},
	{ID: "fun_pipe", Category: TipCategoryFunFact, Icon: "🎲", Title: "Pipe History", Content: "The pipe | was invented by Doug McIlroy in 1973", Priority: 4},

	{ID: "mot_got_this", Category: TipCategoryMotivation, Icon: "🚀", Title: "Keep Going!", Content: "You've got this! Every command makes you better.", Priority: 2},
	{ID: "mot_practice", Category: TipCategoryMotivation, Icon: "💪", Title: "Practice", Content: "Practice makes perfect. Keep typing!", Priority: 2},
	{ID: "mot_improve", Category: TipCategoryMotivation, Icon: "🌟", Title: "Progress", Content: "Small improvements add up to big gains.", Priority: 2},
	{ID: "mot_pro", Category: TipCategoryMotivation, Icon: "🏆", Title: "Terminal Pro", Content: "You're on your way to becoming a terminal pro!", Priority: 2},
	{ID: "mot_beginner", Category: TipCategoryMotivation, Icon: "✨", Title: "Everyone Starts", Content: "Every expert was once a beginner.", Priority: 2},
	{ID: "mot_focus", Category: TipCategoryMotivation, Icon: "🎯", Title: "Focus", Content: "Focus on progress, not perfection.", Priority: 2},
	{ID: "mot_streak", Category: TipCategoryMotivation, Icon: "🔥", Title: "Streak Power", Content: "Your streak is building! Don't break the chain!", Priority: 3},
	{ID: "mot_speed", Category: TipCategoryMotivation, Icon: "⚡", Title: "Getting Faster", Content: "Speed comes with practice. You're getting faster!", Priority: 2},
}

StaticTips contains all static tip definitions

View Source
var StreakMilestones = []StreakMilestone{
	{Days: 3, XPReward: 25, BadgeID: "", Message: "3-day streak! You're building a habit!", Multiplier: 1.1},
	{Days: 7, XPReward: 100, BadgeID: "streak_weekly", Message: "1 week streak! Multiplier now 1.25x!", Multiplier: 1.25},
	{Days: 14, XPReward: 200, BadgeID: "streak_dedicated", Message: "2 weeks! You're dedicated! Multiplier now 1.5x!", Multiplier: 1.5},
	{Days: 30, XPReward: 500, BadgeID: "streak_monthly", Message: "30 days! Incredible! Multiplier now 2x!", Multiplier: 2.0},
	{Days: 60, XPReward: 1000, BadgeID: "streak_unstoppable", Message: "60 days! You're unstoppable! Multiplier now 2.5x!", Multiplier: 2.5},
	{Days: 100, XPReward: 2000, BadgeID: "streak_quarterly", Message: "100 DAYS! LEGENDARY! Multiplier now 3x!", Multiplier: 3.0},
	{Days: 180, XPReward: 3000, BadgeID: "streak_half_year", Message: "Half a year! You're in the elite!", Multiplier: 3.0},
	{Days: 365, XPReward: 10000, BadgeID: "streak_legendary", Message: "ONE FULL YEAR! Multiplier now 5x!", Multiplier: 5.0},
}

StreakMilestones defines all streak milestones

View Source
var WeeklyChallenges = []ChallengeDefinition{

	{ID: "weekly_consistency_king", Name: "Consistency King", Description: "Use gsh every day this week", Type: ChallengeTypeWeekly, Category: "streak", Icon: "👑", XPReward: 200, Requirement: 7, Metric: "active_days", Difficulty: DifficultyMedium},
	{ID: "weekly_early_bird", Name: "Early Bird Week", Description: "Execute commands before 7 AM for 5 days", Type: ChallengeTypeWeekly, Category: "streak", Icon: "🐦", XPReward: 150, Requirement: 5, Metric: "early_morning_days", Difficulty: DifficultyHard},

	{ID: "weekly_accuracy_ascent", Name: "Accuracy Ascent", Description: "Improve accuracy by 5% vs last week", Type: ChallengeTypeWeekly, Category: "accuracy", Icon: "📈", XPReward: 200, Requirement: 5, Metric: "accuracy_improvement_pct", Difficulty: DifficultyMedium},
	{ID: "weekly_speed_sprint", Name: "Speed Sprint", Description: "Improve avg command time by 10%", Type: ChallengeTypeWeekly, Category: "speed", Icon: "🏃", XPReward: 200, Requirement: 10, Metric: "speed_improvement_pct", Difficulty: DifficultyMedium},

	{ID: "weekly_500_commands", Name: "500 Commander", Description: "Execute 500 commands this week", Type: ChallengeTypeWeekly, Category: "milestone", Icon: "🎖️", XPReward: 200, Requirement: 500, Metric: "weekly_commands", Difficulty: DifficultyMedium},
	{ID: "weekly_1000_commands", Name: "Thousand Commander", Description: "Execute 1000 commands this week", Type: ChallengeTypeWeekly, Category: "milestone", Icon: "🏅", XPReward: 300, Requirement: 1000, Metric: "weekly_commands", Difficulty: DifficultyHard},
	{ID: "weekly_power_user", Name: "Power User", Description: "Complete all daily challenges this week", Type: ChallengeTypeWeekly, Category: "meta", Icon: "⭐", XPReward: 500, Requirement: 7, Metric: "daily_challenges_completed", Difficulty: DifficultyHard},

	{ID: "weekly_command_explorer", Name: "Command Explorer", Description: "Use 20 commands you've never used before", Type: ChallengeTypeWeekly, Category: "exploration", Icon: "🔍", XPReward: 250, Requirement: 20, Metric: "new_commands_ever", Difficulty: DifficultyHard},
	{ID: "weekly_git_week", Name: "Git Week", Description: "Execute 100 git commands", Type: ChallengeTypeWeekly, Category: "tool", Icon: "🌿", XPReward: 150, Requirement: 100, Metric: "git_commands", Difficulty: DifficultyMedium},

	{ID: "weekly_alias_master", Name: "Alias Master", Description: "Use aliases 100 times this week", Type: ChallengeTypeWeekly, Category: "productivity", Icon: "🔗", XPReward: 200, Requirement: 100, Metric: "weekly_alias_usage", Difficulty: DifficultyMedium},
	{ID: "weekly_pipeline_pro", Name: "Pipeline Pro", Description: "Create 50 pipelines this week", Type: ChallengeTypeWeekly, Category: "productivity", Icon: "🔀", XPReward: 200, Requirement: 50, Metric: "weekly_pipelines", Difficulty: DifficultyMedium},
}

WeeklyChallenges contains all weekly challenge definitions

Functions

func CalculateNewStreak

func CalculateNewStreak(currentStreak int, lastActive time.Time, useFreeze bool, freezesAvailable int) (newStreak int, freezeUsed bool)

CalculateNewStreak calculates what the streak should be

func CanContinueStreak

func CanContinueStreak(lastActive time.Time) bool

CanContinueStreak checks if streak can still be continued (grace period until noon)

func CanPrestige

func CanPrestige(level, currentPrestige int) bool

CanPrestige checks if user can prestige (level 100)

func DaysToNextMilestone

func DaysToNextMilestone(currentStreak int) int

DaysToNextMilestone returns days until next streak milestone

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration in a human-readable way

func GenerateTipID

func GenerateTipID() string

GenerateTipID generates a unique ID for a tip based on content

func GetDailyResetTime

func GetDailyResetTime() time.Time

GetDailyResetTime returns when daily challenges reset (midnight local time)

func GetDailySeed

func GetDailySeed() int64

GetDailySeed returns a seed based on the current date for consistent daily challenges

func GetTimeBasedGreeting

func GetTimeBasedGreeting() string

GetTimeBasedGreeting returns a greeting based on time of day

func GetTimeBasedIcon

func GetTimeBasedIcon() string

GetTimeBasedIcon returns an icon based on time of day

func GetTitleForLevel

func GetTitleForLevel(level int) string

GetTitleForLevel returns the title for a given level

func GetWeeklyResetTime

func GetWeeklyResetTime() time.Time

GetWeeklyResetTime returns when weekly challenges reset (Sunday midnight)

func GetWeeklySeed

func GetWeeklySeed() int64

GetWeeklySeed returns a seed based on the current week

func HashTipContent

func HashTipContent(title, command string) string

HashTipContent creates a hash from tip content for deduplication

func IsStreakActive

func IsStreakActive(lastActive time.Time) bool

IsStreakActive checks if streak should continue based on last active date

func LevelFromTotalXP

func LevelFromTotalXP(totalXP int) int

LevelFromTotalXP calculates level from total XP

func PrestigeMultiplier

func PrestigeMultiplier(prestige int) float64

PrestigeMultiplier returns XP multiplier based on prestige level

func StreakFreezesEarned

func StreakFreezesEarned(currentStreak int) int

StreakFreezesEarned calculates how many freezes have been earned based on streak Earn 1 freeze per week of streak (max 3)

func StreakMultiplier

func StreakMultiplier(streakDays int) float64

StreakMultiplier returns XP multiplier based on streak length

func TierXPRewards

func TierXPRewards() map[AchievementTier]int

TierXPRewards returns XP for each tier

func TimeUntilDailyReset

func TimeUntilDailyReset() time.Duration

TimeUntilDailyReset returns duration until daily reset

func TimeUntilWeeklyReset

func TimeUntilWeeklyReset() time.Duration

TimeUntilWeeklyReset returns duration until weekly reset

func XPForLevel

func XPForLevel(level int) int

XPForLevel calculates the XP required to reach a specific level Uses an exponential curve: XP = 100 * (level^1.5)

func XPForNextLevel

func XPForNextLevel(currentLevel int) int

XPForNextLevel returns XP needed to reach next level from current

func XPProgressInLevel

func XPProgressInLevel(totalXP int, currentLevel int) float64

XPProgressInLevel returns progress towards next level (0.0 to 1.0)

Types

type AchievementCategory

type AchievementCategory string

AchievementCategory represents the category of an achievement

const (
	CategorySpeed        AchievementCategory = "speed"
	CategoryAccuracy     AchievementCategory = "accuracy"
	CategoryLearning     AchievementCategory = "learning"
	CategoryStreak       AchievementCategory = "streak"
	CategoryProductivity AchievementCategory = "productivity"
	CategoryTimeBased    AchievementCategory = "time_based"
	CategoryMilestone    AchievementCategory = "milestone"
	CategoryGit          AchievementCategory = "git"
	CategorySpecial      AchievementCategory = "special"
)

type AchievementDefinition

type AchievementDefinition struct {
	ID          string
	Name        string
	Description string
	Icon        string
	Category    AchievementCategory
	Tier        AchievementTier
	Requirement int
	XPReward    int
	Secret      bool   // Hidden until unlocked
	Metric      string // What to measure
}

AchievementDefinition defines a single achievement

func GetAchievementByID

func GetAchievementByID(id string) *AchievementDefinition

GetAchievementByID returns an achievement definition by ID

func GetAchievementsByCategory

func GetAchievementsByCategory(category AchievementCategory) []AchievementDefinition

GetAchievementsByCategory returns all achievements in a category

func GetAchievementsByTier

func GetAchievementsByTier(tier AchievementTier) []AchievementDefinition

GetAchievementsByTier returns all achievements of a tier

func GetVisibleAchievements

func GetVisibleAchievements() []AchievementDefinition

GetVisibleAchievements returns non-secret achievements

type AchievementTier

type AchievementTier string

AchievementTier represents the tier/rarity of an achievement

const (
	TierBronze   AchievementTier = "bronze"
	TierSilver   AchievementTier = "silver"
	TierGold     AchievementTier = "gold"
	TierPlatinum AchievementTier = "platinum"
	TierDiamond  AchievementTier = "diamond"
)

type ChallengeDefinition

type ChallengeDefinition struct {
	ID          string
	Name        string
	Description string
	Type        ChallengeType
	Category    string // speed, accuracy, productivity, exploration
	Icon        string
	XPReward    int
	Requirement int
	Metric      string
	Difficulty  ChallengeDifficulty
}

ChallengeDefinition defines a single challenge

func GetRandomDailyChallenges

func GetRandomDailyChallenges(count int, seed int64) []ChallengeDefinition

GetRandomDailyChallenges returns a set of daily challenges for today

func GetWeeklyChallenges

func GetWeeklyChallenges(count int, seed int64) []ChallengeDefinition

GetWeeklyChallenges returns weekly challenges

type ChallengeDifficulty

type ChallengeDifficulty string

ChallengeDifficulty represents challenge difficulty

const (
	DifficultyEasy   ChallengeDifficulty = "easy"
	DifficultyMedium ChallengeDifficulty = "medium"
	DifficultyHard   ChallengeDifficulty = "hard"
)

type ChallengeType

type ChallengeType string

ChallengeType represents the type of challenge

const (
	ChallengeTypeDaily   ChallengeType = "daily"
	ChallengeTypeWeekly  ChallengeType = "weekly"
	ChallengeTypeSpecial ChallengeType = "special"
)

type CoachAchievement

type CoachAchievement struct {
	ID        uint      `gorm:"primaryKey"`
	CreatedAt time.Time `gorm:"index"`
	UpdatedAt time.Time `gorm:"index"`

	ProfileID     uint    `gorm:"index"`
	AchievementID string  `gorm:"index"`
	Progress      float64 `gorm:"default:0"` // 0.0 to 1.0
	CurrentValue  int     `gorm:"default:0"`
	UnlockedAt    sql.NullTime
	Notified      bool `gorm:"default:false"`
}

CoachAchievement tracks achievement progress for a user

type CoachChallenge

type CoachChallenge struct {
	ID        uint      `gorm:"primaryKey"`
	CreatedAt time.Time `gorm:"index"`

	ProfileID     uint   `gorm:"index"`
	ChallengeID   string `gorm:"index"`
	Type          string // "daily", "weekly", "special"
	StartTime     time.Time
	EndTime       time.Time
	Progress      float64 `gorm:"default:0"`
	CurrentValue  int     `gorm:"default:0"`
	Completed     bool    `gorm:"default:false"`
	RewardClaimed bool    `gorm:"default:false"`
}

CoachChallenge tracks daily/weekly challenge progress

type CoachDailyStats

type CoachDailyStats struct {
	ID        uint   `gorm:"primaryKey"`
	ProfileID uint   `gorm:"uniqueIndex:idx_profile_date"`
	Date      string `gorm:"uniqueIndex:idx_profile_date"` // YYYY-MM-DD format

	// Command Stats
	CommandsExecuted   int `gorm:"default:0"`
	CommandsSuccessful int `gorm:"default:0"`
	CommandsFailed     int `gorm:"default:0"`
	UniqueCommands     int `gorm:"default:0"`
	CommandCount       int `gorm:"default:0"` // For calculating average command time

	// Efficiency Stats
	AliasesUsed     int `gorm:"default:0"`
	PredictionsUsed int `gorm:"default:0"`
	KeystrokesTotal int `gorm:"default:0"`
	KeystrokesSaved int `gorm:"default:0"`
	PipelinesUsed   int `gorm:"default:0"`

	// Time Stats
	TotalSessionTime int `gorm:"default:0"` // Seconds
	AvgCommandTimeMs int `gorm:"default:0"` // Milliseconds
	FastestCommandMs int `gorm:"default:0"` // Milliseconds

	// XP
	XPEarned int `gorm:"default:0"`

	// Detailed breakdowns (JSON)
	HourlyActivity string `gorm:"type:text"` // JSON [24]int - commands per hour
	CommandTypes   string `gorm:"type:text"` // JSON map[string]int - command categories
	Directories    string `gorm:"type:text"` // JSON map[string]int - directories visited
}

CoachDailyStats aggregates daily activity

type CoachDatabaseTip

type CoachDatabaseTip struct {
	ID        uint      `gorm:"primaryKey"`
	CreatedAt time.Time `gorm:"index"`
	UpdatedAt time.Time `gorm:"index"`

	TipID    string `gorm:"uniqueIndex"` // Unique identifier for the tip
	Source   string `gorm:"index"`       // "static" or "llm"
	Category string `gorm:"index"`       // Category like productivity, shortcut, command, etc.
	Icon     string
	Title    string
	Content  string `gorm:"type:text"`
	Priority int    `gorm:"default:5"` // 1-10, higher = more likely to show

	// LLM-specific fields
	Reasoning  string `gorm:"type:text"` // Why this tip is relevant (for LLM tips)
	Command    string // Related command
	Suggestion string `gorm:"type:text"` // Actionable suggestion
	Impact     string // Estimated impact
	BasedOn    string `gorm:"type:text"` // JSON array of commands this tip is based on

	// Display tracking
	ShownCount  int `gorm:"default:0"`
	LastShownAt sql.NullTime
	Active      bool `gorm:"default:true"` // Whether this tip should be shown
}

CoachDatabaseTip stores all tips (both static and LLM-generated) in the database

type CoachDismissedInsight

type CoachDismissedInsight struct {
	ID          uint   `gorm:"primaryKey"`
	ProfileID   uint   `gorm:"index"`
	InsightHash string `gorm:"index"`
	DismissedAt time.Time
	DismissType string // "skip", "never"
}

CoachDismissedInsight tracks dismissed suggestions

type CoachDisplayContent

type CoachDisplayContent struct {
	Type     string // "tip", "achievement_progress", "achievement_unlock", "challenge", "streak", "insight", "milestone", "fun_fact", "startup"
	Icon     string // Emoji
	Title    string
	Content  string
	Progress float64 // For progress bars (0-1)
	Action   string  // Optional action hint
	Priority int     // Display priority
}

CoachDisplayContent represents content to show in the Assistant Box

func ConvertDatabaseTipToDisplay

func ConvertDatabaseTipToDisplay(tip *CoachDatabaseTip) *CoachDisplayContent

ConvertDatabaseTipToDisplay converts a CoachDatabaseTip to CoachDisplayContent

func ConvertStaticTipToDisplay

func ConvertStaticTipToDisplay(tip *StaticTip) *CoachDisplayContent

ConvertStaticTipToDisplay converts a StaticTip to CoachDisplayContent

type CoachGeneratedTip

type CoachGeneratedTip struct {
	ID        uint      `gorm:"primaryKey"`
	CreatedAt time.Time `gorm:"index"`
	ProfileID uint      `gorm:"index"`

	TipID      string `gorm:"uniqueIndex"`
	Type       string
	Category   string
	Title      string
	Content    string `gorm:"type:text"`
	Reasoning  string `gorm:"type:text"`
	Command    string
	Suggestion string `gorm:"type:text"`
	Impact     string
	Confidence float64
	Priority   int
	Actionable bool
	ActionType string
	BasedOn    string `gorm:"type:text"` // JSON array

	ExpiresAt   time.Time `gorm:"index"`
	ShownCount  int       `gorm:"default:0"`
	LastShownAt sql.NullTime
	Dismissed   bool `gorm:"default:false"`
	Applied     bool `gorm:"default:false"` // If actionable tip was applied
}

CoachGeneratedTip stores LLM-generated tips for persistence

type CoachManager

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

CoachManager coordinates all coach functionality

func NewCoachManager

func NewCoachManager(db *gorm.DB, historyManager *history.HistoryManager, runner *interp.Runner, zapLogger *zap.Logger) (*CoachManager, error)

NewCoachManager creates a new coach manager

func (*CoachManager) GetDailyChallenges

func (m *CoachManager) GetDailyChallenges() []CoachChallenge

GetDailyChallenges returns active daily challenges

func (*CoachManager) GetDisplayContent

func (m *CoachManager) GetDisplayContent() *CoachDisplayContent

GetDisplayContent returns content for the Assistant Box

func (*CoachManager) GetPendingNotifications

func (m *CoachManager) GetPendingNotifications() []CoachNotification

GetPendingNotifications returns and clears pending notifications

func (*CoachManager) GetProfile

func (m *CoachManager) GetProfile() *CoachProfile

GetProfile returns the user profile

func (*CoachManager) GetRandomDatabaseTip

func (m *CoachManager) GetRandomDatabaseTip() *CoachDatabaseTip

GetRandomDatabaseTip returns a random tip from the database Tips are weighted by priority and penalized based on how recently/often they were shown

func (*CoachManager) GetStartupContent

func (m *CoachManager) GetStartupContent() *CoachDisplayContent

GetStartupContent returns content for startup display

func (*CoachManager) GetTodayStats

func (m *CoachManager) GetTodayStats() *CoachDailyStats

GetTodayStats returns today's statistics

func (*CoachManager) GetWeeklyChallenges

func (m *CoachManager) GetWeeklyChallenges() []CoachChallenge

GetWeeklyChallenges returns active weekly challenges

func (*CoachManager) RecordCommand

func (m *CoachManager) RecordCommand(command string, exitCode int, durationMs int64)

RecordCommand records a command execution for gamification

func (*CoachManager) RenderAchievements

func (m *CoachManager) RenderAchievements() string

RenderAchievements renders achievements browser

func (*CoachManager) RenderAllTips

func (m *CoachManager) RenderAllTips() string

RenderAllTips renders a view of all tips in the database

func (*CoachManager) RenderChallenges

func (m *CoachManager) RenderChallenges() string

RenderChallenges renders challenges view

func (*CoachManager) RenderDashboard

func (m *CoachManager) RenderDashboard() string

RenderDashboard renders the main coach dashboard

func (*CoachManager) RenderStats

func (m *CoachManager) RenderStats() string

RenderStats renders detailed statistics

func (*CoachManager) ResetAndRegenerateTips

func (m *CoachManager) ResetAndRegenerateTips() string

ResetAndRegenerateTips clears all tips and generates new ones from the slow LLM This runs synchronously and returns the result message

type CoachNotification

type CoachNotification struct {
	ID        uint      `gorm:"primaryKey"`
	CreatedAt time.Time `gorm:"index"`
	ProfileID uint      `gorm:"index"`

	Type    string // "achievement", "level_up", "challenge", "streak", "milestone"
	Title   string
	Content string `gorm:"type:text"`
	Icon    string
	XPGain  int
	Shown   bool `gorm:"default:false"`
}

CoachNotification stores pending notifications for the user

type CoachProfile

type CoachProfile struct {
	ID        uint      `gorm:"primaryKey"`
	CreatedAt time.Time `gorm:"index"`
	UpdatedAt time.Time `gorm:"index"`

	// Identity
	Username string `gorm:"uniqueIndex"`
	Title    string `gorm:"default:'Shell Novice'"`

	// Progression
	Level     int `gorm:"default:1"`
	CurrentXP int `gorm:"default:0"`
	TotalXP   int `gorm:"default:0"`
	Prestige  int `gorm:"default:0"`

	// Streaks
	CurrentStreak   int `gorm:"default:0"`
	LongestStreak   int `gorm:"default:0"`
	StreakFreezes   int `gorm:"default:0"`
	LastActiveDate  sql.NullTime
	StreakStartDate sql.NullTime

	// Customization
	EquippedBadges string `gorm:"type:text"` // JSON array of badge IDs (max 3)
	Settings       string `gorm:"type:text"` // JSON config

	// Tip generation tracking
	CommandsSinceLastTipGen int          `gorm:"default:0"` // Commands since last LLM tip generation
	LastTipGenTime          sql.NullTime // When tips were last generated
	TipsSeeded              bool         `gorm:"default:false"` // Whether static tips have been seeded
}

CoachProfile stores user gamification state

type CoachTipFeedback

type CoachTipFeedback struct {
	ID        uint `gorm:"primaryKey"`
	CreatedAt time.Time
	ProfileID uint   `gorm:"index"`
	TipID     string `gorm:"index"`
	Feedback  string // "helpful", "not_helpful", "already_knew", "applied"
	Comment   string `gorm:"type:text"`
}

CoachTipFeedback stores user feedback on tips

type CoachTipHistory

type CoachTipHistory struct {
	ID         uint   `gorm:"primaryKey"`
	ProfileID  uint   `gorm:"index"`
	TipID      string `gorm:"index"`
	ShownAt    time.Time
	ShownCount int `gorm:"default:1"`
}

CoachTipHistory tracks shown tips to avoid repetition

type CommandFrequency

type CommandFrequency struct {
	Command   string
	Count     int
	LastUsed  time.Time
	ErrorRate float64
}

CommandFrequency tracks how often a command is used

type CommandSequence

type CommandSequence struct {
	Commands []string
	Count    int
	Context  string // Directory or time-based
}

CommandSequence tracks frequently occurring command sequences

type CommandXPValue

type CommandXPValue struct {
	SuccessfulCommand  int
	UsedAlias          int
	UsedPrediction     int
	FastCommand        int // Under 50ms
	FirstCommandOfDay  int
	FirstCommandOfHour int
	NewCommandUsed     int
	PipelineUsed       int
	NoErrorStreak10    int
}

CommandXPValue returns base XP for various command activities

func DefaultCommandXP

func DefaultCommandXP() CommandXPValue

DefaultCommandXP returns default XP values

type ErrorPattern

type ErrorPattern struct {
	Pattern    string
	Count      int
	Command    string
	ErrorType  string // "not_found", "permission", "syntax", "typo"
	Suggestion string
}

ErrorPattern tracks recurring error patterns

type GeneratedTip

type GeneratedTip struct {
	ID          string    `json:"id"`
	Type        TipType   `json:"type"`
	Category    string    `json:"category"`
	Title       string    `json:"title"`
	Content     string    `json:"content"`
	Reasoning   string    `json:"reasoning"`
	Command     string    `json:"command"`
	Suggestion  string    `json:"suggestion"`
	Impact      string    `json:"impact"`
	Confidence  float64   `json:"confidence"`
	Priority    int       `json:"priority"`
	Actionable  bool      `json:"actionable"`
	ActionType  string    `json:"action_type"`
	GeneratedAt time.Time `json:"generated_at"`
	ExpiresAt   time.Time `json:"expires_at"`
	BasedOn     []string  `json:"based_on"`
}

GeneratedTip represents an LLM-generated personalized tip

type Insight

type Insight struct {
	ID          string
	Category    InsightCategory
	Priority    int // 1-10, higher = more important
	Title       string
	Description string
	Command     string
	Suggestion  string
	Impact      string
	Difficulty  string // "easy", "medium", "hard"
	Actionable  bool
	LearnMore   string
}

Insight represents a productivity insight

type InsightCategory

type InsightCategory string

InsightCategory represents categories for generated insights

const (
	InsightAlias           InsightCategory = "alias_suggestion"
	InsightTypo            InsightCategory = "typo_pattern"
	InsightError           InsightCategory = "error_pattern"
	InsightProductivity    InsightCategory = "productivity_tip"
	InsightLearning        InsightCategory = "learning_opportunity"
	InsightWorkflow        InsightCategory = "workflow_optimization"
	InsightTimeManagement  InsightCategory = "time_management"
	InsightToolDiscovery   InsightCategory = "tool_discovery"
	InsightSecurityTip     InsightCategory = "security_tip"
	InsightGitWorkflow     InsightCategory = "git_workflow"
	InsightDirectoryNav    InsightCategory = "directory_navigation"
	InsightCommandChaining InsightCategory = "command_chaining"
)

type LLMTipGenerator

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

LLMTipGenerator generates personalized tips using LLM

func NewLLMTipGenerator

func NewLLMTipGenerator(
	runner *interp.Runner,
	historyManager *history.HistoryManager,
	coachManager *CoachManager,
	logger *zap.Logger,
) *LLMTipGenerator

NewLLMTipGenerator creates a new LLM tip generator

func (*LLMTipGenerator) GenerateBatchTips

func (g *LLMTipGenerator) GenerateBatchTips(ctx context.Context, count int) ([]*GeneratedTip, error)

GenerateBatchTips generates multiple tips at once

func (*LLMTipGenerator) GenerateBatchTipsWithSlowModel

func (g *LLMTipGenerator) GenerateBatchTipsWithSlowModel(ctx context.Context, count int) ([]*GeneratedTip, error)

GenerateBatchTipsWithSlowModel generates multiple tips using the slow LLM model This is used for background tip generation that takes user history into account

func (*LLMTipGenerator) GenerateBatchTipsWithSlowModelProgress

func (g *LLMTipGenerator) GenerateBatchTipsWithSlowModelProgress(ctx context.Context, count int, progress *ProgressIndicator) ([]*GeneratedTip, error)

GenerateBatchTipsWithSlowModelProgress generates tips with optional progress indicator

func (*LLMTipGenerator) GenerateTip

func (g *LLMTipGenerator) GenerateTip(ctx context.Context) (*GeneratedTip, error)

GenerateTip generates a single personalized tip

func (*LLMTipGenerator) GetCachedTip

func (g *LLMTipGenerator) GetCachedTip() *GeneratedTip

GetCachedTip returns a cached tip if available

type LevelUpInfo

type LevelUpInfo struct {
	OldLevel int
	NewLevel int
	OldTitle string
	NewTitle string
	XPToNext int
	Unlocks  []string // Features unlocked at this level
}

LevelUpInfo contains information about a level up

func CheckLevelUp

func CheckLevelUp(oldTotalXP, newTotalXP int) *LevelUpInfo

CheckLevelUp checks if user leveled up and returns info

type PrestigeInfo

type PrestigeInfo struct {
	CurrentPrestige int
	NewPrestige     int
	BonusMultiplier float64
	StarPrefix      string
}

PrestigeInfo contains information for prestige

func GetPrestigeInfo

func GetPrestigeInfo(currentPrestige int) *PrestigeInfo

GetPrestigeInfo returns info about prestiging

type ProgressIndicator

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

ProgressIndicator displays an animated lightning bolt with a message

func NewProgressIndicator

func NewProgressIndicator(message string) *ProgressIndicator

NewProgressIndicator creates a new progress indicator with the given message

func (*ProgressIndicator) AddWords

func (p *ProgressIndicator) AddWords(count int)

AddWords adds to the word count

func (*ProgressIndicator) Start

func (p *ProgressIndicator) Start()

Start begins the animation

func (*ProgressIndicator) Stop

func (p *ProgressIndicator) Stop()

Stop stops the animation and clears the line

func (*ProgressIndicator) StopWithMessage

func (p *ProgressIndicator) StopWithMessage(message string)

StopWithMessage stops the animation and prints a final message

func (*ProgressIndicator) UpdateMessage

func (p *ProgressIndicator) UpdateMessage(message string)

UpdateMessage updates the message being displayed

func (*ProgressIndicator) UpdateWordCount

func (p *ProgressIndicator) UpdateWordCount(count int)

UpdateWordCount updates the word count being displayed

type StaticTip

type StaticTip struct {
	ID       string
	Category TipCategory
	Icon     string
	Title    string
	Content  string
	Priority int // Higher = more likely to show
}

StaticTip represents a predefined tip

func GetAllStaticTipsByCategory

func GetAllStaticTipsByCategory(category TipCategory) []StaticTip

GetAllStaticTipsByCategory returns all tips in a category

func GetRandomStaticTip

func GetRandomStaticTip() *StaticTip

GetRandomStaticTip returns a random static tip

func GetStaticTipByCategory

func GetStaticTipByCategory(category TipCategory) *StaticTip

GetStaticTipByCategory returns a random tip from a specific category

func GetStaticTipByID

func GetStaticTipByID(id string) *StaticTip

GetStaticTipByID returns a specific tip by ID

type StreakMilestone

type StreakMilestone struct {
	Days       int
	XPReward   int
	BadgeID    string
	Message    string
	Multiplier float64
}

StreakMilestone represents a streak milestone with rewards

func GetCurrentStreakMilestone

func GetCurrentStreakMilestone(days int) *StreakMilestone

GetCurrentStreakMilestone returns the highest achieved milestone

func GetNextStreakMilestone

func GetNextStreakMilestone(days int) *StreakMilestone

GetNextStreakMilestone returns the next milestone to achieve

func GetStreakMilestone

func GetStreakMilestone(days int) *StreakMilestone

GetStreakMilestone returns the milestone for a given streak day if it's a milestone

type TipCache

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

TipCache manages a cache of generated tips

func NewTipCache

func NewTipCache(maxSize int, ttl time.Duration) *TipCache

NewTipCache creates a new tip cache

func (*TipCache) Add

func (c *TipCache) Add(tip *GeneratedTip)

Add adds a tip to the cache

func (*TipCache) Clear

func (c *TipCache) Clear()

Clear removes all tips from cache

func (*TipCache) GetAll

func (c *TipCache) GetAll() []*GeneratedTip

GetAll returns all cached tips

func (*TipCache) GetByType

func (c *TipCache) GetByType(tipType TipType) *GeneratedTip

GetByType returns a tip of a specific type

func (*TipCache) GetHighPriority

func (c *TipCache) GetHighPriority() *GeneratedTip

GetHighPriority returns the highest priority tip not shown today

func (*TipCache) GetRandom

func (c *TipCache) GetRandom() *GeneratedTip

GetRandom returns a random tip that hasn't been shown today

func (*TipCache) GetRecentIDs

func (c *TipCache) GetRecentIDs(limit int) []string

GetRecentIDs returns IDs of recent tips

func (*TipCache) MarkShown

func (c *TipCache) MarkShown(tipID string)

MarkShown marks a tip as shown today

func (*TipCache) Size

func (c *TipCache) Size() int

Size returns the number of cached tips

type TipCategory

type TipCategory string

TipCategory represents categories for static tips

const (
	TipCategoryProductivity TipCategory = "productivity"
	TipCategoryShortcut     TipCategory = "shortcut"
	TipCategoryCommand      TipCategory = "command"
	TipCategoryGit          TipCategory = "git"
	TipCategoryFunFact      TipCategory = "fun_fact"
	TipCategoryMotivation   TipCategory = "motivation"
)

type TipContext

type TipContext struct {
	Username      string
	Level         int
	Title         string
	CurrentStreak int
	TotalCommands int
	TodayCommands int
	TodayErrors   int
	TodayAccuracy float64
	TopCommands   []commandFreq
	ErrorCommands []commandFreq
	LongCommands  []string
	RecentErrors  []string
	Directories   []string
	GitUsage      int
	PipelineUsage int
	RecentTipIDs  []string
}

TipContext contains all data needed for personalized tip generation

type TipType

type TipType string

TipType represents the category of a tip

const (
	TipTypeProductivity   TipType = "productivity"
	TipTypeEfficiency     TipType = "efficiency"
	TipTypeLearning       TipType = "learning"
	TipTypeErrorFix       TipType = "error_fix"
	TipTypeWorkflow       TipType = "workflow"
	TipTypeAlias          TipType = "alias"
	TipTypeToolDiscovery  TipType = "tool_discovery"
	TipTypeSecurityTip    TipType = "security"
	TipTypeGitWorkflow    TipType = "git"
	TipTypeTimeManagement TipType = "time_management"
	TipTypeFunFact        TipType = "fun_fact"
	TipTypeEncouragement  TipType = "encouragement"
)

type UserStatistics

type UserStatistics struct {
	TotalCommands      int
	TotalSessions      int
	TotalErrors        int
	ErrorRate          float64
	KeystrokesSaved    int
	TimeSavedSeconds   int
	UniqueCommandsUsed int
	AliasUsageRate     float64
	PredictionAccuracy float64
	AvgCommandTimeMs   int
	MostProductiveHour int
	MostProductiveDay  string
}

UserStatistics holds computed statistics for display

type XPReward

type XPReward struct {
	Base             int
	StreakBonus      int
	PrestigeBonus    int
	Total            int
	StreakMultiplier float64
}

XPReward represents a breakdown of XP earned

func CalculateXPReward

func CalculateXPReward(baseXP int, streakDays int, prestige int) XPReward

CalculateXPReward calculates XP reward with all multipliers

Jump to

Keyboard shortcuts

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