@trainheroic-unofficial/coach-mcp 1.7.1 → 1.7.2

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.
Files changed (2) hide show
  1. package/dist/server.mjs +15 -10
  2. package/package.json +3 -3
package/dist/server.mjs CHANGED
@@ -1344,8 +1344,10 @@ function toSetResults(results) {
1344
1344
  * `param_2_data_N` string values plus a `param_N_made` flag.
1345
1345
  *
1346
1346
  * `mode` selects which write this is — the same endpoint serves both:
1347
- * - `"log"`: the values ARE a performed result, so `param_N_made` is 1 where the slot has data
1348
- * and the exercise `completed` flag is 1 when any set has logged data.
1347
+ * - `"log"`: the values ARE a performed result, so `param_N_made` is 1 where the slot has reps
1348
+ * entered (`param1`) and the exercise `completed` flag is 1 when any set is performed. A slot
1349
+ * carrying only a weight (`param2`) with no reps is a target, not a performed set, so it stays
1350
+ * un-made — matching the app, which shows no completion checkmark until reps are logged.
1349
1351
  * - `"prescribe"`: the values are prescribed targets, written with every `param_N_made` and
1350
1352
  * `completed` left at 0 so the set is not marked done. This matches what the app sends when a
1351
1353
  * coach edits an athlete's prescribed reps/weight.
@@ -1390,7 +1392,7 @@ function buildExerciseSetPayload(savedWorkoutSetExerciseId, savedWorkoutSetId, w
1390
1392
  if (target) {
1391
1393
  p1 = target.param1 !== void 0 ? String(target.param1) : "";
1392
1394
  p2 = target.param2 !== void 0 ? String(target.param2) : "";
1393
- made = performed && (p1 !== "" || p2 !== "") ? 1 : 0;
1395
+ made = performed && p1 !== "" ? 1 : 0;
1394
1396
  } else if (carryOver && coerceInt(existing?.[`param_${i}_made`]) === 1) {
1395
1397
  p1 = existingSlotData(existing, `param_1_data_${i}`);
1396
1398
  p2 = existingSlotData(existing, `param_2_data_${i}`);
@@ -1418,16 +1420,19 @@ function exerciseHasLoggedData(ex) {
1418
1420
  for (let i = 1; i <= 10; i += 1) if (coerceInt(ex[`param_${i}_made`]) === 1) return true;
1419
1421
  return false;
1420
1422
  }
1421
- /** True when a result carries at least one non-empty param value (so it produces a performed slot). */
1422
- function resultHasData(result) {
1423
- return result.sets.some((s) => s.param1 !== void 0 && String(s.param1) !== "" || s.param2 !== void 0 && String(s.param2) !== "");
1423
+ /** True when a result carries at least one set with reps entered (so it produces a performed slot).
1424
+ * A weight-only set (`param2` set, `param1` blank) is a target, not a performed result, and so does
1425
+ * not count — mirroring the `made` rule in {@link buildExerciseSetPayload}. */
1426
+ function resultHasPerformedSet(result) {
1427
+ return result.sets.some((s) => s.param1 !== void 0 && String(s.param1) !== "");
1424
1428
  }
1425
1429
  /**
1426
1430
  * Whether every exercise in a saved workout set now has logged data — either written with data in
1427
1431
  * this call (`loggedIds`) or already carrying a performed slot. Gates the set-completion PUT: a
1428
1432
  * superset/circuit stays open until the last exercise is logged, so completing it on a partial log
1429
- * does not flip its still-empty siblings to "done". An exercise written with only empty values does
1430
- * not count (it would not be marked performed), so an all-empty log never completes the set.
1433
+ * does not flip its still-empty siblings to "done". An exercise written with no reps — empty values,
1434
+ * or a weight (`param2`) with no reps (`param1`) — does not count (it would not be marked performed),
1435
+ * so a no-reps log never completes the set.
1431
1436
  */
1432
1437
  function isSetFullyLogged(exercises, loggedIds) {
1433
1438
  return exercises.every((ex) => {
@@ -1661,7 +1666,7 @@ async function writeSetResults(client, target, workouts, savedWorkoutSetId, resu
1661
1666
  }
1662
1667
  let setCompleted = false;
1663
1668
  if (mode === "log") {
1664
- if (isSetFullyLogged(exercises, new Set(results.filter(resultHasData).map((r) => r.savedWorkoutSetExerciseId)))) {
1669
+ if (isSetFullyLogged(exercises, new Set(results.filter(resultHasPerformedSet).map((r) => r.savedWorkoutSetExerciseId)))) {
1665
1670
  const setBody = {
1666
1671
  ...buildSetCompletePayload(rawSet, exercises.map((e) => coerceInt(e.id)).filter((n) => n !== null), true),
1667
1672
  ...extra
@@ -3737,7 +3742,7 @@ var JsonFileLibraryCache = class {
3737
3742
  };
3738
3743
  //#endregion
3739
3744
  //#region package.json
3740
- var version = "1.7.1";
3745
+ var version = "1.7.2";
3741
3746
  //#endregion
3742
3747
  //#region src/server.ts
3743
3748
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trainheroic-unofficial/coach-mcp",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,8 +21,8 @@
21
21
  "dependencies": {
22
22
  "@modelcontextprotocol/sdk": "^1.29.0",
23
23
  "zod": "^4.4.3",
24
- "@trainheroic-unofficial/core": "1.7.1",
25
- "@trainheroic-unofficial/js": "1.7.1"
24
+ "@trainheroic-unofficial/core": "1.7.2",
25
+ "@trainheroic-unofficial/js": "1.7.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^26.0.1",