Skip to content

Commit 74541fa

Browse files
committed
fix: remove hpx export surface
1 parent 4101b9d commit 74541fa

8 files changed

Lines changed: 30 additions & 1229 deletions

File tree

AGENT.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
- Recovery and sleep each gained `today` shortcuts mirroring the workouts UX for quick daily snapshots.
1818
- Stats aggregation landed (`whoopy stats daily --date …`) producing JSON/text dashboards by composing cycles/recovery/sleep/workouts.
1919
- 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.
2221
- 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).
2423

2524
## Testing Checklist
2625
- `go test ./...` before every commit.

README.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Unofficial WHOOP data CLI written in Go. `whoopy` wraps WHOOP’s OAuth flow and
1313
- 📊 **Daily dashboards**`whoopy stats daily` aggregates workouts, recovery, sleep, and strain in one shot.
1414
- 🛠 **Diagnostics built in**`whoopy diag` surfaces config/tokens/API health for quick troubleshooting.
1515
- 📦 **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.
1716
- 🔐 **First-party OAuth** – secure PKCE login, token persistence under `~/.config/whoopy`, automatic refresh, and one-click logout.
1817
- 🧰 **Agent-friendly UX** – consistent flags, quiet success, non-zero exit codes on errors, and installable binaries for macOS/Linux arm64 + amd64.
1918

@@ -103,14 +102,13 @@ Environment overrides:
103102

104103
## Usage Overview
105104

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.
107106

108107
### Core commands
109108

110109
| Command | Description |
111110
| --- | --- |
112111
| `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. |
114112
| `whoopy profile show [--text]` | Basic profile plus body measurements. |
115113
| `whoopy workouts list [filters]` | List workouts from `/activity/workout`; client-side filters `--sport`, `--min-strain`, `--max-strain`. |
116114
| `whoopy workouts view <id>` | Detailed metrics for a single workout. |
@@ -135,9 +133,6 @@ whoopy workouts list --start 2026-03-01 --end 2026-03-04 | jq '.workouts[].score
135133
# Human-readable sleep summary
136134
whoopy sleep today --text
137135

138-
# HyperContext import for the last 10 days across all supported WHOOP resources
139-
whoopy hpx export --last 10d | hpx import
140-
141136
# Filter workouts before exporting
142137
whoopy workouts export \
143138
--start 2026-02-01 --end 2026-02-29 \
@@ -150,24 +145,6 @@ whoopy workouts export \
150145
whoopy stats daily --date 2026-03-03 --text
151146
```
152147

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
170-
171148
## Diagnostics
172149

173150
`whoopy diag` consolidates:

docs/initial_spec.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
- Replace the existing Bun/TypeScript `whoop-cli` with a cross-platform Go CLI (working name: `whoopy`).
55
- Use WHOOP’s **official OAuth 2.0** developer platform instead of reverse-engineered mobile endpoints.
66
- 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.
88

99
## 2. Guiding Objectives
1010
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 @@
5151
- `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.
5252
- `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.
5353
- Build metadata (`whoopy version` / `whoopy --version`) follows stamp’s ldflag strategy so tagged releases surface SemVer, commit SHA, and build date.
54-
- 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.
5655

5756
## 4. Configuration & Environment
5857
- Require WHOOP-issued **client ID** and **client secret** (if confidential client). Support reading from:
@@ -72,7 +71,6 @@
7271
| Sleep | `GET /developer/v2/sleep` | Show performance %, stage durations, time in bed, respiratory rate. |
7372
| Workouts | `GET /developer/v2/workout`, `GET /developer/v2/workout/{id}` | Include sport type, strain, zone durations, distance, calories. |
7473
| 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. |
7674
| Diagnostics | none (local + lightweight `/user/profile/basic` probe) | Surface config/token paths, token freshness, and API connectivity via `whoopy diag`. |
7775
| Daily stats summary | Combination of Cycle + Recovery + Sleep + Workouts for a date | Replicates existing `whoop stats` output with official data. |
7876
| Webhook helper (stretch) | n/a (polling utility) | CLI subcommand to verify webhook payload handling by developers. |
@@ -83,8 +81,6 @@ whoopy auth login [--no-browser]
8381
whoopy auth status
8482
whoopy auth logout
8583
86-
whoopy hpx export [--since TIME] [--until TIME] [--last 10d]
87-
8884
whoopy profile show [--text]
8985
9086
whoopy cycles list [--start YYYY-MM-DD] [--end YYYY-MM-DD] [--limit N] [--cursor TOKEN]
@@ -114,7 +110,7 @@ whoopy stats daily --date YYYY-MM-DD [--text|--json]
114110
- 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.
115111
- 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.
116112
- 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.
118114
- 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.
119115
- 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.
120116
- 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.
@@ -131,7 +127,6 @@ whoopy stats daily --date YYYY-MM-DD [--text|--json]
131127
- Define Go structs mirroring WHOOP v2 schemas; add adapters that map WHOOP fields to CLI-friendly names (e.g., `respiratory_rate``respRate`).
132128
- Stable JSON schema examples should be stored under `docs/examples/*.json`.
133129
- 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.
135130
- Diagnostics output (`whoopy diag`) should expose three clearly delimited blocks:
136131
- `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.
137132
- `tokens`: token file path + existence, last modified timestamp, scopes, expiry timestamp, humanized remaining lifetime, and whether a refresh token is stored.

0 commit comments

Comments
 (0)