Skip to content

Latest commit

 

History

History
184 lines (134 loc) · 3.82 KB

File metadata and controls

184 lines (134 loc) · 3.82 KB

Behavior

Parse API

loads

Parse markdown string.

store = taskmark.loads(markdown)
store = taskmark.loads(markdown, minutes_per_day=360)
Attribute Value
Input str (markdown)
Output TaskStore
Config minutes_per_day=480

Postconditions:

  • All valid tasks extracted
  • Warnings collected for invalid syntax
  • Inheritance resolved
  • Subtasks sorted by priority

load

Parse file, following [text](file.md) links.

store = taskmark.load(path)
store = taskmark.load(path, minutes_per_day=360)
Attribute Value
Input Path, str, or file object
Output TaskStore
Config minutes_per_day=480

Postconditions:

  • file and line set on each task
  • All linked files parsed
  • Circular links warned
  • Missing links warned

Errors:

  • FileNotFoundError if file missing

TaskStore.check

Raise if warnings exist.

store.check()  # raises ParseError if warnings

Mutation API

update

Update single task in-memory.

result = taskmark.update(store, title, project, changes)
Attribute Value
Input TaskStore, title, project, TaskChanges
Output UpdateResult

Task lookup:

  • Match by exact title
  • Match by project_path (or None for no project)
  • FAIL if no match or multiple matches

UpdateResult.status:

  • SUCCESS - All changes applied
  • PARTIAL - Some changes rejected (see rejected)
  • FAIL - Task not found or ambiguous (see error)

batch_update

Update multiple tasks.

result = taskmark.batch_update(store, updates)
Attribute Value
Input TaskStore, list[TaskUpdateSpec]
Output BatchUpdateResult

Behavior:

  • Each update independent
  • Partial success allowed
  • Returns results for each update

write_updates

Write pending changes to files.

result = taskmark.write_updates(store)
Attribute Value
Input TaskStore with changes
Output WriteResult

Behavior:

  • Process files independently
  • Tasks ordered bottom-up (avoid line drift)
  • Atomic writes (temp file + rename)

State Transitions

From To Behavior
any done Set done_date to today
done other Clear done_date
any blocked Set paused_date to today
blocked open Clear paused_date
recurring + done - Clone task, advance planned_date
any cancelled Remove recurrence

Recurrence

When a recurring task is marked done:

  1. Original task is marked done (with done_date)
  2. recurrence field is removed from completed task
  3. New task is created with:
    • State: open
    • planned_date: next occurrence calculated from pattern
    • recurrence: pattern preserved
    • Inherited metadata: from headings (not explicit task metadata)

Next Occurrence Calculation

Pattern Type Strategy
Simple (daily, weekly) Add 1 unit to base date
Multiplied (2weeks, 3d) Add N units to base date
Day of month (15th, 31st) Next occurrence, clamped to month end
Nth weekday (2nd-tuesday) Next Nth weekday (may skip months)
Natural language Parsed via recurrent library

Base date priority:

  1. planned_date (if set)
  2. due_date (if set)
  3. Today's date

Error Handling

Condition Action
Invalid date Warn, skip field
Invalid duration Warn, skip field
Malformed key:value Warn, skip field
List item without checkbox Warn
Circular file link Warn, skip
Missing linked file Warn, continue
Non-UTF-8 file Raise ParseError
Missing file Raise FileNotFoundError