@drakulavich/oura-cli 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/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +86 -0
- package/dist/index.js +3764 -0
- package/docs/schemas/activity.json +15 -0
- package/docs/schemas/describe.json +59 -0
- package/docs/schemas/hr.json +14 -0
- package/docs/schemas/readiness.json +15 -0
- package/docs/schemas/sleep.json +15 -0
- package/docs/schemas/spo2.json +15 -0
- package/docs/schemas/stress.json +15 -0
- package/docs/schemas/workout.json +15 -0
- package/package.json +60 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
5
|
+
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-05-12
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Initial public release.
|
|
13
|
+
- Commands: `login`, `describe`, `sleep`, `readiness`, `activity`, `hr`,
|
|
14
|
+
`spo2`, `stress`, `workout`, `sync`, `db`, `report`.
|
|
15
|
+
- TTY auto-detect for `--format` (table when interactive, JSON otherwise).
|
|
16
|
+
- Machine-readable error envelope with stable exit codes (0–4).
|
|
17
|
+
- JSON schemas for the `describe` manifest and all data-fetch outputs.
|
|
18
|
+
- Local SQLite cache at `~/.oura-cli/oura.db`.
|
|
19
|
+
- Auth via `oura-cli login`, `OURA_TOKEN`, `OURA_TOKEN_PATH`, or `~/.oura-token`.
|
|
20
|
+
|
|
21
|
+
[0.1.0]: https://github.com/drakulavich/oura-cli/releases/tag/v0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Anton Yakutovich (@drakulavich)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# oura-cli
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@drakulavich/oura-cli)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
A command-line tool for **Oura Ring** users to query and analyze their own health data locally. Designed for two audiences: people in a terminal, and AI agents driving the CLI programmatically.
|
|
7
|
+
|
|
8
|
+
- Fetches sleep, readiness, activity, heart rate, SpO₂, stress, and workouts from the Oura Cloud API.
|
|
9
|
+
- Caches everything in a local SQLite database (`~/.oura-cli/oura.db`) so you can query and report offline.
|
|
10
|
+
- Outputs human-friendly tables when run interactively; emits stable JSON when piped or invoked by a parent process.
|
|
11
|
+
- Self-describes via `oura-cli describe` so agents can discover commands, arguments, and output schemas.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @drakulavich/oura-cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Requires [Bun](https://bun.sh/) at runtime (the binary uses `#!/usr/bin/env bun`).
|
|
20
|
+
|
|
21
|
+
## For humans
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
oura-cli login # paste your Personal Access Token (one-time)
|
|
25
|
+
oura-cli sync # pull the last 90 days into ~/.oura-cli/oura.db
|
|
26
|
+
oura-cli report --week # render a weekly summary in the terminal
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Get a Personal Access Token at <https://cloud.ouraring.com/personal-access-tokens>.
|
|
30
|
+
|
|
31
|
+
By default, output formatting auto-detects: pretty tables in your terminal, JSON when piped.
|
|
32
|
+
|
|
33
|
+
## For agents
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
export OURA_TOKEN="…" # no file or interactive flow needed
|
|
37
|
+
oura-cli describe # JSON manifest of commands, args, output schemas
|
|
38
|
+
oura-cli sleep --start 2026-05-01 # JSON (since stdout is non-TTY for child processes)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- **Stable JSON I/O contract.** Output shapes are versioned with the package; breaking changes are major semver bumps. Schemas live in `docs/schemas/`.
|
|
42
|
+
- **Machine-readable errors.** When `--format json` (or auto-detected), all errors emit a single `{"error": {"code": "...", "message": "...", "hint": "..."}}` line on stderr.
|
|
43
|
+
- **Documented exit codes.**
|
|
44
|
+
|
|
45
|
+
| Code | Meaning |
|
|
46
|
+
|------|------------------------------------------------|
|
|
47
|
+
| 0 | success |
|
|
48
|
+
| 1 | user error (bad arguments) |
|
|
49
|
+
| 2 | auth error (missing or invalid token) |
|
|
50
|
+
| 3 | API or network error |
|
|
51
|
+
| 4 | database or local storage error |
|
|
52
|
+
|
|
53
|
+
## Configuration
|
|
54
|
+
|
|
55
|
+
| Setting | Flag | Env var | Default |
|
|
56
|
+
|------------------|-------------|--------------------|-----------------------------|
|
|
57
|
+
| Token | `--token` | `OURA_TOKEN` | (file) |
|
|
58
|
+
| Token file path | | `OURA_TOKEN_PATH` | `~/.oura-token` |
|
|
59
|
+
| Database path | `--db` | `OURA_DB_PATH` | `~/.oura-cli/oura.db` |
|
|
60
|
+
| Timezone | `--tz` | `OURA_TZ` | system timezone, else `UTC` |
|
|
61
|
+
| Output format | `--format` | | auto-detect (TTY → table) |
|
|
62
|
+
|
|
63
|
+
## Commands
|
|
64
|
+
|
|
65
|
+
Run `oura-cli --help` for the live list, or `oura-cli describe` for a machine-readable manifest.
|
|
66
|
+
|
|
67
|
+
- `login` — interactively save a Personal Access Token to `~/.oura-token`
|
|
68
|
+
- `describe` — emit JSON manifest (for agents)
|
|
69
|
+
- `sleep | readiness | activity | hr | spo2 | stress | workout [--start YYYY-MM-DD] [--end YYYY-MM-DD]` — fetch from Oura API
|
|
70
|
+
- `sync` — sync all collections into the local SQLite cache
|
|
71
|
+
- `db <subcommand>` — query the local cache
|
|
72
|
+
- `report --week | --month` — render a summary
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/drakulavich/oura-cli
|
|
78
|
+
cd oura-cli
|
|
79
|
+
bun install
|
|
80
|
+
bun test
|
|
81
|
+
bun run dev describe # run from source
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT © Anton Yakutovich
|