Commit graph

5 commits

Author SHA1 Message Date
f372a691d4
feat(status): add status subcommand with day and week metrics
- Add status.py with compute_day_status() and compute_week_status()
- Add projected_hours_for_day(): for each entry, use its duration if
  closed, or the next entry's start time as the close time if open
- Open entries (start present, end absent) are preserved by the parser
  instead of being skipped; aggregate_rows() skips them for summaries
- Expected end is computed by filling remaining hours into available
  time slots from the open entry's start; clamped to latest_end if a
  pre-logged entry ends later, with a note explaining why
- Projected week total sums projected_hours_for_day() across all days
- Add status subcommand to cli.py with shared source/day arguments
- Add [work] daily_hours / weekly_hours config keys (default 8 / 40)
- Add timesheets.example.toml [work] section
- Add tests for projected_hours_for_day, compute_day_status,
  compute_week_status and all DayStatus/WeekStatus fields
2026-06-02 09:31:08 +02:00
d5dbe8791b
fix(parser): allow blank lines within a table block
Blank (whitespace-only) lines inside a table no longer split it into
separate blocks. They are buffered and discarded if more table rows
follow, enabling patterns like pre-filling a recurring meeting entry
with a blank line separating it from the rest of the day's entries.
2026-06-02 09:31:07 +02:00
ecdd28e8a3
feat(joplin): add --joplin flag to fetch weekly timesheet note from Joplin
- Add joplin.py with fetch_week_note() that walks Work > Timesheets > YYYY
  and returns the body of the matching YYYY-WNN note via joppy ClientApi
- Add filter_rows_by_date() to parser.py to extract only rows belonging
  to a specific day based on '# ... YYYY-MM-DD' headings in the document
- Update cli.py: input and --joplin are now a mutually exclusive required
  group; add --token flag with JOPLIN_TOKEN env var fallback; --date is
  parsed into a real date object used for both output and day filtering
- Add joppy as a runtime dependency (lazy-imported in cli.py)
- Add tests for filter_rows_by_date and full mocked coverage of joplin.py
- Update AGENTS.md with Joplin usage, notebook structure, and test rules

The actual Joplin structure has notes directly inside the year notebook
(Work > Timesheets > YYYY), not in per-week sub-notebooks as initially
assumed. fetch_week_note() reflects this flat structure.
2026-06-02 09:31:02 +02:00
d6689a6c83
feat(parser): support multiple tables in a single markdown document
- Add extract_table_blocks() to split a document into contiguous table
  blocks, ignoring prose, headings, and blank lines between them
- Add parse_document() as the new top-level entry point that runs
  extract_table_blocks + detect_has_duration_column + parse_table per
  block and returns a combined flat list of rows
- Guard against empty End cells (e.g. in-progress rows) by validating
  the end field before calculating duration
- Update cli.py to use parse_document() instead of the manual
  detect + parse combo
- Add tests for extract_table_blocks and parse_document, including two
  smoke tests against the real 2026-W21 weekly timesheet file
2026-06-02 09:31:02 +02:00
7bea08ddac
feat: set up modularized version of project with testing 2026-06-02 09:31:01 +02:00