29_timesheet-management #64

Merged
kfickel merged 9 commits from 29_timesheet-management into main 2026-04-02 18:17:37 +02:00
2 changed files with 75 additions and 2 deletions
Showing only changes of commit 070a47e241 - Show all commits

View file

@ -27,7 +27,34 @@ Within files, `@`-prefixed markers at the beginning of paragraphs or headings de
## Configuration ## Configuration
Streamd reads its configuration from `~/.config/streamd/config.toml` (XDG standard). The main setting is `base_folder`, which points to the directory containing your stream files (defaults to the current working directory). ### User Configuration
Streamd reads its user configuration from `~/.config/streamd/config.toml` (XDG standard). The main setting is `base_folder`, which points to the directory containing your stream files (defaults to the current working directory).
### Repository Configuration
For timesheet reporting, create a `.streamd.toml` file in your stream files directory:
```toml
timezone = "Europe/Berlin" # Optional: timezone for day boundaries
[timesheet]
[[timesheet.periods]]
start = "2026-01-01"
end = "2026-06-30"
hours_per_week = 38.0
[[timesheet.periods]]
start = "2026-07-01"
end = "2026-12-31"
hours_per_week = 40.0
```
The timesheet command will calculate expected vs actual working hours based on these periods, showing:
- Daily breakdown with expected/actual hours
- Special day types (sick leave, vacation, holidays, flex days)
- Warnings for missing entries and overlapping timecards
- Monthly and cumulative balance
## Usage ## Usage

View file

@ -320,6 +320,52 @@ Process timesheet shards chronologically per day:
**Validation:** The last entry of each day MUST be a `Break` (cannot end day while working). **Validation:** The last entry of each day MUST be a `Break` (cannot end day while working).
### R18a: Timesheet Report Configuration
The `.streamd.toml` file in the base folder configures timesheet periods:
```toml
timezone = "Europe/Berlin" # Optional timezone for day boundaries
[timesheet]
[[timesheet.periods]]
start = "2026-01-01"
end = "2026-06-30"
hours_per_week = 38.0
[[timesheet.periods]]
start = "2026-07-01"
end = "2026-12-31"
hours_per_week = 40.0
```
**Configuration Rules:**
- Dates use ISO 8601 format (`YYYY-MM-DD`)
- Periods MUST NOT overlap (validation error if they do)
- Gaps between periods are allowed — days in gaps have 0 expected hours
- `hours_per_week` is distributed over Mon-Fri (e.g., 38h/week = 7.6h/day)
### R18b: Day Type Rules
| Day Type | Expected Hours | Actual Hours |
|----------|---------------|--------------|
| Regular work day | period.hours_per_week / 5 | Sum of timecards |
| Weekend (Sat/Sun) | 0 | Sum of timecards (hidden if 0) |
| Sick Leave (@SickLeave) | Normal expected | max(expected, worked) |
| Vacation (@VacationDay) | Normal expected | expected + worked |
| Holiday (@Holiday) | 0 | Sum of timecards |
| Flex Day (@UndertimeDay) | Normal expected | 0 |
| Day in gap (no period) | 0 | Sum of timecards + warning |
| Missing (no entries) | Normal expected | 0 + warning |
### R18c: Timesheet Report Warnings
The report generates warnings for:
1. **Missing days without explanation**: A weekday within a configured period has no timecard entries and no special day type marker
2. **Overlapping timecards**: Two or more timecards on the same day have overlapping time ranges
3. **Work outside configured periods**: Work logged on a day that falls outside all configured periods
--- ---
## Query System ## Query System
@ -343,7 +389,7 @@ Provide recursive search through the shard tree:
| `streamd new` | Create new timestamped file, open editor, rename with markers on close | | `streamd new` | Create new timestamped file, open editor, rename with markers on close |
| `streamd todo` | List all shards with `task: "open"` | | `streamd todo` | List all shards with `task: "open"` |
| `streamd edit [n]` | Edit nth file (supports negative indexing for recent files) | | `streamd edit [n]` | Edit nth file (supports negative indexing for recent files) |
| `streamd timesheet` | Extract and export timesheet data as CSV | | `streamd timesheet` | Generate formatted timesheet report with expected/actual hours |
| `streamd completions <shell>` | Generate shell completions (bash, zsh, fish, elvish, powershell) | | `streamd completions <shell>` | Generate shell completions (bash, zsh, fish, elvish, powershell) |
--- ---