[
  {
    "title": "Implement TodoStore class in src/store.ts",
    "type": "feature",
    "priority": "high",
    "tool": "__TOOL__",
    "description": "Implement the TodoStore class in src/store.ts. Requirements:\n- Load/save todos from JSON file (path from TODO_FILE env or ~/.todo-app/todos.json)\n- Auto-create storage directory on first use\n- CRUD: create(input) -> Todo, getById(id), getAll(), update(id, input), delete(id)\n- Stats: stats() -> TodoStats with counts by status and priority\n- Atomic writes: write to .tmp file then rename\n- Use crypto.randomUUID() for IDs, ISO 8601 dates\n- Import types from ./types.js\n__SPEC_CONTEXT__",
    "context_files": ["spec.md", "src/types.ts", "src/store.ts"]
  },
  {
    "title": "Implement output formatters in src/format.ts",
    "type": "feature",
    "priority": "medium",
    "tool": "__TOOL__",
    "description": "Implement formatting functions in src/format.ts:\n- shortId(id): return first 8 chars of UUID\n- colorPriority(priority): ANSI color codes (red=high, yellow=medium, green=low)\n- formatTodoRow(todo): single line '[x] short-id  title  priority'\n- formatTodoDetail(todo): multi-line with all fields\n- formatStats(stats): summary with counts and percentages\n- Import types from ./types.js\n__SPEC_CONTEXT__",
    "context_files": ["spec.md", "src/types.ts", "src/store.ts", "src/format.ts"]
  },
  {
    "title": "Implement CLI commands in src/commands.ts",
    "type": "feature",
    "priority": "high",
    "tool": "__TOOL__",
    "description": "Implement command handler functions in src/commands.ts:\n- addCommand(title, options): create todo via store, print confirmation\n- listCommand(options): list todos, optional --filter done/pending, --priority high/medium/low\n- showCommand(id): show detail view, exit 2 if not found\n- doneCommand(id): mark done, print confirmation\n- undoneCommand(id): mark not done\n- editCommand(id, options): update fields (--title, --description, --priority)\n- removeCommand(id): delete, print confirmation\n- statsCommand(): print stats using format.ts\n- clearCommand(options): remove all done todos, require --yes flag\n- Use TodoStore from ./store.js and formatters from ./format.js\n- Handle errors gracefully, exit(1) on error, exit(2) on not-found\n__SPEC_CONTEXT__",
    "context_files": ["spec.md", "src/types.ts", "src/store.ts", "src/format.ts", "src/commands.ts"]
  },
  {
    "title": "Implement CLI entry point in src/index.ts",
    "type": "feature",
    "priority": "high",
    "tool": "__TOOL__",
    "description": "Implement the CLI entry point in src/index.ts using Commander.js:\n- Import { Command } from 'commander'\n- Register all commands: add, list, show, done, undone, edit, remove, stats, clear\n- add: argument <title>, options --description/-d, --priority/-p (default medium)\n- list: options --filter/-f (all/done/pending), --priority\n- show/done/undone/remove: argument <id>\n- edit: argument <id>, options --title, --description, --priority\n- clear: option --yes/-y\n- stats: no arguments\n- Set version from package.json or hardcode '0.1.0'\n- Add shebang: #!/usr/bin/env node\n- Import commands from ./commands.js\n__SPEC_CONTEXT__",
    "context_files": ["spec.md", "src/types.ts", "src/store.ts", "src/format.ts", "src/commands.ts", "src/index.ts"]
  },
  {
    "title": "Write unit tests for TodoStore in tests/store.test.ts",
    "type": "test",
    "priority": "high",
    "tool": "__TOOL__",
    "description": "Write comprehensive unit tests for TodoStore in tests/store.test.ts:\n- Use vitest (describe, it, expect, beforeEach, afterEach)\n- Use a temp directory (fs.mkdtempSync) for each test, clean up after\n- Set TODO_FILE env var to point to temp dir\n- Test: create a todo → verify all fields\n- Test: list empty store returns []\n- Test: list after adding 3 todos returns 3\n- Test: update title, priority, done status\n- Test: delete by ID\n- Test: getById returns undefined for non-existent ID\n- Test: stats returns correct counts\n- Test: persistence — create, new store instance, verify data preserved\n- Import TodoStore from ../src/store.js\nAt least 10 test cases.",
    "context_files": ["spec.md", "src/types.ts", "src/store.ts", "tests/store.test.ts"]
  },
  {
    "title": "Write integration tests for CLI in tests/commands.test.ts",
    "type": "test",
    "priority": "medium",
    "tool": "__TOOL__",
    "description": "Write integration tests for CLI command handlers in tests/commands.test.ts:\n- Test the command functions from ../src/commands.js\n- Use temp directory for store\n- Test add + list roundtrip\n- Test done/undone toggling\n- Test remove\n- Test stats output\n- At least 5 test cases.",
    "context_files": ["spec.md", "src/types.ts", "src/store.ts", "src/format.ts", "src/commands.ts", "tests/commands.test.ts"]
  },
  {
    "title": "npm install, build, and verify project compiles",
    "type": "task",
    "priority": "critical",
    "tool": "none",
    "description": "Run npm install, npm run build, npm run typecheck in the project directory.\nThis is a verification step — if it fails, a human ticket will be created.",
    "context_files": ["spec.md", "package.json", "src/index.ts", "src/commands.ts", "src/store.ts", "src/format.ts", "tests/store.test.ts", "tests/commands.test.ts"]
  }
]
