Skip to content

Add task-level drop/undrop support - #44

Open
Packetslave wants to merge 2 commits into
stephendolan:mainfrom
Packetslave:feature/task-drop-support
Open

Add task-level drop/undrop support#44
Packetslave wants to merge 2 commits into
stephendolan:mainfrom
Packetslave:feature/task-drop-support

Conversation

@Packetslave

Copy link
Copy Markdown

Summary

Projects could already be dropped (status: "dropped"), but individual tasks had no
way to be dropped at all — update_task/task update only ever supported
completed. OmniFocus's own JXA API exposes dropping as a task method,
task.drop(allOccurrences, dateDropped), distinct from the
completed/markComplete pattern, so it needed its own option rather than reusing
completed.

Changes

  • task update --drop / --undrop (CLI), dropped boolean param on the MCP
    update_task tool
  • Undrop restores via task.active = truedropDate is read-only, so drop()
    has no direct inverse; this is OmniFocus's own documented pattern for
    restoring a dropped task. Guarded so --undrop is a no-op on a completed
    task rather than risking a silent un-complete (active isn't drop-specific).
  • Also fixes a pre-existing bug in serializeTask's dropped field: it read
    task.dropped, which is always undefined via this JXA bridge regardless of
    actual state (confirmed via a direct osascript probe). Now derives it from
    dropDate !== null, which is reliably populated. Bundled here because the new
    flag would otherwise be unobservable in JSON output — flagging explicitly
    since it changes existing serialization behavior, not just adds new behavior.
  • Note: dropped reflects a task's own drop state, not inheritance from a
    dropped parent project (mirrors how completed already works) — a task in a
    dropped project reports dropped: false but effectivelyActive: false.

Testing

  • bun run typecheck, bun run test (24/24), bun run lint all pass
  • Live end-to-end against real OmniFocus: drop → dropDate set,
    effectiveActive/active → false; undrop → both cleared/restored;
    undrop-on-a-completed-task → confirmed no-op (completed stays true)

Tasks could already be filtered by dropped status, but there was no way
to actually drop one — only projects supported it, via the status enum.
OmniFocus's JXA API exposes this as task.drop(allOccurrences, dateDropped),
distinct from the completed/markComplete pattern.

- task update --drop / --undrop (CLI), dropped param (MCP update_task)
- Undrop restores via task.active = true (dropDate is read-only, so
  drop() has no direct inverse — this is OmniFocus's own documented
  pattern for restoring a dropped task)
- Fixed serializeTask's dropped field, which read task.dropped — a
  property that is always undefined via this JXA bridge regardless of
  actual state (confirmed via direct osascript probe). It now derives
  dropped status from dropDate !== null, which is reliably populated.

Verified end-to-end against live OmniFocus: drop sets dropDate and
flips effectiveActive/active to false; undrop clears both.
An adversarial review flagged that task.active = true isn't specific to
"dropped" — calling it on a completed task could silently un-complete it,
an untested edge case in the original patch. Undrop is now a no-op on a
completed task (verified live: completed stays true after --undrop).

Also tightened the MCP dropped field's description to match the house
style of sibling completed/flagged fields.
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