workday-daemon
v0.2.2
Published
Lightweight activity tracker & timesheet tool
Maintainers
Readme
workday-daemon
Background daemon that tracks developer activity via git and pushes timesheets to Tempo.
Polls git repos every 30s, detects work sessions from diffs/reflog/commits, scores activity, and produces daily JSON logs. Supports multi-repo tracking with automatic leader election, adaptive idle timeouts, and manual time adjustments.
Install
npm install -g workday-daemonRequires Node.js 20+.
Quick Start
workday init # creates ~/.workday/ with config templates
# edit ~/.workday/config.json — add repo paths
# edit ~/.workday/secrets.json — set Developer name
workday start # start background daemon
workday status # check running sessions
workday today # full day summaryCommands
workday init Initialize config in ~/.workday/
workday start Start daemon (background)
workday stop Stop daemon
workday status Show daemon status and sessions
workday today Today's summary
workday day YYYY-MM-DD Past day summary
workday pause [repo] Pause sessions
workday resume Resume paused sessions
workday autopause on|off [repo] Toggle idle auto-pause
workday adjust <target> +N "reason" Add manual time
workday set-start HH:MM Set day start earlier
workday tempo Show report (month to date)
workday tempo --push Push to Tempo
workday daemon Run in foreground (live dashboard)Configuration
~/.workday/config.json
{
"repos": ["/path/to/repo-a", "/path/to/repo-b"],
"dayBoundaryHour": 4,
"taskPattern": "PROJ-\\d+",
"genericBranches": ["develop", "main", "master"],
"session": {
"diffPollSeconds": 30,
"signalDeduplicationSeconds": 300,
"reflogCount": 20
},
"report": { "roundingMinutes": 15 },
"workDays": [1, 2, 3, 4, 5]
}~/.workday/secrets.json
{
"Developer": "your-git-username",
"TempoToken": "",
"JiraToken": "",
"JiraBaseUrl": ""
}Config can also live next to package.json for local development — the daemon checks there first before falling back to ~/.workday/.
How It Works
- Polls
git diff --numstat,git status, andgit reflogfor each repo - Filters branches by developer name
- Computes diff deltas between snapshots (dynamics = actual keystrokes)
- Manages session lifecycle: IDLE → PENDING → ACTIVE
- Scores activity via EMA with adaptive idle timeout (15–45 min)
- Elects a leader session across repos (highest score wins)
- Writes atomic JSON logs to
~/.workday/data/YYYY-MM/MM-DD.json - Day boundary detected automatically (default 4:00 AM)
Data
Daily logs stored as JSON in ~/.workday/data/. Sessions recover after crashes (up to 7 days lookback).
License
MIT
