Add names module for human-readable name resolution

Merged
JE
9mo ago
+823-0

Summary

Adds centralized name resolution allowing users to reference projects, people, and todolists by name instead of numeric IDs. Ported from Fizzy CLI's lib/names.sh pattern.

  • Multi-stage matching: exact → case-insensitive → partial
  • Session-scoped caching: avoids repeated API calls within a command
  • Ambiguity detection: shows all matches when input is ambiguous
  • Helpful suggestions: "did you mean" on not-found errors

New files

  • lib/names.sh - Core resolution functions and integration helpers
  • test/names.bats - 30 tests covering resolution scenarios

API

Core resolvers (return ID or set RESOLVE_ERROR):

resolve_project_id "My Project"    # → 12345
resolve_person_id "alice@co.com"   # → 67890  
resolve_todolist_id "Sprint" "$project_id"

Integration helpers (die on failure with helpful message):

project=$(require_project_id "${project:-}")
assignee=$(require_person_id "$assignee")

Test plan

  • bats test/names.bats - 30 unit tests pass
  • ./test/run.sh - Full suite (374 tests) pass
  • Manual: bcq todos --in "Project Name" resolves correctly