generated from nhcarrigan/template
feat: add persistent lifetime stats and sync achievements
- Add lifetime stats persistence to Rust backend - Sync achievement state between frontend and backend on startup - Add commands for loading/saving stats to disk - Expand achievement definitions with 150+ new achievements - Fix stats store to properly track total vs session metrics
This commit is contained in:
+1128
-83
File diff suppressed because it is too large
Load Diff
@@ -104,10 +104,11 @@ export async function initStatsListener() {
|
||||
stats.set(newStats);
|
||||
});
|
||||
|
||||
// Load initial stats from backend
|
||||
// Load initial persisted stats from backend (no bridge required)
|
||||
try {
|
||||
const initialStats = await invoke<UsageStats>("get_usage_stats");
|
||||
const initialStats = await invoke<UsageStats>("get_persisted_stats");
|
||||
stats.set(initialStats);
|
||||
console.log("Loaded persisted stats:", initialStats);
|
||||
} catch (error) {
|
||||
console.error("Failed to load initial stats:", error);
|
||||
}
|
||||
|
||||
+173
-18
@@ -14,34 +14,52 @@ export type AchievementId =
|
||||
| "GrowingStrong" // 10,000 tokens
|
||||
| "BlossomingCoder" // 100,000 tokens
|
||||
| "TokenMaster" // 1,000,000 tokens
|
||||
| "TokenBillionaire" // 10,000,000 tokens
|
||||
| "TokenTreasure" // 50,000,000 tokens
|
||||
|
||||
// Code Generation
|
||||
| "HelloWorld" // First code block
|
||||
| "CodeWizard" // 100 code blocks
|
||||
| "ThousandBlocks" // 1,000 code blocks
|
||||
| "CodeFactory" // 5,000 code blocks
|
||||
| "CodeEmpire" // 10,000 code blocks
|
||||
|
||||
// File Operations
|
||||
| "FileManipulator" // 10 files edited
|
||||
| "FileArchitect" // 100 files edited
|
||||
| "FileEngineer" // 500 files edited
|
||||
| "FileLegend" // 1,000 files edited
|
||||
|
||||
// Conversation milestones
|
||||
| "ConversationStarter" // 10 messages
|
||||
| "ChattyKathy" // 100 messages
|
||||
| "Conversationalist" // 1,000 messages
|
||||
| "ChatMarathon" // 5,000 messages
|
||||
| "ChatLegend" // 10,000 messages
|
||||
|
||||
// Tool usage
|
||||
| "Toolsmith" // 5 different tools
|
||||
| "ToolMaster" // 10 different tools
|
||||
|
||||
// Time-based achievements
|
||||
| "EarlyBird" // Started session 5-7 AM
|
||||
| "NightOwl" // Coding after midnight
|
||||
| "AllNighter" // Worked 2-5 AM
|
||||
| "WeekendWarrior" // Coding on weekend
|
||||
| "DedicatedDeveloper" // 30 days in a row
|
||||
|
||||
// Search and exploration
|
||||
| "Explorer" // 50 searches
|
||||
| "MasterSearcher" // 500 searches
|
||||
|
||||
// Session achievements
|
||||
| "QuickSession" // Productive session < 5 min
|
||||
| "FocusedWork" // 30 min session
|
||||
| "DeepDive" // 2 hour session
|
||||
| "MarathonSession" // 5+ hour session
|
||||
| "UltraMarathon" // 8 hour session
|
||||
| "CodingRetreat" // 12 hour session
|
||||
|
||||
// Special achievements
|
||||
| "FirstMessage" // First message sent
|
||||
| "FirstTool" // First tool used
|
||||
@@ -51,28 +69,165 @@ export type AchievementId =
|
||||
| "SpeedCoder" // 10 code blocks in 10 minutes
|
||||
| "ClaudeConnoisseur" // Used all Claude models
|
||||
| "MarathonCoder" // 10k tokens in one session
|
||||
|
||||
// Relationship & Greetings
|
||||
| "GoodMorning" // Said good morning
|
||||
| "GoodNight" // Said good night
|
||||
| "ThankYou" // Said thank you
|
||||
| "LoveYou" // Said love you
|
||||
| "GoodMorning" // Say "good morning"
|
||||
| "GoodNight" // Say "good night" or "goodnight"
|
||||
| "ThankYou" // Say "thank you" or "thanks"
|
||||
| "LoveYou" // Say "love you" or "ily"
|
||||
| "HelloHikari" // Say "hello hikari" or "hi hikari"
|
||||
| "HowAreYou" // Ask "how are you"
|
||||
| "MissedYou" // Say "missed you"
|
||||
| "BackAgain" // Say "i'm back" or "back again"
|
||||
|
||||
// Personality & Fun
|
||||
| "EmojiUser" // Used 20+ emojis
|
||||
| "CapsLock" // ALL CAPS MESSAGE
|
||||
| "QuestionMaster" // Asked 50 questions
|
||||
| "PleaseAndThankYou" // Polite user
|
||||
| "EmojiUser" // Use an emoji in a message
|
||||
| "QuestionMaster" // Use "?" in 20 messages
|
||||
| "CapsLock" // Send a message in ALL CAPS
|
||||
| "PleaseAndThankYou" // Use "please" in messages
|
||||
|
||||
// Emotional
|
||||
| "Frustrated" // Say "frustrated" or "ugh" or "argh"
|
||||
| "Excited" // Say "excited" or "yay" or "woohoo"
|
||||
| "Confused" // Say "confused" or "don't understand"
|
||||
| "Curious" // Ask "why" or "how does"
|
||||
| "Impressed" // Say "wow" or "amazing" or "incredible"
|
||||
|
||||
// Git & Development
|
||||
| "CommitMaster" // 100 commits
|
||||
| "PRO" // Created 10 PRs
|
||||
| "Reviewer" // Reviewed 10 PRs
|
||||
| "IssueTracker" // Created 25 issues
|
||||
| "GitGuru" // Used git commands
|
||||
| "GitGuru" // Use git commands 10 times
|
||||
| "TestWriter" // Create test files
|
||||
| "Debugger" // Fix bugs (messages with "fix", "bug", "error")
|
||||
| "CommitKing" // 50 commits
|
||||
| "CommitLegend" // 200 commits
|
||||
| "BranchMaster" // Create 10 branches
|
||||
| "MergeExpert" // Merge 20 PRs
|
||||
| "ConflictResolver" // Resolve merge conflicts
|
||||
|
||||
// Tool Mastery
|
||||
| "BashMaster" // Used bash 100 times
|
||||
| "FileExplorer" // Searched files 100 times
|
||||
| "SearchExpert" // Advanced searches
|
||||
| "AgentCommander" // Used task agents
|
||||
| "MCPMaster"; // Used MCP tools
|
||||
| "BashMaster" // Use Bash tool 50 times
|
||||
| "FileExplorer" // Use Read tool 100 times
|
||||
| "SearchExpert" // Use Grep tool 50 times
|
||||
| "EditMaster" // Use Edit tool 100 times
|
||||
| "WriteMaster" // Use Write tool 50 times
|
||||
| "GlobMaster" // Use Glob tool 100 times
|
||||
| "TaskMaster" // Use Task tool 50 times
|
||||
| "WebFetcher" // Use WebFetch tool 20 times
|
||||
| "McpExplorer" // Use MCP tools 50 times
|
||||
|
||||
// Daily Streaks
|
||||
| "WeekStreak" // 7 days in a row
|
||||
| "TwoWeekStreak" // 14 days in a row
|
||||
| "MonthStreak" // 30 days in a row
|
||||
| "QuarterStreak" // 90 days in a row
|
||||
|
||||
// Time Challenges
|
||||
| "MorningPerson" // 10 sessions started before 9 AM
|
||||
| "NightCoder" // 10 sessions after 10 PM
|
||||
| "LunchBreakCoder" // Session during 12-1 PM
|
||||
| "CoffeeTime" // Session during 3-4 PM
|
||||
|
||||
// Day-specific
|
||||
| "MondayMotivation" // Coding on Monday
|
||||
| "FridayFinisher" // Coding on Friday
|
||||
| "HumpDay" // Coding on Wednesday
|
||||
|
||||
// Seasonal/Special Times
|
||||
| "NewYearCoder" // Coding on January 1st
|
||||
| "ValentinesDev" // Coding on February 14th
|
||||
| "SpookyCode" // Coding on October 31st
|
||||
| "HolidayCoder" // Coding on December 25th
|
||||
| "LeapDayCoder" // Coding on February 29th
|
||||
|
||||
// Message Content
|
||||
| "LongMessage" // Send a message over 500 characters
|
||||
| "NovelWriter" // Send a message over 2000 characters
|
||||
| "ShortAndSweet" // Complete a task with messages under 50 chars each
|
||||
| "CodeInMessage" // Include code block in user message
|
||||
| "MarkdownMaster" // Use markdown formatting in message
|
||||
|
||||
// Programming Languages
|
||||
| "RustDeveloper" // Generate Rust code
|
||||
| "PythonDeveloper" // Generate Python code
|
||||
| "JavaScriptDev" // Generate JavaScript code
|
||||
| "TypeScriptDev" // Generate TypeScript code
|
||||
| "GoDeveloper" // Generate Go code
|
||||
| "CppDeveloper" // Generate C++ code
|
||||
| "JavaDeveloper" // Generate Java code
|
||||
| "HtmlCssDev" // Generate HTML/CSS code
|
||||
| "SqlDeveloper" // Generate SQL code
|
||||
| "ShellScripter" // Generate shell/bash scripts
|
||||
| "FullStackDev" // Generate code in 10+ languages
|
||||
|
||||
// Project Types
|
||||
| "FrontendDev" // Work on frontend files
|
||||
| "BackendDev" // Work on backend files
|
||||
| "ConfigEditor" // Edit config files
|
||||
| "DocWriter" // Edit documentation
|
||||
|
||||
// Error Handling
|
||||
| "ErrorHunter" // Fix 10 errors
|
||||
| "ExceptionSlayer" // Fix 50 errors
|
||||
| "BugExterminator" // Fix 100 bugs
|
||||
|
||||
// Refactoring
|
||||
| "CleanCoder" // Refactor code
|
||||
| "Optimizer" // Optimize performance
|
||||
| "Simplifier" // Simplify complex code
|
||||
|
||||
// Testing
|
||||
| "TestNovice" // Write 10 tests
|
||||
| "TestEnthusiast" // Write 50 tests
|
||||
| "TestMaster" // Write 100 tests
|
||||
| "CoverageKing" // Achieve test coverage mentions
|
||||
|
||||
// Documentation
|
||||
| "Documenter" // Write documentation
|
||||
| "CommentWriter" // Add comments to code
|
||||
| "ReadmeHero" // Create/edit README files
|
||||
|
||||
// API & Integration
|
||||
| "ApiExplorer" // Work with APIs
|
||||
| "DatabaseDev" // Work with databases
|
||||
| "CloudCoder" // Work with cloud services
|
||||
|
||||
// Special Milestones
|
||||
| "CenturyClub" // 100 sessions
|
||||
| "ThousandSessions" // 1000 sessions
|
||||
| "Veteran" // Used Hikari for 30+ days total
|
||||
| "OldTimer" // Used Hikari for 90+ days total
|
||||
| "Loyalist" // Used Hikari for 365+ days total
|
||||
|
||||
// Fun & Easter Eggs
|
||||
| "Perfectionist" // Redo something 5 times
|
||||
| "Persistent" // Ask same question 3 times
|
||||
| "Patient" // Wait for long response
|
||||
| "Speedy" // Send 10 messages in 1 minute
|
||||
|
||||
// UI Exploration
|
||||
| "MultiTasker" // Multiple conversations
|
||||
| "Minimalist" // Use compact mode
|
||||
| "PrivacyFirst" // Use streamer mode
|
||||
| "ThemeChanger" // Change themes
|
||||
| "SettingsTweaker" // Adjust settings
|
||||
|
||||
// Achievement Meta
|
||||
| "AchievementHunter" // Unlock 25 achievements
|
||||
| "Completionist" // Unlock 50 achievements
|
||||
| "MasterUnlocker" // Unlock 100 achievements
|
||||
| "PlatinumStatus" // Unlock all achievements
|
||||
|
||||
// Clipboard & Snippets
|
||||
| "ClipboardCollector" // Use clipboard history
|
||||
| "SnippetCreator" // Create a snippet
|
||||
| "SnippetMaster" // Create 20 snippets
|
||||
|
||||
// Other Features
|
||||
| "QuickActionUser" // Use quick actions
|
||||
| "HistoryBuff" // Browse history
|
||||
| "Archivist" // Export sessions
|
||||
| "SessionExporter" // Export a session
|
||||
| "GitPanelUser" // Use Git panel
|
||||
| "FeatureExplorer"; // Use 10+ features
|
||||
|
||||
export interface Achievement {
|
||||
id: AchievementId;
|
||||
|
||||
Reference in New Issue
Block a user