Commit graph

14 commits

Author SHA1 Message Date
Barrett Ruth
3a35fab6cf feat: overdue highlighting, relative dates, undo write, buffer mappings (#1)
* feat(config): add category_order field

Problem: category display order was always insertion order with no way
to configure it.

Solution: add category_order to config defaults so users can declare a
preferred category ordering; unspecified categories append after.

* feat(parse): add relative date resolution

Problem: due dates required full YYYY-MM-DD input, adding friction for
common cases like "today" or "next monday".

Solution: add resolve_date() supporting today, tomorrow, +Nd, and
weekday abbreviations; extend inline token parsing to resolve relative
values before falling back to strict date validation.

* feat(views): overdue flag, category in priority view, category ordering

Problem: overdue tasks were visually indistinct from upcoming ones;
priority view had no category context; category display order was not
configurable.

Solution: compute overdue meta flag for pending tasks past their due
date; set show_category on priority view task meta; reorder categories
according to config.category_order when present.

* feat(buffer): overdue highlight, category virt text in priority view

Problem: overdue tasks had no visual distinction; priority view showed
no category context alongside due dates.

Solution: add PendingOverdue highlight group; render category name as
right-aligned virtual text in priority view, composited with the due
date when both are present.

* feat(init): undo write and buffer-local default mappings

Problem: _undo_state was captured on every save but never consumed;
toggle_priority and prompt_date had no buffer-local defaults, requiring
manual <Plug> configuration.

Solution: implement undo_write() to restore pre-save task state; add !,
d, and U as buffer-local defaults following fugitive's philosophy of
owning the buffer; expose :Pending undo as a command alias.

* test(views): add views spec

Problem: views.lua had no test coverage.

Solution: add 26 tests covering category_view and priority_view
including sort order, line format, overdue detection, show_category
meta, and category_order config behavior.

* test(archive): add archive spec

Problem: archive had no test coverage.

Solution: add 9 tests covering cutoff logic, custom day counts, pending
task preservation, deleted task cleanup, and notify output.

* docs: add vimdoc

Problem: no :help documentation existed.

Solution: add doc/pending.txt covering all features — commands,
mappings, views, configuration, Google Calendar sync, highlight groups,
data format, and health check — following standard vimdoc conventions.

* ci: format

* fix: resolve lint and type check errors

Problem: selene flagged unused variables in new spec files; LuaLS
flagged os.date/os.time return type mismatches, integer? assignments,
and stale task.Task/task.GcalConfig type references.

Solution: prefix unused spec variables with _ or drop unnecessary
assignments; add --[[@as string/integer]] casts for os.date and
os.time calls; add category_order field to pending.Config annotation;
fix task.GcalConfig -> pending.GcalConfig and task.Task[] ->
pending.Task[]; add nil guards on meta[row].id before store calls;
cast store.data() return to non-optional.

* ci: format

* fix: sync

* ci: format
2026-02-24 18:33:07 -05:00
53ab1cc000 feat: rename 2026-02-24 15:21:44 -05:00
4f60433684 fix: resolve selene lint warnings and errors
Problem: unused variables (undo_state, sha_result, date match
captures) and duplicate if/else branches in gcal sync triggered
selene warnings and errors.

Solution: prefix unused state with underscore, simplify date
validation to a single pattern match, remove dead sha_result
call, and merge duplicate event deletion branches into a single
condition.
2026-02-24 15:20:06 -05:00
6f7959cb18 fix: correct buffer parser and timestamp test
Problem: parse_buffer classified /id/-prefixed task lines as headers
because '/' matches the '^%S' header pattern. Store timestamp test
was flaky when add and update ran within the same second.

Solution: check for task line patterns (id prefix or 2-space indent)
before falling through to the header branch. Backdate the initial
modified timestamp in the store update test.
2026-02-24 15:19:59 -05:00
41b06387be ci: format 2026-02-24 15:17:24 -05:00
dfe09ef721 feat(health): add checkhealth integration
Problem: need a way to diagnose config, data file, and
dependency issues.

Solution: add health module reporting config values, data
directory status, task count, and curl/openssl availability.
2026-02-24 15:09:58 -05:00
65fb1bb258 feat(gcal): add one-way Google Calendar sync
Problem: need to push tasks with due dates to Google Calendar
as all-day events.

Solution: add gcal module with OAuth 2.0 loopback flow, PKCE,
token refresh, calendar creation, and event CRUD. Maps pending
tasks to all-day events, deletes events on completion, and
stores event IDs in task _extra for round-trip.
2026-02-24 15:09:50 -05:00
9807c7af80 feat: add commands, mappings, and plugin entry point
Problem: need user-facing :Todo command, buffer-local keymaps,
Plug mappings, completion toggle, help float, archive, and
syntax highlighting.

Solution: add init.lua with command dispatcher, toggle complete/
priority, date prompt, archive purge, and help float. Add
plugin/todo.lua entry point with :Todo command and Plug mappings.
Add syntax/todo.vim for conceal and priority highlighting.
2026-02-24 15:09:43 -05:00
79cef994ce feat(diff): add buffer-to-store diff algorithm
Problem: need to reconcile buffer edits against the JSON store
on :w, handling creates, deletes, updates, reorders, and
duplicate IDs from yank/paste.

Solution: add diff module that parses buffer lines, matches
against stored tasks by ID, creates new tasks for unknown or
duplicate IDs, marks removed tasks as deleted, and updates
changed fields.
2026-02-24 15:09:36 -05:00
a102092cca feat(buffer): add scratch buffer with concealment and extmarks
Problem: need a buffer to display tasks with concealed IDs,
virtual text due dates, strikethrough for done items, and
auto-indent.

Solution: add buffer module with acwrite scratch buffer, syntax
conceal for /id/ prefixes, right-aligned due date extmarks,
header/done highlighting, indentexpr, and view toggling.
2026-02-24 15:09:29 -05:00
3a5aa5bcc3 feat(views): add category and priority view renderers
Problem: need to render task lists grouped by category or sorted
by priority with concealed IDs and metadata.

Solution: add category_view and priority_view functions that
produce buffer lines with hidden /id/ prefixes, priority flags,
and line metadata for extmark placement.
2026-02-24 15:09:22 -05:00
09fb896a34 feat(parse): add inline metadata parser
Problem: need to extract due dates and categories from task
descriptions typed in the buffer.

Solution: add right-to-left token parser for configurable date
syntax (default 'due:') and cat: metadata keys. Supports
Category: prefix syntax for :Todo add commands.
2026-02-24 15:09:15 -05:00
62b1b020a3 feat(store): add JSON data store with CRUD operations
Problem: need persistent task storage with forward-compatible
schema and unknown field preservation.

Solution: add store module with load/save, add/update/delete,
ID allocation, and UDA round-trip preservation. Data stored at
stdpath('data')/todo/tasks.json with version 1 schema.
2026-02-24 15:09:07 -05:00
88d060f0ed feat(config): add configuration module
Problem: need user-configurable settings with sensible defaults.

Solution: add config module that merges vim.g.todo with defaults
for data_path, default_view, default_category, date_format, and
date_syntax.
2026-02-24 15:08:59 -05:00