You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Diagnostics command (`whoopy diag`) now surfaces config/token paths, credential presence, token expiry, and API probe status.
20
-
- Root `whoopy hpx export` command is the HPX surface. It auto-paginates profile, sleep, cycles, recovery, and workouts with shared time-window flags, deduplicates overlapping recovery-window signposts across cycles + recovery, and populates metric `ts` with actual measurement timestamps instead of empty strings.
21
-
- Shared bounded-export aliases `--since`, `--until`, and `--last` are available on list-style commands. `--updated-since` remains intentionally unsupported because WHOOP does not expose a trustworthy updated-time filter.
20
+
- Shared bounded range aliases `--since`, `--until`, and `--last` are available on list-style commands. `--updated-since` remains intentionally unsupported because WHOOP does not expose a trustworthy updated-time filter.
22
21
- Release tooling added: `.goreleaser.yml`, Homebrew tap config, and Release workflow ready for v0.1.0 (see `RELEASE_SETUP.md`).
23
-
- Next up: any further HyperContext schema expansion for currently unregistered WHOOP fields, and any remaining distribution niceties (e.g., Windows builds).
22
+
- Next up: any remaining distribution niceties (e.g., Windows builds).
Copy file name to clipboardExpand all lines: README.md
+1-24Lines changed: 1 addition & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,6 @@ Unofficial WHOOP data CLI written in Go. `whoopy` wraps WHOOP’s OAuth flow and
13
13
- 📊 **Daily dashboards** – `whoopy stats daily` aggregates workouts, recovery, sleep, and strain in one shot.
14
14
- 🛠 **Diagnostics built in** – `whoopy diag` surfaces config/tokens/API health for quick troubleshooting.
15
15
- 📦 **Deterministic outputs** – JSON by default for scripts, readable tables behind `--text`.
16
-
- 🔄 **HyperContext-ready export** – `whoopy hpx export` emits one canonical HyperContext NDJSON stream across profile, sleep, recovery, cycles, and workouts.
17
16
- 🔐 **First-party OAuth** – secure PKCE login, token persistence under `~/.config/whoopy`, automatic refresh, and one-click logout.
18
17
- 🧰 **Agent-friendly UX** – consistent flags, quiet success, non-zero exit codes on errors, and installable binaries for macOS/Linux arm64 + amd64.
19
18
@@ -103,14 +102,13 @@ Environment overrides:
103
102
104
103
## Usage Overview
105
104
106
-
whoopy defaults to JSON output. Append `--text` for aligned tables or `| jq` for structured piping. All list commands accept `--start`, `--end`, `--limit`, and `--cursor` via shared pagination flags, plus bounded-export aliases `--since`, `--until`, and `--last`. Dates accept either `YYYY-MM-DD` or RFC3339 timestamps.
105
+
whoopy defaults to JSON output. Append `--text` for aligned tables or `| jq` for structured piping. All list commands accept `--start`, `--end`, `--limit`, and `--cursor` via shared pagination flags, plus range aliases `--since`, `--until`, and `--last`. Dates accept either `YYYY-MM-DD` or RFC3339 timestamps.
107
106
108
107
### Core commands
109
108
110
109
| Command | Description |
111
110
| --- | --- |
112
111
|`whoopy auth login/status/logout`| PKCE login, show token expiry + scopes, or revoke local tokens. |
113
-
|`whoopy hpx export [window flags]`| Auto-paginate profile + WHOOP collections into one deduplicated HyperContext NDJSON stream. |
114
112
|`whoopy profile show [--text]`| Basic profile plus body measurements. |
115
113
|`whoopy workouts list [filters]`| List workouts from `/activity/workout`; client-side filters `--sport`, `--min-strain`, `--max-strain`. |
116
114
|`whoopy workouts view <id>`| Detailed metrics for a single workout. |
# HyperContext import for the last 10 days across all supported WHOOP resources
139
-
whoopy hpx export --last 10d | hpx import
140
-
141
136
# Filter workouts before exporting
142
137
whoopy workouts export \
143
138
--start 2026-02-01 --end 2026-02-29 \
@@ -150,24 +145,6 @@ whoopy workouts export \
150
145
whoopy stats daily --date 2026-03-03 --text
151
146
```
152
147
153
-
## HyperContext Export
154
-
155
-
`whoopy hpx export` is the HyperContext path for batch imports:
156
-
157
-
- It fetches profile, sleep, cycles, recovery, and workouts in one run
158
-
- It auto-paginates each WHOOP collection while applying one shared `--since` / `--until` / `--last` window
159
-
- It deduplicates overlapping `recovery_window` signposts that would otherwise appear when combining cycle and recovery exports
160
-
- Metric records now populate `ts` with the underlying measurement timestamp when WHOOP provides one
161
-
- Output contract: one JSON object per line on stdout, no tables or banners, `source` fixed to `whoop`, deterministic `origin_id`
162
-
- Session exports emit signposts before metrics so the stream can pipe directly into `hpx import`
163
-
- Current mappings cover registered HyperContext keys such as `sleep.duration_ms`, `recovery.score_pct`, `strain.day_score`, `workout.kilojoules`, and `body.weight_kg`
164
-
165
-
Bounded export guidance:
166
-
167
-
- Use `--since` / `--until` or the existing `--start` / `--end` flags for explicit windows
168
-
- Use `--last 10d` for overlap-friendly recurring imports
169
-
-`--updated-since` is intentionally rejected because WHOOP’s public endpoints do not expose a reliable updated-time filter
Copy file name to clipboardExpand all lines: docs/initial_spec.md
+3-8Lines changed: 3 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
- Replace the existing Bun/TypeScript `whoop-cli` with a cross-platform Go CLI (working name: `whoopy`).
5
5
- Use WHOOP’s **official OAuth 2.0** developer platform instead of reverse-engineered mobile endpoints.
6
6
- Primary goals: one-time OAuth login with refresh-token persistence, stable JSON/text outputs for automation, and feature parity (plus expansion) with the current CLI.
7
-
- Current status (Mar 7, 2026): Core WHOOP data commands, diagnostics, stats aggregation, workouts export, and native HyperContext NDJSON export via `whoopy hpx export`are implemented. Remaining work is mostly incremental polish and any future schema/export expansion.
7
+
- Current status (Mar 7, 2026): Core WHOOP data commands, diagnostics, stats aggregation, and workouts export are implemented. Remaining work is mostly incremental polish and distribution follow-through.
8
8
9
9
## 2. Guiding Objectives
10
10
1.**Credential safety** – never store raw passwords; rely on WHOOP-issued refresh tokens obtained via the Authorization Code flow with `offline` scope.
@@ -51,8 +51,7 @@
51
51
-`whoopy workouts export` streams workouts over any range as either JSON Lines (default) or CSV, auto-paginating via `next_token` and applying the same sport/strain filters as `workouts list`. Users can send output to stdout or `--output <path>` for scripts.
52
52
-`whoopy diag [--text]` now prints config + token file locations, credential presence, token freshness, and a lightweight `/user/profile/basic` probe so users can quickly see whether they're authenticated and whether the API is reachable.
- New `whoopy hpx export` auto-paginates profile, sleep, cycles, recovery, and workouts into one canonical HyperContext NDJSON stream. It applies one shared bounded window across WHOOP collections, deduplicates overlapping `recovery_window` signposts across cycles + recovery, and now populates metric `ts` with actual measurement timestamps instead of empty strings.
55
-
- Shared bounded-export aliases `--since`, `--until`, and `--last` now complement `--start/--end` on list-style commands and the new `whoopy hpx export` root command so recurring HPX imports can request overlap windows. `--updated-since` is intentionally rejected because WHOOP’s public API does not expose a reliable updated-time filter.
54
+
- Shared bounded-range aliases `--since`, `--until`, and `--last` now complement `--start/--end` on list-style commands so recurring workflows can request overlap windows more ergonomically. `--updated-since` is intentionally rejected because WHOOP’s public API does not expose a reliable updated-time filter.
56
55
57
56
## 4. Configuration & Environment
58
57
- Require WHOOP-issued **client ID** and **client secret** (if confidential client). Support reading from:
@@ -72,7 +71,6 @@
72
71
| Sleep |`GET /developer/v2/sleep`| Show performance %, stage durations, time in bed, respiratory rate. |
73
72
| Workouts |`GET /developer/v2/workout`, `GET /developer/v2/workout/{id}`| Include sport type, strain, zone durations, distance, calories. |
74
73
| Workouts export |`GET /developer/v2/workout` (auto-paginated) | Dump workouts as JSONL or CSV with client-side sport/strain filters for downstream analytics. |
75
-
| HyperContext export | Existing profile/cycle/recovery/sleep/workout endpoints |`whoopy hpx export` produces canonical HyperContext NDJSON with stable signposts + metrics across the full WHOOP surface. |
76
74
| Diagnostics | none (local + lightweight `/user/profile/basic` probe) | Surface config/token paths, token freshness, and API connectivity via `whoopy diag`. |
77
75
| Daily stats summary | Combination of Cycle + Recovery + Sleep + Workouts for a date | Replicates existing `whoop stats` output with official data. |
78
76
| Webhook helper (stretch) | n/a (polling utility) | CLI subcommand to verify webhook payload handling by developers. |
- Added `internal/api.ListOptions` to centralize WHOOP collection parameters (`start`, `end`, `limit`, `nextToken`). Helpers validate ranges, format timestamps as RFC 3339, and attach values to `url.Values` before every request. This matches the official pagination contract (`nextToken` query param + `next_token` response field) described in https://developer.whoop.com/docs/developing/overview#tag/Workout/operation/getWorkoutCollection.
115
111
- Created a generic `internal/api.Page[T]` struct with `records` + `next_token` to decode all collection endpoints consistently while exposing a `HasNext()` helper for auto-pagination loops.
116
112
- Introduced `internal/cli/addListFlags` + `parseListOptions` so every list command automatically advertises `--start`, `--end`, `--limit`, and `--cursor` flags, aligning with clig.dev guidance about predictable flag shapes. `--start/--end` accept RFC 3339 or `YYYY-MM-DD` (interpreted as UTC midnight) and pipe into `api.ListOptions`.
117
-
-`addListFlags` now also exposes HyperContext-friendly bounded-export aliases: `--since`, `--until`, and `--last`. `--last` understands `h`, `d`, `w`, and `mo` units, while `--updated-since` fails fast with an explicit error so the CLI does not pretend to support a filter the WHOOP API cannot satisfy.
113
+
-`addListFlags` now also exposes bounded-range aliases: `--since`, `--until`, and `--last`. `--last` understands `h`, `d`, `w`, and `mo` units, while `--updated-since` fails fast with an explicit error so the CLI does not pretend to support a filter the WHOOP API cannot satisfy.
118
114
- Flag parsing emits user-friendly errors when the range is inverted or when the limit is negative, preventing wasted WHOOP API calls and ensuring commands fail fast before any network traffic.
119
115
- Added `todayRangeOptions(limit)` helper shared by the new `today` subcommands to encapsulate “local midnight to midnight” math and clamp the limit to a safe default.
120
116
- The workouts export implementation keeps calling `GET /developer/v2/workout` while WHOOP returns `next_token`, streaming each page either as JSON Lines or CSV. Export honors the same client-side sport/strain filters and can target stdout or `--output` paths for automation.
- Define Go structs mirroring WHOOP v2 schemas; add adapters that map WHOOP fields to CLI-friendly names (e.g., `respiratory_rate` → `respRate`).
132
128
- Stable JSON schema examples should be stored under `docs/examples/*.json`.
133
129
- Include `source_endpoint` metadata for traceability.
134
-
- HyperContext output (`whoopy hpx export`) is the machine-export contract: canonical NDJSON only, one object per line, signposts before dependent metrics, deterministic `origin_id`, non-empty measurement `ts` where WHOOP provides source timestamps, and no human-facing stdout noise.
135
130
- Diagnostics output (`whoopy diag`) should expose three clearly delimited blocks:
136
131
-`config`: absolute path, existence flag, whether client ID/secret/env overrides are set, and the effective API/OAuth/redirect URLs. Do not fail if the file is missing—report the error inline.
137
132
-`tokens`: token file path + existence, last modified timestamp, scopes, expiry timestamp, humanized remaining lifetime, and whether a refresh token is stored.
0 commit comments