feat(tui): archive todos at turn end with incomplete hint

This commit is contained in:
Brooklyn Nicholson 2026-04-26 16:14:58 -05:00
parent 319c1c1691
commit c78b528125
12 changed files with 948 additions and 70 deletions

View file

@ -3,6 +3,7 @@ import { beforeEach, describe, expect, it } from 'vitest'
import {
appendTurnSegment,
archiveDoneTodos,
archiveTodosAtTurnEnd,
getTurnState,
patchTurnState,
resetTurnState,
@ -20,7 +21,7 @@ describe('turnStore live progress helpers', () => {
]
})
expect(archiveDoneTodos()).toEqual([
expect(archiveTodosAtTurnEnd()).toEqual([
{
kind: 'trail',
role: 'system',
@ -34,11 +35,25 @@ describe('turnStore live progress helpers', () => {
expect(getTurnState().todos).toEqual([])
})
it('does not archive active todos', () => {
patchTurnState({ todos: [{ content: 'cook', id: 'cook', status: 'in_progress' }] })
it('archives incomplete todos with an incomplete flag so the hint renders', () => {
patchTurnState({
todos: [
{ content: 'cook', id: 'cook', status: 'completed' },
{ content: 'serve', id: 'serve', status: 'in_progress' },
{ content: 'eat', id: 'eat', status: 'pending' }
]
})
const archived = archiveTodosAtTurnEnd()
expect(archived).toHaveLength(1)
expect(archived[0]!.todoIncomplete).toBe(true)
expect(archived[0]!.todos?.map(t => t.id)).toEqual(['cook', 'serve', 'eat'])
expect(getTurnState().todos).toEqual([])
})
it('returns nothing when there are no todos at turn end', () => {
expect(archiveTodosAtTurnEnd()).toEqual([])
expect(archiveDoneTodos()).toEqual([])
expect(getTurnState().todos).toHaveLength(1)
})
it('tracks collapsed state independently of todo content', () => {