Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

MCP: die Lib bleibt unter reinem Node ladbar, und die Testwerte stimmen wieder

Duarte Santosba412cb36dd7
diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js
index c63b942f7..2fe59d0b8 100644
--- a/frontend/src/lib/history.js
+++ b/frontend/src/lib/history.js
@@ -1,7 +1,11 @@
// Pure helpers over the state object S (ported 1:1 from the vanilla app).
import { todayISO, isoOf, weekKey, fmtNum } from './format.js'
import { isCardio, isBodyweightEq } from './exercises.js'
-import { t } from './i18n.js'
+// i18n-core, not i18n: this file is imported by mcp/, which is plain Node with no Vite and no
+// React. i18n.js is the Vite half — import.meta.glob over the locale packs, useSyncExternalStore
+// for the hook — and it re-exports this very `t` from core, so nothing changes here except what
+// gets dragged along behind it.
+import { t } from './i18n-core.js'
// How an exercise is logged (issue #16). This used to be derived from the body part alone,
// which meant a plank or a farmer's carry could only be timed by filing it under cardio.
diff --git a/frontend/src/lib/mobile.js b/frontend/src/lib/mobile.js
index 0e6eb80ff..a337abb27 100644
--- a/frontend/src/lib/mobile.js
+++ b/frontend/src/lib/mobile.js
@@ -9,7 +9,7 @@
//
// Like the demo build, MOBILE is replaced at build time, so all of this folds away in
// web bundles; the Capacitor plugins are only ever imported behind it.
-import { t } from './i18n.js'
+import { t } from './i18n-core.js'
export const MOBILE = import.meta.env.VITE_MOBILE === '1'
diff --git a/frontend/src/lib/plan-share.js b/frontend/src/lib/plan-share.js
index c04acd18a..7e41d1d49 100644
--- a/frontend/src/lib/plan-share.js
+++ b/frontend/src/lib/plan-share.js
@@ -11,7 +11,7 @@
import { EXIDX, isBodyweightEq } from './exercises.js'
import { modeOf, fmtSec, isBw, isPerSide, sideReps } from './history.js'
import { uid, todayISO, DAYN, fmtNum, exCount } from './format.js'
-import { t } from './i18n.js'
+import { t } from './i18n-core.js'
const PLAN_FMT = 1
const WEEK_ORDER = [1, 2, 3, 4, 5, 6, 0] // Mon-first, matching the Plan screen
diff --git a/mcp/src/tools.js b/mcp/src/tools.js
index 552bf79e1..286755bed 100644
--- a/mcp/src/tools.js
+++ b/mcp/src/tools.js
@@ -11,7 +11,7 @@ import {
} from '../../frontend/src/lib/history.js'
import { EXIDX, exOr } from '../../frontend/src/lib/exercises.js'
import {
- estimate1RM, best1RM, e1rmSeries, FORMULAS, DEFAULT_FORMULA, REP_CAP
+ estimate1RM, best1RM, e1rmSeries, DEFAULT_FORMULA, REP_CAP
} from '../../frontend/src/lib/onerm.js'
import { loadOfWorkouts, rankOf, levelsOf } from '../../frontend/src/lib/muscles.js'
diff --git a/mcp/test/tools.test.js b/mcp/test/tools.test.js
index 3002bc84d..6253952cf 100644
--- a/mcp/test/tools.test.js
+++ b/mcp/test/tools.test.js
@@ -12,8 +12,11 @@ import { TOOLS } from '../src/tools.js'
// the demo state's exact values.
const FAKE_TODAY_ISO = '2026-07-27' // Monday — Push Day is scheduled
const GOAL_WEIGHT = 77
-const NEWEST_WORKOUT = { date: '2026-07-24', name: 'Leg Day', volume: 18500, bw: 78.6, sets_done: 20, sets_total: 20, duration_min: 51 }
-const LATEST_BW = { date: '2026-07-27', weight: 78.5, delta: 1.5 }
+// Re-pinned against the v1.2.4 seed, which moved when the demo learned about bodyweight work
+// and effort. Hand-checked rather than copied off a failing run: 18412.5 is the sum of w×r
+// over the twenty completed sets, and 1.3 is 78.3 − 77.
+const NEWEST_WORKOUT = { date: '2026-07-24', name: 'Leg Day', volume: 18412.5, bw: 78.4, sets_done: 20, sets_total: 20, duration: '1h 11m' }
+const LATEST_BW = { date: '2026-07-27', weight: 78.3, delta: 1.3 }
const LEG_PRESS_ID = '0739' // sled 45° leg press in the demo data
const LEG_PRESS_BEST = { w: 152.5, r: 12, epley: 213.5, brzycki: 219.6 }
@@ -207,7 +210,9 @@ describe('list_workouts', () => {
expect(r.workouts[0].sets_done).toBe(NEWEST_WORKOUT.sets_done)
expect(r.workouts[0].sets_planned).toBe(NEWEST_WORKOUT.sets_total)
expect(r.workouts[0].sets_ratio).toBe(`${NEWEST_WORKOUT.sets_done}/${NEWEST_WORKOUT.sets_total}`)
- expect(r.workouts[0].duration).toBe(`${NEWEST_WORKOUT.duration_min} min`)
+ // Past the hour the lib switches format, so the expectation carries the rendered string
+ // rather than assuming a "N min" shape that only held while the session was shorter.
+ expect(r.workouts[0].duration).toBe(NEWEST_WORKOUT.duration)
expect(r.workouts[0].bodyweight_at_workout).toBe(NEWEST_WORKOUT.bw)
r.workouts.forEach(w => {
expect(w.sets_done).toBeLessThanOrEqual(w.sets_planned)