workday-daemon 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +710 -0
- package/dist/cli.js.map +1 -0
- package/dist/collectors/git-client.d.ts +16 -0
- package/dist/collectors/git-client.js +58 -0
- package/dist/collectors/git-client.js.map +1 -0
- package/dist/collectors/git-tracker.d.ts +43 -0
- package/dist/collectors/git-tracker.js +168 -0
- package/dist/collectors/git-tracker.js.map +1 -0
- package/dist/collectors/reflog-parser.d.ts +30 -0
- package/dist/collectors/reflog-parser.js +71 -0
- package/dist/collectors/reflog-parser.js.map +1 -0
- package/dist/collectors/snapshot-parser.d.ts +34 -0
- package/dist/collectors/snapshot-parser.js +79 -0
- package/dist/collectors/snapshot-parser.js.map +1 -0
- package/dist/core/activity-evaluator.d.ts +33 -0
- package/dist/core/activity-evaluator.js +94 -0
- package/dist/core/activity-evaluator.js.map +1 -0
- package/dist/core/config.d.ts +18 -0
- package/dist/core/config.js +174 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/constants.d.ts +39 -0
- package/dist/core/constants.js +51 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/daily-log.d.ts +56 -0
- package/dist/core/daily-log.js +366 -0
- package/dist/core/daily-log.js.map +1 -0
- package/dist/core/session-tracker.d.ts +110 -0
- package/dist/core/session-tracker.js +460 -0
- package/dist/core/session-tracker.js.map +1 -0
- package/dist/core/status-renderer.d.ts +20 -0
- package/dist/core/status-renderer.js +178 -0
- package/dist/core/status-renderer.js.map +1 -0
- package/dist/core/types.d.ts +320 -0
- package/dist/core/types.js +52 -0
- package/dist/core/types.js.map +1 -0
- package/dist/daemon.d.ts +31 -0
- package/dist/daemon.js +266 -0
- package/dist/daemon.js.map +1 -0
- package/dist/http-server.d.ts +30 -0
- package/dist/http-server.js +342 -0
- package/dist/http-server.js.map +1 -0
- package/dist/push/jira-client.d.ts +5 -0
- package/dist/push/jira-client.js +84 -0
- package/dist/push/jira-client.js.map +1 -0
- package/dist/push/report-builder.d.ts +9 -0
- package/dist/push/report-builder.js +77 -0
- package/dist/push/report-builder.js.map +1 -0
- package/dist/push/tempo-client.d.ts +27 -0
- package/dist/push/tempo-client.js +92 -0
- package/dist/push/tempo-client.js.map +1 -0
- package/dist/push/tempo-pusher.d.ts +17 -0
- package/dist/push/tempo-pusher.js +317 -0
- package/dist/push/tempo-pusher.js.map +1 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# workday-daemon
|
|
2
|
+
|
|
3
|
+
Background daemon that tracks developer activity via git and pushes timesheets to Tempo.
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g workday-daemon
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires Node.js 20+.
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
workday init # creates ~/.workday/ with config templates
|
|
19
|
+
# edit ~/.workday/config.json — add repo paths
|
|
20
|
+
# edit ~/.workday/secrets.json — set Developer name
|
|
21
|
+
workday start # start background daemon
|
|
22
|
+
workday status # check running sessions
|
|
23
|
+
workday today # full day summary
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Commands
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
workday init Initialize config in ~/.workday/
|
|
30
|
+
workday start Start daemon (background)
|
|
31
|
+
workday stop Stop daemon
|
|
32
|
+
workday status Show daemon status and sessions
|
|
33
|
+
workday today Today's summary
|
|
34
|
+
workday day YYYY-MM-DD Past day summary
|
|
35
|
+
workday pause [repo] Pause sessions
|
|
36
|
+
workday resume Resume paused sessions
|
|
37
|
+
workday autopause on|off [repo] Toggle idle auto-pause
|
|
38
|
+
workday adjust <target> +N "reason" Add manual time
|
|
39
|
+
workday set-start HH:MM Set day start earlier
|
|
40
|
+
workday tempo Show report (month to date)
|
|
41
|
+
workday tempo --push Push to Tempo
|
|
42
|
+
workday daemon Run in foreground (live dashboard)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
**~/.workday/config.json**
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"repos": ["/path/to/repo-a", "/path/to/repo-b"],
|
|
52
|
+
"dayBoundaryHour": 4,
|
|
53
|
+
"taskPattern": "PROJ-\\d+",
|
|
54
|
+
"genericBranches": ["develop", "main", "master"],
|
|
55
|
+
"session": {
|
|
56
|
+
"diffPollSeconds": 30,
|
|
57
|
+
"signalDeduplicationSeconds": 300,
|
|
58
|
+
"reflogCount": 20
|
|
59
|
+
},
|
|
60
|
+
"report": { "roundingMinutes": 15 },
|
|
61
|
+
"workDays": [1, 2, 3, 4, 5]
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**~/.workday/secrets.json**
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"Developer": "your-git-username",
|
|
70
|
+
"TempoToken": "",
|
|
71
|
+
"JiraToken": "",
|
|
72
|
+
"JiraBaseUrl": ""
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Config can also live next to `package.json` for local development — the daemon checks there first before falling back to `~/.workday/`.
|
|
77
|
+
|
|
78
|
+
## How It Works
|
|
79
|
+
|
|
80
|
+
1. Polls `git diff --numstat`, `git status`, and `git reflog` for each repo
|
|
81
|
+
2. Filters branches by developer name
|
|
82
|
+
3. Computes diff deltas between snapshots (dynamics = actual keystrokes)
|
|
83
|
+
4. Manages session lifecycle: IDLE → PENDING → ACTIVE
|
|
84
|
+
5. Scores activity via EMA with adaptive idle timeout (15–45 min)
|
|
85
|
+
6. Elects a leader session across repos (highest score wins)
|
|
86
|
+
7. Writes atomic JSON logs to `~/.workday/data/YYYY-MM/MM-DD.json`
|
|
87
|
+
8. Day boundary detected automatically (default 4:00 AM)
|
|
88
|
+
|
|
89
|
+
## Data
|
|
90
|
+
|
|
91
|
+
Daily logs stored as JSON in `~/.workday/data/`. Sessions recover after crashes (up to 7 days lookback).
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
MIT
|
package/dist/cli.d.ts
ADDED