health-sync 0.2.5 → 0.3.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 +12 -12
- package/health-sync.example.toml +3 -3
- package/package.json +4 -2
- package/src/auth-onboarding.js +1976 -0
- package/src/cli.js +574 -22
- package/src/config.js +24 -3
- package/src/db.js +73 -37
package/README.md
CHANGED
|
@@ -42,32 +42,32 @@ npm link
|
|
|
42
42
|
|
|
43
43
|
## Quick Start
|
|
44
44
|
|
|
45
|
-
1. Initialize config and DB:
|
|
45
|
+
1. Initialize config and DB, then follow the interactive provider onboarding wizard:
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
48
|
health-sync init
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
-
|
|
51
|
+
The wizard lets you:
|
|
52
|
+
- see all discovered providers in a checklist
|
|
53
|
+
- pick which providers to set up now
|
|
54
|
+
- get provider-specific setup URLs and callback values
|
|
55
|
+
- enter credentials directly into `health-sync.toml`
|
|
56
|
+
- run auth flows and save tokens in `.health-sync.creds`
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
2. (Optional) re-run auth for a single provider later:
|
|
55
59
|
|
|
56
60
|
```bash
|
|
57
61
|
health-sync auth oura
|
|
58
|
-
health-sync auth withings
|
|
59
|
-
health-sync auth strava
|
|
60
|
-
health-sync auth whoop
|
|
61
|
-
health-sync auth eightsleep
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
3. Sync data:
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
67
|
health-sync sync
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
4. Inspect sync state and counts:
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
73
|
health-sync status
|
|
@@ -97,14 +97,14 @@ api_key = "YOUR_HEVY_API_KEY"
|
|
|
97
97
|
enabled = true
|
|
98
98
|
client_id = "YOUR_CLIENT_ID"
|
|
99
99
|
client_secret = "YOUR_CLIENT_SECRET"
|
|
100
|
-
redirect_uri = "http://
|
|
100
|
+
redirect_uri = "http://localhost:8486/callback"
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
See `health-sync.example.toml` for all provider options.
|
|
104
104
|
|
|
105
105
|
## CLI Commands
|
|
106
106
|
|
|
107
|
-
- `health-sync init`: create a scaffolded config (from `health-sync.example.toml`)
|
|
107
|
+
- `health-sync init`: create a scaffolded config (from `health-sync.example.toml`), create DB tables, and launch interactive provider setup when running in a TTY
|
|
108
108
|
- `health-sync init-db`: create DB tables only (legacy)
|
|
109
109
|
- `health-sync auth <provider>`: run auth flow for one provider/plugin
|
|
110
110
|
- `health-sync sync`: run sync for all enabled providers
|
package/health-sync.example.toml
CHANGED
|
@@ -39,7 +39,7 @@ enabled = false
|
|
|
39
39
|
# OAuth2
|
|
40
40
|
# client_id = "..."
|
|
41
41
|
# client_secret = "..."
|
|
42
|
-
# redirect_uri = "http://
|
|
42
|
+
# redirect_uri = "http://localhost:8485/callback"
|
|
43
43
|
# scopes = "user.metrics,user.activity"
|
|
44
44
|
#
|
|
45
45
|
# Sync tuning:
|
|
@@ -73,7 +73,7 @@ enabled = false
|
|
|
73
73
|
# Option B: OAuth2 (recommended)
|
|
74
74
|
# client_id = "..."
|
|
75
75
|
# client_secret = "..."
|
|
76
|
-
# redirect_uri = "http://
|
|
76
|
+
# redirect_uri = "http://localhost:8486/callback"
|
|
77
77
|
# scopes = "read,activity:read_all"
|
|
78
78
|
# approval_prompt = "auto"
|
|
79
79
|
#
|
|
@@ -89,7 +89,7 @@ enabled = false
|
|
|
89
89
|
# OAuth2
|
|
90
90
|
# client_id = "..."
|
|
91
91
|
# client_secret = "..."
|
|
92
|
-
# redirect_uri = "http://
|
|
92
|
+
# redirect_uri = "http://localhost:8487/callback"
|
|
93
93
|
#
|
|
94
94
|
# WHOOP OAuth and API endpoints:
|
|
95
95
|
# authorize_url = "https://api.prod.whoop.com/oauth/oauth2/auth"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "health-sync",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Node.js port of health-sync",
|
|
6
6
|
"files": [
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@iarna/toml": "^2.2.5",
|
|
25
|
-
"
|
|
25
|
+
"@mariozechner/pi-tui": "^0.53.0",
|
|
26
|
+
"better-sqlite3": "^11.9.1",
|
|
27
|
+
"chalk": "^5.6.2"
|
|
26
28
|
},
|
|
27
29
|
"engines": {
|
|
28
30
|
"node": ">=20"
|