INNER CODE UNIT · TypeScript
earnedXp
vibeeval/vibecosystem · hooks/src/achievement-tracker.ts:166
const earnedXp = Math.round(baseXp * multiplier);
state.unlocked[id] = { unlockedAt: new Date().toISOString(), xp: earnedXp };
state.xp += earnedXp;
state.level = calcLevel(state.xp);
const name = ACHIEVEMENT_NAMES[id] ?? id;
const bonusStr = multiplier > 1 ? ` (${multiplier}x streak bonus)` : '';
celebrations.push(
`ACHIEVEMENT UNLOCKED: "${name}" +${earnedXp} XP${bonusStr} | Total: ${state.xp} XP | Level ${state.level}`
);
}
function detectLanguage(filePath: unknown): string | null {
if (typeof filePath !== 'string') return null;
const ext = extname(filePath).toLowerCase().replace('.', '');
const known = ['ts', 'tsx', 'js', 'jsx', 'py', 'go', 'rs', 'java', 'cs', 'rb', 'swift', 'kt', 'cpp', 'c'];
return known.includes(ext) ? ext : null;