@trainheroic-unofficial/cli 2.1.1 → 3.0.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/dist/cli.mjs
CHANGED
|
@@ -2412,7 +2412,7 @@ function unitAdvisory(blockTitle, ex, defaults) {
|
|
|
2412
2412
|
/**
|
|
2413
2413
|
* Run unit advisories across a whole block list against an exercise index. Shared by the
|
|
2414
2414
|
* MCP workout_build tool and the CLI so both surface the same notes/warnings. Ensures the
|
|
2415
|
-
* index is loaded first, otherwise
|
|
2415
|
+
* index is loaded first, otherwise the defaults map is empty on a cold index and every
|
|
2416
2416
|
* advisory is silently dropped.
|
|
2417
2417
|
*/
|
|
2418
2418
|
async function collectAdvisories(blocks, index) {
|
|
@@ -2421,14 +2421,12 @@ async function collectAdvisories(blocks, index) {
|
|
|
2421
2421
|
block: b,
|
|
2422
2422
|
ex
|
|
2423
2423
|
})));
|
|
2424
|
-
const
|
|
2425
|
-
|
|
2426
|
-
return Number.isFinite(id) ? index.defaults(id) : Promise.resolve(null);
|
|
2427
|
-
}));
|
|
2424
|
+
const ids = [...new Set(pairs.map((p) => Number(p.ex.id)).filter((id) => Number.isFinite(id)))];
|
|
2425
|
+
const defaultsById = await index.defaultsMany(ids);
|
|
2428
2426
|
const notes = [];
|
|
2429
2427
|
const warnings = [];
|
|
2430
|
-
pairs.forEach((p
|
|
2431
|
-
const def =
|
|
2428
|
+
pairs.forEach((p) => {
|
|
2429
|
+
const def = defaultsById.get(Number(p.ex.id));
|
|
2432
2430
|
if (!def) return;
|
|
2433
2431
|
const advisory = unitAdvisory(p.block.title, p.ex, def);
|
|
2434
2432
|
notes.push(...advisory.notes);
|
|
@@ -2685,7 +2683,8 @@ async function copySession(client, args) {
|
|
|
2685
2683
|
year,
|
|
2686
2684
|
dayOfWeek,
|
|
2687
2685
|
isToday: false
|
|
2688
|
-
}
|
|
2686
|
+
},
|
|
2687
|
+
toTimelineDate: null
|
|
2689
2688
|
} });
|
|
2690
2689
|
if (!res.ok) {
|
|
2691
2690
|
const detail = typeof res.data === "string" ? res.data : JSON.stringify(res.data);
|
|
@@ -3293,12 +3292,16 @@ var ExerciseLibrary = class {
|
|
|
3293
3292
|
if (!s) return null;
|
|
3294
3293
|
return presentExercise(s.raw);
|
|
3295
3294
|
}
|
|
3296
|
-
async
|
|
3297
|
-
const
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3295
|
+
async defaultsMany(ids) {
|
|
3296
|
+
const result = /* @__PURE__ */ new Map();
|
|
3297
|
+
for (const id of ids) {
|
|
3298
|
+
const s = this.#byId.get(id);
|
|
3299
|
+
if (s) result.set(id, {
|
|
3300
|
+
param1: s.param_1_type,
|
|
3301
|
+
param2: s.param_2_type
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
return result;
|
|
3302
3305
|
}
|
|
3303
3306
|
async search(query, limit = 20) {
|
|
3304
3307
|
await this.ensureFresh();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trainheroic-unofficial/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"zod": "^4.4.3",
|
|
24
|
-
"@trainheroic-unofficial/dto": "
|
|
25
|
-
"@trainheroic-unofficial/js": "
|
|
24
|
+
"@trainheroic-unofficial/dto": "3.0.0",
|
|
25
|
+
"@trainheroic-unofficial/js": "3.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^26.2.0",
|
|
@@ -1301,10 +1301,14 @@ Copies or repeats a session to a target date. Used for both "Copy" and "Repeat"
|
|
|
1301
1301
|
"year": 2026,
|
|
1302
1302
|
"dayOfWeek": 0,
|
|
1303
1303
|
"isToday": false
|
|
1304
|
-
}
|
|
1304
|
+
},
|
|
1305
|
+
"toTimelineDate": null
|
|
1305
1306
|
}
|
|
1306
1307
|
```
|
|
1307
1308
|
|
|
1309
|
+
`toTimelineDate` must be present as an explicit `null` for a calendar-date copy. Omitting it
|
|
1310
|
+
causes this legacy endpoint to return HTTP 500.
|
|
1311
|
+
|
|
1308
1312
|
#### `POST /2.0/coach/calendar/programWorkout/saveWorkoutAsTemplate/{workoutId}`
|
|
1309
1313
|
|
|
1310
1314
|
Saves an existing session as a reusable template in the session library. No request body needed — uses the workout ID in the URL path.
|