Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 29 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Track time entries, manage clients and projects, set billing rates, mark work as
- **Clients & Projects** — full CRUD on one tab: the clients with this month's hours, earnings and unbilled, and the selected client's projects beside them
- **Billing rates** — set an hourly rate per client; earnings calculated automatically
- **Invoice & payment tracking** — mark entries as invoiced and/or paid
- **Reports** — aggregated hours, earnings, invoice status by project/client with quick date presets
- **Reports** — hours, earned, outstanding and unbilled for any range, hours by day, each client with its projects, and CSV export
- **Pure Go** — no CGo, no C compiler needed; cross-compiles trivially
- **Single binary** — one file, zero runtime dependencies

Expand Down Expand Up @@ -127,7 +127,7 @@ notch delete --project <id> --task "t" # delete every entry of one task, t

In `clients -json` and `projects -json`, `monthSeconds` and `monthEarned` are this calendar month's finished time and its value at the client's current rate, clipped to the 1st at local midnight like `summary`'s totals; `unbilled` is every finished entry not yet invoiced, from any date, the same as `summary`'s. All three leave out the running timer, and a client's are its projects' added up, rounded to cents once. `--rate` takes a plain number from 0 to 1,000,000 (`85`, `92.50`; not `$85`). Client names are unique, and so are project names within a client: a clash is an error, not a merge. Names can't be empty or contain tabs or line breaks. `delete` refuses, saying how many entries would go (and whether the running timer is one of them), when a client or project has tracked entries, unless you pass `--yes`; with none it deletes straight away, a client's empty projects included. `-json` on `add` and `edit` prints the result in the list's shape; on `delete`, `{"id":1,"projects":2,"entries":14}`.

`report` covers the entries that started on the range's local dates, like `entries --from/--to`, so a timer that runs past midnight counts on its start day; it leaves out the running timer until it stops. `--range` presets end today (`week` starts on Monday); `all`, or leaving out `--from` or `--to`, opens that side. `-json`'s `outstanding` is the range's invoiced-but-unpaid earnings and `unbilled` its not-yet-invoiced ones (unlike `summary`'s, which cover every date), and `averageRate` is `earned` over the hours. `days` lists every date of the range, 0 for a day with no time; an open side starts or ends at the first or last entry instead, and a span longer than a year lists only the dates from the first entry to the last. Times are in seconds, like the other commands' JSON. The TUI's Reports tab doesn't use this code yet (ALI-2618): it reads start dates in UTC, so near midnight it can put an entry on a different day than `report` does. Money is at each client's current rate, rounded to cents once per row, so a client's `earned` can differ by a cent from adding up its projects'. In `--csv`, `start` and `end` are local date and time (an entry can end the next day), `hours` is rounded to two places, and a cell that a spreadsheet would read as a formula (starting, after any spaces, with `=`, `+`, `-`, `@`, a tab or a carriage return) gets a leading apostrophe, which stays in the text if you import the file elsewhere.
`report` covers the entries that started on the range's local dates, like `entries --from/--to`, so a timer that runs past midnight counts on its start day; it leaves out the running timer until it stops. `--range` presets end today (`week` starts on Monday); `all`, or leaving out `--from` or `--to`, opens that side. `-json`'s `outstanding` is the range's invoiced-but-unpaid earnings and `unbilled` its not-yet-invoiced ones (unlike `summary`'s, which cover every date), and `averageRate` is `earned` over the hours. `days` lists every date of the range, 0 for a day with no time; an open side starts or ends at the first or last entry instead, and a span longer than a year lists only the dates from the first entry to the last. Times are in seconds, like the other commands' JSON. The TUI's Reports tab uses the same code, so for the same range its cards, bars and table show the numbers `report -json` prints. Money is at each client's current rate, rounded to cents once per row, so a client's `earned` can differ by a cent from adding up its projects'. In `--csv`, `start` and `end` are local date and time (an entry can end the next day), `hours` is rounded to two places, and a cell that a spreadsheet would read as a formula (starting, after any spaces, with `=`, `+`, `-`, `@`, a tab or a carriage return) gets a leading apostrophe, which stays in the text if you import the file elsewhere.

Without `--task`, `entries` lists every entry whose local start date falls in `--from`…`--to` (either side optional; neither means all time), like the TUI's Timers list, so a late-night timer counts on the day it started; `--query` keeps tasks containing the text, ignoring case. `earned` is the entry's time at its client's current hourly rate, rounded to cents, and counts the running entry's time so far, which `summary`'s totals leave out (add it yourself, as with the seconds). `summary` counts finished entries only, clipped to local day and week boundaries, so a status bar can add the running entry's elapsed time itself and tick locally (clipping it to local midnight and to Monday if it started before them). Its `earnedToday` and `earnedWeek` are clipped the same way; `unbilled` is every finished entry not yet invoiced and `outstanding` every one invoiced but not paid, from any date (the TUI's Reports card "Outstanding" is both together). Totals are rounded to cents once, so show these rather than adding up each entry's `earned`, which can differ by a cent. The plain-text `summary` is unchanged. `edit --start/--end` take RFC3339 or local `YYYY-MM-DD HH:MM`, with the same rules as the TUI's edit form (the end can't be before the start), and neither can be in the future; `--notes ""` clears notes. A whole-task `edit` renames and/or moves the task, merging it into an existing one if the result matches. `--invoiced` and `--paid` take `=true` or `=false` (write the `=`: `--invoiced false` is rejected) and follow the TUI's rules: an entry is paid only once it's invoiced, so `--paid` on an uninvoiced entry fails unless you pass `--invoiced` too; `--invoiced=false` also clears paid; and a running timer can't be invoiced or paid unless the same edit gives it an `--end`. A rejected edit changes nothing, on one entry or a whole task. The one exception is a timer that another process starts in the task mid-edit, which can leave behind a client or project created by `--client-name` or `--project-name`. A whole-task `edit -json` lists every entry of the resulting task, including any it merged into. `delete` doesn't prompt: callers confirm first. Edits and deletes that match nothing exit non-zero.

Expand Down Expand Up @@ -260,24 +260,24 @@ The clients, each with its rate and this month's hours, earned and unbilled (unb

### Reports tab

| Key | Action |
| --------- | ------------------------ |
| `↑` / `k` | Move cursor up |
| `↓` / `j` | Move cursor down |
| `f` | Open date filter |
| `t` | Quick filter: Today |
| `w` | Quick filter: This week |
| `m` | Quick filter: This month |
| `y` | Quick filter: This year |
| `a` | Show all time |

### Reports date filter

| Key | Action |
| ------------------- | ------------------------------- |
| `tab` / `shift+tab` | Switch between From / To fields |
| `enter` | Apply filter |
| `esc` | Cancel |
| Key | Action |
| --------------------------- | ------------------------------------------------------------ |
| `↑` / `k` | Move cursor up |
| `↓` / `j` | Move cursor down |
| `t` / `w` / `m` / `y` / `a` | Range: today, this week, this month, this year, all time |
| `f` | Range: custom dates (opens a form; blank leaves a side open) |
| `e` | Export the range's entries as CSV to your downloads folder |
| `enter` | Show the entries behind the selected client or project |

In the entries list, `e` edits the selected entry and `esc` goes back.

### Reports custom range

| Key | Action |
| ------------------- | ------------------------------------- |
| `tab` / `shift+tab` | Move between From, To and the buttons |
| `enter` | Apply |
| `esc` | Cancel |

---

Expand All @@ -298,20 +298,13 @@ The TUI, the CLI, `notch watch` and the bar panel can all have the database open

## Reports

The Reports tab groups all time entries by **Client → Project** and shows:

- **Hours** — total tracked hours
- **Entries** — number of time entries
- **Invoiced** — how many entries are marked invoiced
- **Paid** — how many entries are marked paid
- **Earned** — hours × client hourly rate
The Reports tab covers the finished entries that started in the chosen range (this month when it opens), with the same code as `notch report`, so the numbers match `notch report -json` for the same range. The running timer counts once it stops. It shows:

Summary cards at the bottom show totals for the selected period:
- **Stat cards** — the range's hours and entries, what they earned (and the average rate), what's outstanding (invoiced, not paid) and what's unbilled (not invoiced yet)
- **By day** — hours as bars, each with its hours written under it; a range with more days than fit shows a bar per week, month or year instead
- **By client and project** — each client, with its projects under it: hours, how many entries are invoiced and paid, and earned (hours × the client's current rate)

- Total Hours
- Total Earned
- Outstanding (earned but not fully paid)
- Uninvoiced entries count
`e` exports the range's entries as CSV, the same rows as `notch report --csv`, to your downloads folder (`XDG_DOWNLOAD_DIR`, else `~/Downloads`, else your home folder, skipping one it can't write to). Only you can read the file, since it holds earnings and notes. It is named for the range, such as `notch-2026-11-30-to-2026-12-03.csv`; if that name is taken, the export gets ` (2)`, ` (3)` and so on, so it never overwrites a file. The status line shows where it went.

---

Expand Down Expand Up @@ -346,7 +339,10 @@ notch/
├── timers_view.go # Timers list screen: hero, range chips, day groups, detail pane
├── clients.go # Clients tab — clients with their totals beside the selected client's projects
├── projects.go # Project form and delete confirm, opened from the Clients tab
└── reports.go # Reports tab — date-filtered summary + cards
├── reports.go # Reports tab — ranges, custom range form, entries behind a row
├── reports_view.go # Reports screen: range chips, stat cards, hours bars, client table
├── reports_export.go # Reports CSV export to the downloads folder
└── money.go # Fitting amounts to a column without cutting them
```

---
Expand Down
4 changes: 2 additions & 2 deletions cli_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package main

// The "report" command (ALI-2613): a date range's totals, hours by day and
// rows by client and project, for scripts and the bar panel.
// internal/report does the work, which the TUI's Reports tab and CSV
// export are to use too (ALI-2618).
// internal/report does the work, which the TUI's Reports tab and its CSV
// export use too (ALI-2618).

import (
"flag"
Expand Down
12 changes: 12 additions & 0 deletions design/build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,18 @@ func renderPalette(t *Tokens) ([]byte, error) {
{"tui-modal-min-width", "ModalMinWidth"},
{"tui-strip-min", "StripMin"},
{"tui-field-width", "FieldWidth"},
{"tui-card-gap", "CardGap"},
{"tui-bar-width", "BarWidth"},
{"tui-bar-gap", "BarGap"},
{"tui-bar-rows", "BarRows"},
{"tui-bar-rows-compact", "BarRowsCompact"},
{"tui-report-col-hours", "ReportColHours"},
{"tui-report-col-count", "ReportColCount"},
{"tui-report-col-earned", "ReportColEarned"},
{"tui-report-trail", "ReportTrail"},
{"tui-report-indent", "ReportIndent"},
{"tui-card-pad", "CardPad"},
{"tui-report-min-rows", "ReportMinRows"},
{"tui-client-name-min", "ClientNameMin"},
{"tui-client-col-rate", "ClientColRate"},
{"tui-client-col-hours", "ClientColHours"},
Expand Down
14 changes: 13 additions & 1 deletion design/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,19 @@
{ "name": "tui-modal-min-width", "value": 20, "usage": "TUI: the narrowest a modal gets, border included, however narrow the body is." },
{ "name": "tui-strip-min", "value": 8, "usage": "TUI: the narrowest a form field's bg_alt strip gets in a modal." },
{ "name": "tui-field-width", "value": 44, "usage": "TUI: a form field's width when the form opens; the modal sets it to its strip's width each time it draws." },
{ "name": "tui-min-width", "value": 64, "usage": "TUI: the narrowest terminal notch draws, in cells, measured from the views: the Clients list's fixed columns and gutter take 47 cells, leaving its CLIENT column 13 at this width; the compact Timers range chips need 48. Narrower terminals get a centred \"Terminal too small\" message." },
{ "name": "tui-card-gap", "value": 2, "usage": "TUI: blank columns between the Reports tab's four stat cards (hours, earned, outstanding, unbilled), which share the rest of the width." },
{ "name": "tui-bar-width", "value": 5, "usage": "TUI: a Reports hours bar's width, in cells. Crowded ranges get narrower bars, never narrower than their labels." },
{ "name": "tui-bar-gap", "value": 4, "usage": "TUI: blank columns between Reports hours bars; crowded ranges close it to one." },
{ "name": "tui-bar-rows", "value": 5, "usage": "TUI: the Reports hours bars' height in the wide layout, in rows of eighth blocks." },
{ "name": "tui-bar-rows-compact", "value": 3, "usage": "TUI: the Reports hours bars' height in the compact layout (under tui-wide columns, or short terminals), so the client table keeps its rows." },
{ "name": "tui-report-col-hours", "value": 10, "usage": "TUI: the Reports table's HOURS column, right-aligned, room for 1000:00:00 and a gap." },
{ "name": "tui-report-col-count", "value": 10, "usage": "TUI: the Reports table's INVOICED and PAID columns, each right-aligned." },
{ "name": "tui-report-col-earned", "value": 13, "usage": "TUI: the Reports table's EARNED column, right-aligned, room for $100,000.00 and a gap." },
{ "name": "tui-report-trail", "value": 2, "usage": "TUI: blank columns after the Reports table's EARNED column." },
{ "name": "tui-card-pad", "value": 1, "usage": "TUI: blank columns inside a Reports stat card's border, on each side of its text." },
{ "name": "tui-report-min-rows", "value": 3, "usage": "TUI: the fewest client and project rows the Reports table keeps; the hours bars go before it gets fewer." },
{ "name": "tui-report-indent", "value": 2, "usage": "TUI: how far a project's name sits in from its client's in the Reports table." },
{ "name": "tui-min-width", "value": 64, "usage": "TUI: the narrowest terminal notch draws, in cells, measured from the views: the Clients list's fixed columns and gutter take 47 cells, leaving its CLIENT column 13 at this width; the compact Timers range chips need 48, and the Reports range chips 58. Narrower terminals get a centred \"Terminal too small\" message." },
{ "name": "tui-min-height", "value": 22, "usage": "TUI: the shortest terminal notch draws, in rows: the chrome (4), the body's top and bottom padding (2), the compact Timers screen's fixed rows (14) and two list rows (a day header and the selected entry). A wide terminal this short gets the compact layout, since the wide one needs 23 rows (see tui-wide). Shorter terminals get a centred \"Terminal too small\" message." },
{ "name": "tui-chrome-rows", "value": 4, "usage": "TUI: rows taken by the chrome: the tab bar and its rule at the top, and a rule and the hotkey and status line at the bottom (measured from their real output). Content gets the rest." },
{ "name": "panel-padding", "value": "14px", "usage": "Bar panel: inner padding, from aliasOS's KeyboardPanel." }
Expand Down
6 changes: 2 additions & 4 deletions internal/report/report.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Package report builds notch's time and money report for a date range:
// the totals, hours by day, and rows by client and project that the
// redesigned TUI Reports tab and the bar panel show, and the per-entry CSV
// both export. "notch report" prints it. The TUI's Reports tab (ALI-2618)
// and the panel (ALI-2622) are to switch to this package; until then the
// TUI's tab still uses db.ReportByProject, which reads start dates in UTC,
// so near midnight the two can put an entry on different days.
// both export. "notch report" prints it, and the TUI's Reports tab
// (ALI-2618) draws from it; the panel (ALI-2622) is to switch to it too.
package report

import (
Expand Down
50 changes: 50 additions & 0 deletions internal/theme/tokens_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading