kahunas-cli 1.0.5 → 1.2.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 +56 -55
- package/dist/cli.js +888 -258
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -13,18 +13,12 @@ pnpm install
|
|
|
13
13
|
pnpm build
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
2)
|
|
16
|
+
2) Fetch data (browser login runs automatically on first run, headless by default):
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
pnpm kahunas
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
3) Fetch data:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
pnpm kahunas -- checkins list
|
|
26
|
-
pnpm kahunas -- workout list
|
|
27
|
-
pnpm kahunas -- workout pick
|
|
19
|
+
pnpm kahunas checkins list
|
|
20
|
+
pnpm kahunas workout list
|
|
21
|
+
pnpm kahunas workout pick
|
|
28
22
|
```
|
|
29
23
|
|
|
30
24
|
You can also run without installing globally:
|
|
@@ -36,19 +30,6 @@ npx kahunas-cli workout events
|
|
|
36
30
|
|
|
37
31
|
## Commands
|
|
38
32
|
|
|
39
|
-
### Auth
|
|
40
|
-
|
|
41
|
-
- `kahunas auth login`
|
|
42
|
-
- Opens a browser, lets you log in, and saves the `auth-user-token`.
|
|
43
|
-
- `kahunas auth status`
|
|
44
|
-
- Checks whether the stored token is valid.
|
|
45
|
-
- `kahunas auth show`
|
|
46
|
-
- Prints the stored token.
|
|
47
|
-
|
|
48
|
-
Tokens are saved to:
|
|
49
|
-
|
|
50
|
-
- `~/.config/kahunas/config.json`
|
|
51
|
-
|
|
52
33
|
### Check-ins
|
|
53
34
|
|
|
54
35
|
- `kahunas checkins list`
|
|
@@ -64,6 +45,8 @@ Tokens are saved to:
|
|
|
64
45
|
- Loads the most recently updated program.
|
|
65
46
|
- `kahunas workout events`
|
|
66
47
|
- Lists workout log events with dates and a human-friendly workout summary (from the calendar endpoint).
|
|
48
|
+
- `kahunas workout serve`
|
|
49
|
+
- Starts a local dev server with a workout preview page and a JSON endpoint that matches the CLI output.
|
|
67
50
|
- `kahunas workout program <id>`
|
|
68
51
|
- Fetches a program by UUID.
|
|
69
52
|
|
|
@@ -72,67 +55,86 @@ Tokens are saved to:
|
|
|
72
55
|
If the API list is missing a program you see in the web UI, run:
|
|
73
56
|
|
|
74
57
|
```bash
|
|
75
|
-
pnpm kahunas
|
|
58
|
+
pnpm kahunas sync
|
|
76
59
|
```
|
|
77
60
|
|
|
78
|
-
|
|
61
|
+
Or:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pnpm kahunas workout sync
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This runs a browser session (headless by default). You log in, then navigate to your workouts page. After you press Enter, the CLI captures the workout list from network responses and writes a cache:
|
|
79
68
|
|
|
80
69
|
- `~/.config/kahunas/workouts.json`
|
|
81
70
|
|
|
82
71
|
`workout list`, `workout pick`, and `workout latest` automatically merge the API list with this cache.
|
|
83
72
|
Raw output (`--raw`) prints the API response only.
|
|
84
73
|
|
|
74
|
+
If you add `~/.config/kahunas/auth.json`, the browser flow will attempt an automatic login and open your workouts page before capturing. Example:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"email": "you@example.com",
|
|
79
|
+
"password": "your-password"
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Keep this file private; it contains credentials.
|
|
84
|
+
|
|
85
|
+
Optional fields:
|
|
86
|
+
|
|
87
|
+
- `username` (use instead of `email`)
|
|
88
|
+
- `loginPath` (default: `/dashboard`)
|
|
89
|
+
|
|
90
|
+
If auto-capture does not find workouts, the CLI falls back to the manual prompt.
|
|
91
|
+
|
|
85
92
|
### Workout events (dates)
|
|
86
93
|
|
|
87
|
-
To see when workouts happened, the calendar endpoint returns log events with timestamps.
|
|
94
|
+
To see when workouts happened, the calendar endpoint returns log events with timestamps. The CLI returns the latest event summarized into a human-friendly structure (total volume sets, exercises, supersets). Use `--full` to return the full program payload (best effort; falls back to cached summary if needed).
|
|
88
95
|
|
|
89
96
|
```bash
|
|
90
|
-
pnpm kahunas
|
|
97
|
+
pnpm kahunas workout events
|
|
91
98
|
```
|
|
92
99
|
|
|
93
|
-
|
|
100
|
+
Use `--minimal` to return the raw event objects without program enrichment. Use `--full` for full enriched output. Use `--debug-preview` to log where preview HTML was discovered (stderr only).
|
|
94
101
|
|
|
95
|
-
|
|
96
|
-
pnpm kahunas -- workout events
|
|
97
|
-
```
|
|
102
|
+
If the user UUID is missing, `workout events` will attempt to discover it from check-ins and save it.
|
|
98
103
|
|
|
99
|
-
|
|
104
|
+
### Workout preview server
|
|
100
105
|
|
|
101
|
-
|
|
106
|
+
Run a local dev server to preview workouts in a browser:
|
|
102
107
|
|
|
103
108
|
```bash
|
|
104
|
-
pnpm kahunas
|
|
105
|
-
pnpm kahunas -- workout events --workout <workout-uuid>
|
|
109
|
+
pnpm kahunas serve
|
|
106
110
|
```
|
|
107
111
|
|
|
108
|
-
|
|
112
|
+
Or:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pnpm kahunas workout serve
|
|
116
|
+
```
|
|
109
117
|
|
|
110
|
-
|
|
118
|
+
The HTML page is available at `http://127.0.0.1:3000` and the JSON endpoint is at `http://127.0.0.1:3000/api/workout`.
|
|
119
|
+
The JSON response matches the CLI output for `workout events`, so there is only one data shape to maintain.
|
|
111
120
|
|
|
112
|
-
|
|
113
|
-
- `--user <uuid>`
|
|
121
|
+
Use `?day=<index>` to switch the selected workout day tab in the browser.
|
|
114
122
|
|
|
115
123
|
## Auto-login
|
|
116
124
|
|
|
117
|
-
Most commands auto-login
|
|
125
|
+
Most commands auto-login if a token is missing or expired. This runs a browser session and saves session details in `~/.config/kahunas/config.json` (headless by default). If `~/.config/kahunas/auth.json` is present, the login step is automated.
|
|
118
126
|
|
|
119
|
-
|
|
120
|
-
pnpm kahunas -- checkins list --no-auto-login
|
|
121
|
-
```
|
|
127
|
+
## Debug logging
|
|
122
128
|
|
|
123
|
-
|
|
129
|
+
Set `debug` to `true` in `~/.config/kahunas/config.json` to enable extra logs on stderr (includes workout preview debug output).
|
|
124
130
|
|
|
125
|
-
|
|
126
|
-
- `--headless` runs Playwright without a visible browser window.
|
|
131
|
+
## Headless mode
|
|
127
132
|
|
|
128
|
-
|
|
133
|
+
Set `headless` to `false` in `~/.config/kahunas/config.json` to show the Playwright browser. Defaults to `true`.
|
|
129
134
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
- `
|
|
133
|
-
- `KAHUNAS_COOKIE`
|
|
134
|
-
- `KAHUNAS_WEB_BASE_URL`
|
|
135
|
-
- `KAHUNAS_USER_UUID`
|
|
135
|
+
## Flags
|
|
136
|
+
|
|
137
|
+
- `--raw` prints raw API responses (no formatting).
|
|
136
138
|
|
|
137
139
|
## Playwright
|
|
138
140
|
|
|
@@ -161,5 +163,4 @@ pnpm publish
|
|
|
161
163
|
## Notes
|
|
162
164
|
|
|
163
165
|
- This CLI uses the same APIs the web app uses; tokens can expire quickly.
|
|
164
|
-
-
|
|
165
|
-
- `workout events` relies on session cookies captured during `auth login`.
|
|
166
|
+
- Re-run any command (or `workout sync`) to refresh login when needed.
|