User story
As a user who tracks habits, I want the app to compute my current and best streaks so that I can see my momentum at a glance.
Acceptance criteria
Definition of done
npm test and npm run build pass; all new logic lives in src/habits.ts (pure, no DOM/localStorage/window); every new branch is covered by a test in src/habits.test.ts.
Source: REQ-001 (vault/02 - Requirements/REQ-001 - Streaks and momentum.md)
User story
As a user who tracks habits, I want the app to compute my current and best streaks so that I can see my momentum at a glance.
Acceptance criteria
currentStreak(habit: Habit, today: string): numberis added tosrc/habits.ts.today.todayis not completed butyesterday(today − 1 day) is, the streak still counts up through yesterday.0when there is no active streak (no completion ontodayoryesterday).bestStreak(habit: Habit): numberis added tosrc/habits.ts.0for a habit with no completions.todayas aYYYY-MM-DDstring parameter; they never readDate,localStorage, or the DOM.src/habits.test.tscover all of the following cases for each function:0.1.currentStreakreturns1;bestStreakreturns1.npm testandnpm run buildboth pass with no new TypeScript errors.Definition of done
npm testandnpm run buildpass; all new logic lives insrc/habits.ts(pure, no DOM/localStorage/window); every new branch is covered by a test insrc/habits.test.ts.Source: REQ-001 (vault/02 - Requirements/REQ-001 - Streaks and momentum.md)