Parent
#44
What to build
Server-side persistence layer reading/writing ~/.t3code/todos.json plus a pure state machine. The web app loads categories from the server and renders them as colored, collapsible section headers.
State machine (todoStore): Pure functions operating on { categories: TodoCategory[], items: TodoItem[] }. At this slice: load from JSON, toggle category collapse (UI-only state, not persisted), reorder categories (in-memory, persisted later).
Persistence (todoPersistence): Reads ~/.t3code/todos.json on startup, writes via atomic write (write to temp file, rename over target). Returns the full state.
WebSocket: todo.load NativeApi method returns the current state to the client.
UI: Categories render as collapsible sections with the category color tinting the header background. Clicking a header toggles collapse/expand. Items are not yet supported — to verify visually, the persistence layer can seed initial data from the JSON file.
Acceptance criteria
Blocked by
Parent
#44
What to build
Server-side persistence layer reading/writing
~/.t3code/todos.jsonplus a pure state machine. The web app loads categories from the server and renders them as colored, collapsible section headers.State machine (
todoStore): Pure functions operating on{ categories: TodoCategory[], items: TodoItem[] }. At this slice: load from JSON, toggle category collapse (UI-only state, not persisted), reorder categories (in-memory, persisted later).Persistence (
todoPersistence): Reads~/.t3code/todos.jsonon startup, writes via atomic write (write to temp file, rename over target). Returns the full state.WebSocket:
todo.loadNativeApi method returns the current state to the client.UI: Categories render as collapsible sections with the category color tinting the header background. Clicking a header toggles collapse/expand. Items are not yet supported — to verify visually, the persistence layer can seed initial data from the JSON file.
Acceptance criteria
todoStoremodule inpackages/sharedwithloadTodos,toggleCategory(collapse),reorderCategoriesfunctionstodoPersistenceinapps/serverreads/writes~/.t3code/todos.jsonatomicallytodo.loadWebSocket NativeApi method wired inapps/server/src/wsServer.tsuseTodoshook inapps/webloads state via WebSocket on mounttodoStore: basic load, toggle collapse, reorder categoriestodoPersistence: round-trip read/write, atomic write integritybun fmt,bun lint,bun typecheckall passBlocked by