Skip to content

feat: redesign todo tool with structured API and key-based operations - #163

Merged
avoidwork merged 4 commits into
mainfrom
feat/fix-todo-tool
Jun 10, 2026
Merged

feat: redesign todo tool with structured API and key-based operations#163
avoidwork merged 4 commits into
mainfrom
feat/fix-todo-tool

Conversation

@avoidwork

@avoidwork avoidwork commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Description

Full redesign of the todo tool to make it agent-friendly. Replaces unstructured string responses with structured JSON, numeric IDs with semantic string keys, and adds missing actions (delete, list) with proper input validation.

Type of Change

  • Breaking change (API: string responses → structured JSON, id → key, create array → single item)
  • Bugfix
  • New feature
  • Documentation update
  • Refactor
  • Performance improvement
  • CI / build / tooling

Testing

  • 24 unit tests covering all 7 actions (read, create, update, complete, delete, list, clear)
  • Input validation tests for all required fields
  • Duplicate key rejection, not-found errors, filter behavior, maxTodos enforcement
  • All tests pass, lint passes, formatting passes

Coverage

  • 100% line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with 100% line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Implementation

src/tools/todo.js — Full rewrite

  • Structured JSON responses — Every action returns { ok: true/false, ... } with errors in an error field
  • String keys — Replaced numeric id with semantic key (e.g., "fix-login-bug")
  • New actions — Added delete (remove single todo) and list (with pending/completed filter)
  • Input validation — Every action validates required fields before I/O via validateRequired()
  • Simplified create — Single { key, content, completed? } instead of array
  • Runtime optionsfilePath and maxTodos configurable via factory

tests/unit/tool_todos.test.js — Full rewrite

  • 24 tests covering all actions, validation, edge cases
  • Uses configurable temp directory for isolation

Archived

OpenSpec change fix-todo-tool archived to openspec/changes/archive/2026-06-10-fix-todo-tool/. Delta spec synced to openspec/specs/todo-tool/spec.md.

@avoidwork avoidwork self-assigned this Jun 10, 2026
@avoidwork
avoidwork force-pushed the feat/fix-todo-tool branch from 4699d38 to c578e03 Compare June 10, 2026 22:01
@avoidwork avoidwork changed the title feat: propose todo tool redesign with structured API feat: redesign todo tool with structured API and key-based operations Jun 10, 2026
@avoidwork
avoidwork merged commit 77ba7be into main Jun 10, 2026
3 of 4 checks passed
@avoidwork
avoidwork deleted the feat/fix-todo-tool branch June 10, 2026 22:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant