Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
44c84db
test(tui): add Ratatui app coverage
alxhall Mar 6, 2026
0b7b384
test(tui): fix cherry-picked tests for current master API (start_time…
alxhall Mar 12, 2026
105ccbc
refactor(tui): move parse_date_weekday to shared ui utils
alxhall Mar 12, 2026
03b2310
feat(tui): add format_hours_hm utility
alxhall Mar 12, 2026
ecff1f1
feat(tui): show daily total hours in this-week panel separators
alxhall Mar 12, 2026
f77e4c3
feat(tui): show daily total hours in history view separators
alxhall Mar 12, 2026
761ba2c
feat(tui): merge daily totals in separator labels
alxhall Mar 12, 2026
cd05d97
feat(tui): add TemplateConfig to TokiConfig
alxhall Mar 12, 2026
e31c2b5
feat(tui): add template fields and filter_templates to App
alxhall Mar 12, 2026
cbcb16b
feat(tui): add SelectTemplate view variant and navigation
alxhall Mar 12, 2026
aeaf689
feat(tui): add ApplyTemplate action and handler
alxhall Mar 12, 2026
18655e3
feat(tui): add SelectTemplate key handler, App input methods, and UI …
alxhall Mar 12, 2026
68c2a58
feat(tui): bind M to template picker in timer view
alxhall Mar 12, 2026
fa80a22
feat(tui): show [M] Template hint in controls bar when templates conf…
alxhall Mar 12, 2026
7747602
feat(tui): merge entry templates feature (Phase 2)
alxhall Mar 12, 2026
eaf0bd7
fix(tui): rename TokiConfig field templates -> template so [[template…
alxhall Mar 12, 2026
c8493b8
fix(tui): colon separator in template picker, rebind T->template G->t…
alxhall Mar 12, 2026
6c27359
feat(tui): add word-boundary methods to TextInput
alxhall Mar 12, 2026
d0dff00
feat(tui): add word-navigation App wrapper methods
alxhall Mar 12, 2026
55cc4d0
feat(tui): word navigation in description and cwd inputs
alxhall Mar 12, 2026
ef59e74
feat(tui): word navigation in project/activity search inputs
alxhall Mar 12, 2026
af12fa5
feat(tui): word navigation in history/timer edit-mode note field
alxhall Mar 12, 2026
777abb3
feat(tui): merge word-boundary navigation
alxhall Mar 12, 2026
b7540c9
feat(tui): word navigation in template search input
alxhall Mar 12, 2026
588f584
feat(tui): add log_notes module and open_editor helper
alxhall Mar 12, 2026
5d77e3f
feat(tui): add OpenLogNote action and handler
alxhall Mar 12, 2026
5130a16
feat(tui): bind Ctrl+L to open log note in description editor
alxhall Mar 12, 2026
78168c7
feat(tui): strip log tag in all note display locations and add log in…
alxhall Mar 12, 2026
30e6593
feat(tui): handle OpenLogNote in history edit mode
alxhall Mar 12, 2026
dc55d2b
feat(tui): merge extended log notes feature (Phase 3)
alxhall Mar 12, 2026
2e373bb
fix(tui): polish log notes UI (round 2 bug fixes)
alxhall Mar 12, 2026
5d782de
fix(tui): polish log notes UI (round 3 bug fixes)
alxhall Mar 12, 2026
d210d2c
fix(tui): change log tag format from ·log:ID to [log:ID]
alxhall Mar 12, 2026
bdc7e62
fix(tui): copy log ID when yanking or resuming a history entry
alxhall Mar 12, 2026
ef533bf
refactor(tui): merge Y (copy) into R (resume) — R now copies when tim…
alxhall Mar 12, 2026
90780a4
fix(tui): simplify R hint label back to Resume
alxhall Mar 12, 2026
87bd401
fix(tui): rebind toggle size from G to X
alxhall Mar 12, 2026
9685789
fix(tui): move Z: Zen mode next to X: Toggle size in hints
alxhall Mar 12, 2026
2755b25
fix(tui): rebind Resume to Ctrl+R, move hint to top row after Ctrl+S
alxhall Mar 12, 2026
a416de0
fix(tui): force full redraw on FocusGained to recover after sleep/wake
alxhall Mar 12, 2026
28a6fc2
fix(tui): remove cursor block from note field in inline entry edit row
alxhall Mar 12, 2026
0240f16
fix(tui): rename Stats to Statistics in hint and view title
alxhall Mar 12, 2026
1da07d0
fix(tui): remove redundant closure in generate_id call
alxhall Mar 12, 2026
18c68be
fix(tui): address code review findings
alxhall Mar 12, 2026
30ce5b9
fix(tui): address second round of code review findings
alxhall Mar 12, 2026
625db6e
docs: add design doc for Ctrl+L open log from timer/history views
alxhall Mar 12, 2026
cef3e25
feat(tui): add Action::OpenEntryLogNote variant
alxhall Mar 12, 2026
4722379
feat(tui): add handle_open_entry_log_note handler
alxhall Mar 12, 2026
b5cb700
fix(tui): tighten invalid-id test assertion to check error message pr…
alxhall Mar 12, 2026
48c3351
feat(tui): wire Ctrl+L in timer view to open entry log
alxhall Mar 12, 2026
8e7778a
feat(tui): wire Ctrl+L in history view to open entry log
alxhall Mar 12, 2026
7e8ab77
fix(tui): exclude Ctrl+L from edit-mode field-navigation in history view
alxhall Mar 12, 2026
0c73e82
feat(tui): add Ctrl+L hint to timer and history hint bars
alxhall Mar 12, 2026
ec0d324
chore(tui): shorten hint bar labels for log and save actions
alxhall Mar 12, 2026
8cc8de9
chore(tui): remove old docs
alxhall Mar 12, 2026
869bfbd
feat(tui): add logs-path CLI command and update README
alxhall Mar 12, 2026
5fe22f7
fix(tui): correct template config field name in README (name → descri…
alxhall Mar 13, 2026
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
2 changes: 1 addition & 1 deletion Cargo.lock

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

127 changes: 0 additions & 127 deletions docs/plans/2026-03-02-tui-version-status-commands.md

This file was deleted.

4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,7 @@ tui-version:
# Show toki-tui session and Milltime status
tui-status:
cd toki-tui && cargo run -- status

# Print the log notes directory path
tui-logs:
cd toki-tui && cargo run -- logs-path
2 changes: 1 addition & 1 deletion toki-tui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "toki-tui"
version = "0.2.0"
version = "0.3.0"
edition = "2021"

[dependencies]
Expand Down
150 changes: 111 additions & 39 deletions toki-tui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,38 @@ just tui-dev

# Clear saved session
just tui-logout

# Print config path and create default config if missing
just tui-config
```

## Configuration

Config file: `~/.config/toki-tui/config.toml`
## CLI Commands

Run `just tui-config` (or `cargo run -- config-path`) to print the path and create the file with defaults if it does not exist.
All commands are available via the binary directly (`toki-tui <command>`) or through `just`:

All keys are optional. If the file is missing, built-in defaults are used.
| Command | `just` recipe | Description |
| -------------- | -------------- | -------------------------------------------------- |
| `run` | `just tui` | Run against the real toki-api server |
| `dev` | `just tui-dev` | Run in dev mode with in-memory mock data |
| `login` | `just tui-login` | Authenticate via browser OAuth |
| `logout` | `just tui-logout` | Clear saved session and Milltime cookies |
| `status` | `just tui-status` | Show current login and Milltime session status |
| `config-path` | `just tui-config` | Print config path; create default file if missing |
| `logs-path` | `just tui-logs` | Print the log notes directory path |
| `version` | `just tui-version` | Print the current version |

### Environment variables

You can override config values with environment variables.

- Prefix: `TOKI_TUI_`
- Key format: uppercase snake case
- Nested keys (if added later): use `__` as separator
## Configuration

Current variables:
Config file: `~/.config/toki-tui/config.toml`

```bash
TOKI_TUI_API_URL="http://localhost:8080"
TOKI_TUI_GIT_DEFAULT_PREFIX="Development"
TOKI_TUI_TASK_FILTER="+work project:Toki"
TOKI_TUI_AUTO_RESIZE_TIMER=true
```
Run `just tui-config` (or `toki-tui config-path`) to print the path and create the file with defaults if it does not exist.

Environment variables override values from `config.toml`.
All keys are optional. If the file is missing, built-in defaults are used.

```toml
# URL of the toki-api server. Defaults to the production instance.
api_url = "https://toki-api.spinit.se"

# Prefix used when converting a git branch name to a time entry note,
# when no conventional commit prefix (feat/fix/etc.) or ticket number is found.
# Example: branch "branding/redesign" → "Utveckling: branding/redesign"
# Example: branch "branding/redesign" → "Development: branding/redesign"
git_default_prefix = "Utveckling"

# Taskwarrior filter tokens prepended before `status:pending export`.
Expand All @@ -66,6 +59,32 @@ task_filter = ""
# When true (default), the timer grows large when running and shrinks when stopped.
# Set to false to keep the timer at a fixed (normal) size at all times.
auto_resize_timer = true

# Entry templates — pre-fill project, activity and note from a picker (press T).
# [[template]] sections can be repeated.
[[template]]
description = "My project"
project = "My Project"
activity = "Development"
note = "Working on stuff"
```

### Entry templates

Define reusable presets in `config.toml`. In the timer view, press `T` to open the template picker and select one to pre-fill the current entry.

### Environment variables

Environment variables override values from `config.toml`.

- Prefix: `TOKI_TUI_`
- Key format: uppercase snake case

```bash
TOKI_TUI_API_URL="http://localhost:8080"
TOKI_TUI_GIT_DEFAULT_PREFIX="Development"
TOKI_TUI_TASK_FILTER="+work project:Toki"
TOKI_TUI_AUTO_RESIZE_TIMER=true
```

### Example: local dev setup
Expand All @@ -76,18 +95,71 @@ git_default_prefix = "Development"
task_filter = "+work"
```

## Standard key bindings

| Key | Action |
| -------------- | ------------------ |
| `Space` | Start / stop timer |
| `Ctrl+S` | Save (options) |
| `Ctrl+X` | Clear |
| `Tab / ↑↓ / j/k` | Navigate |
| `H` | History view |
| `P` | Project |
| `N` | Note |
| `T` | Toggle timer size |
| `S` | Stats |
| `Esc` | Exit / cancel |
| `Q` | Quit |
## Log notes

Attach a freeform markdown log file to any time entry. Log files are stored in `~/.local/share/toki-tui/logs/` and linked to entries via a tag embedded in the note (`[log:XXXXXX]`). The tag is hidden in all display locations — only the clean summary is shown.

Run `just tui-logs` (or `toki-tui logs-path`) to print the log directory path.

## Key bindings

### Timer view

| Key | Action |
| -------------------- | ----------------------------- |
| `Space` | Start / stop timer |
| `Ctrl+S` | Save (with options) |
| `Ctrl+R` | Resume last entry |
| `Ctrl+X` | Clear current entry |
| `Enter` | Edit description |
| `P` | Edit project / activity |
| `N` | Edit note (description editor) |
| `T` | Open template picker |
| `H` | Switch to history view |
| `S` | Switch to statistics view |
| `X` | Toggle timer size |
| `Z` | Zen mode (hide UI chrome) |
| `Tab / ↑↓ / j/k` | Navigate |
| `Q` | Quit |

### Description editor (note / `N`)

| Key | Action |
| -------------------- | ----------------------------- |
| `Ctrl+L` | Add / edit log file |
| `Ctrl+R` | Remove linked log file |
| `Ctrl+D` | Change working directory |
| `Ctrl+G` | Git: copy/paste branch or commit |
| `Ctrl+T` | Taskwarrior: pick a task |
| `Ctrl+X` | Clear note |
| `Ctrl+←/→` | Word-boundary navigation |
| `Ctrl+Backspace` | Delete word back |
| `Enter` | Confirm |
| `Esc` | Cancel |

### History view

| Key | Action |
| -------------------- | ----------------------------- |
| `↑↓` | Navigate entries |
| `Enter` | Edit entry |
| `Ctrl+R` | Resume entry (copy to timer) |
| `Ctrl+L` | Open linked log file |
| `H / Esc` | Back to timer view |
| `Q` | Quit |

**While editing a history entry:**

| Key | Action |
| -------------------- | ----------------------------- |
| `Tab` | Next field |
| `P / A` | Change project / activity |
| `Esc` | Save and exit edit mode |

## Testing

```bash
SQLX_OFFLINE=true cargo test -p toki-tui
```

Tests cover app and state behavior, text input helpers, runtime action handling, and focused Ratatui render assertions.
Loading
Loading