No new runtime dependency
Do not add a package to dependencies in package.json: the project's runtime dependencies are the ones it already has. Development tools may go in devDependencies.
TSDoc on every exported function
Every exported function has a TSDoc comment, /** … */, right before it: what it does, and what its parameters are.
No wall clock or randomness in the domain
Code under src/domain/ does not read the clock or make random values: no Date.now(), no new Date() without arguments, no Math.random(), no random identifiers.
Errors are returned as a Result in the domain
Code under src/domain/ never throws: an operation that can fail returns a Result, with an error that says what went wrong.
Tidy Tasks conventions
The project is a TypeScript ESM package ("type": "module", strict, erasableSyntaxOnly) that runs .ts files directly on Node. Follow what the code already does.
- Test with
npm test(node --test "test/*.test.ts",node:testandnode:assert/strict). There is no build step and no test dependency: do not introduce a framework, a bundler or a transpiler. - Imports of local files carry the
.tsextension; type-only imports useimport type. - No TypeScript syntax that needs transpiling: no
enum, nonamespace, no constructor parameter properties. Use union types andas const-style constants (seePRIORITIES). - Domain values are immutable:
readonlyfields, and operations return new values instead of mutating. - Failures are
Resultvalues built withok()anderr(), with aTodoErrorCodeand a message fit for the person using the app. A new kind of failure adds a code toTodoErrorCode. - Titles are trimmed and are the key of a task; the list is ordered by
compareTasks(open first, then most urgent, then title). Keep listings in that stable order. src/index.tsis the only public API the app's screens use: export new public functions and types from it, and keep internals out of it.- Tests go in
test/*.test.ts, drive the list throughsrc/index.ts, and cover a happy path and an error or edge path for each behaviour (for exampleduplicate,not-found,invalid-state). - Comments: TSDoc on exported functions and interfaces, written as plain sentences; no commented-out code.