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.

Pyramid sets: a rep target per set, Max sets, per-set rest, Max records and chart

Mauro Remondi6f9b8b5e683c
diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js
index 4bcf90565..84f877f5b 100644
--- a/frontend/src/lib/history.js
+++ b/frontend/src/lib/history.js
@@ -17,6 +17,7 @@ const workRowsForMode = (entry = {}, mode = 'reps') => {
// 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'
+import { isPyramid, pyramidLabel, pyramidTargetAt, PYRAMID_MAX } from './pyramid.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.
@@ -179,6 +180,7 @@ export function setsRepsOf(cfg) {
const n = cfg.sets || 1
if (mode === 'cardio') return `${n} × ${cfg.min || 20} min`
if (mode === 'time') return `${n} × ${fmtSec(cfg.sec || 45)}`
+ if (isPyramid(cfg)) return pyramidLabel(cfg.pyramid)
return `${n} × ${repsOf(cfg)}`
}
@@ -507,6 +509,16 @@ function buildWorkSets(S, cfg, options = {}) {
? (cfg.weight > 0 ? cfg.weight : (lastRegular && lastRegular.r > 0 ? lastRegular.w : cfg.weight))
: usable ? usable.w : (conf && conf.w > 0 ? conf.w : cfg.weight)
const row = { w, r: planReps || !usable ? cfg.reps : usable.r, done: false }
+ // Pyramid sets: the plan owns each set's own target; a max set opens at what you managed
+ // in that same set last time, so the number to beat is already there.
+ if (isPyramid(cfg)) {
+ const target = pyramidTargetAt(cfg.pyramid, i)
+ // A pyramid is never progressed, so a planned session builds it with `useTarget` and
+ // `usable` is null there: the max set reads the same set last time directly.
+ const seed = usable || (lastRegular && lastRegular.r > 0 ? lastRegular : null)
+ if (target === PYRAMID_MAX) { row.r = seed ? seed.r : 0; row.max = true }
+ else row.r = target
+ }
// A unilateral exercise logs each side on its own (issue #60): the row splits into L/R,
// each seeded with half the total reps at the same weight. When "last time" was itself a
// per-side set, carry its two sides over so an asymmetry you logged persists — both sides'
diff --git a/frontend/src/lib/plan-share.js b/frontend/src/lib/plan-share.js
index 6f21134d4..c835d3580 100644
--- a/frontend/src/lib/plan-share.js
+++ b/frontend/src/lib/plan-share.js
@@ -12,6 +12,7 @@ import { EXIDX, isBodyweightEq } from './exercises.js'
import { cleanUrl } from './media-refs.js'
import { modeOf, exLine, MAX_PLANNED_WARMUPS } from './history.js'
import { deriveSessionName } from './session-merge.js'
+import { isPyramid, normalizePyramid, normalizePyramidRest } from './pyramid.js'
import { uid, todayISO, DAYN, weekOrder, weekStartOf, exCount } from './format.js'
import { t, exerciseNameFor, exerciseNameClass, getLang, RTL_LANGS } from './i18n-core.js'
import { convertWeight } from './units.js'
@@ -77,6 +78,12 @@ function cleanEx(e) {
} else {
if (e.reps != null) o.reps = e.reps
if (e.weight) o.weight = e.weight
+ // Pyramid sets are the prescription itself; without them a "12 · 8 · 6 · Max · 12" arrives as 5 × 12.
+ if (isPyramid(e)) {
+ o.pyramid = normalizePyramid(e.pyramid)
+ const rest = normalizePyramidRest(e.pyramidRest, o.pyramid.length)
+ if (rest.length) o.pyramidRest = rest
+ }
}
// How the exercise is logged travels too (issues #31/#32) — the bodyweight flag only when
// it disagrees with the catalogue, since agreeing is what the other end already assumes.
@@ -221,8 +228,10 @@ export function parsePlan(raw, destinationUnit = 'kg') {
const intens = cleanIntensifier(e.intensifier)
const rest = cleanRestSec(e.restSec)
const warmRest = cleanRestSec(e.warmupRestSec)
- const { warmupSets, intensifier, restSec, warmupRestSec, ...passthrough } = e
- return convertedExercise({ ...passthrough, ...(warm ? { warmupSets: warm } : {}), ...(intens ? { intensifier: intens } : {}), ...(rest ? { restSec: rest } : {}), ...(warmRest ? { warmupRestSec: warmRest } : {}) }, sourceUnit || destination, destination)
+ const pyramid = normalizePyramid(e.pyramid)
+ const pyramidRest = pyramid.length ? normalizePyramidRest(e.pyramidRest, pyramid.length) : []
+ const { warmupSets, intensifier, restSec, warmupRestSec, pyramid: _pyramid, pyramidRest: _pyramidRest, ...passthrough } = e
+ return convertedExercise({ ...passthrough, ...(pyramid.length ? { pyramid } : {}), ...(pyramidRest.length ? { pyramidRest } : {}), ...(warm ? { warmupSets: warm } : {}), ...(intens ? { intensifier: intens } : {}), ...(rest ? { restSec: rest } : {}), ...(warmRest ? { warmupRestSec: warmRest } : {}) }, sourceUnit || destination, destination)
})
}))
return {
diff --git a/frontend/src/lib/progression.js b/frontend/src/lib/progression.js
index 571495a0e..d3aa5fd94 100644
--- a/frontend/src/lib/progression.js
+++ b/frontend/src/lib/progression.js
@@ -20,6 +20,7 @@ import { modeOf, repStep, rerampWarmups, isBw, isPerSide, entryExcluded, entryRo
import { EXIDX, isAssisted, isLoadedEq } from './exercises.js'
import { isWarmupRow, isSideSet, syncSideAggregate, makeSideSet } from './workout-model.js'
import { normalizeRepRange } from './rep-range.js'
+import { isPyramid } from './pyramid.js'
export const POLICIES = ['off', 'linear', 'greyskull', 'double', 'time']
@@ -99,6 +100,8 @@ export const MAX_BW_SETS = 6
// The policy in force for one exercise: its own override, else the routine's default, else
// the mode's default. Reps keeps behaving the way the app always did (all reps → add a step).
export function policyFor(cfg, routine, mode) {
+ // Pyramid sets are never progressed: the lifter picks every set's weight (CONTEXT.md).
+ if (isPyramid(cfg)) return 'off'
const m = mode || modeOf(cfg || {})
const allowed = POLICIES_FOR[m] || ['off']
const pick = (cfg && cfg.prog) || (routine && routine.prog) || (m === 'reps' ? 'linear' : 'off')
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 890175234..a1b9e1294 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -41,7 +41,7 @@ describe('Brazilian Portuguese locale', () => {
// has to be taught is a number nobody reads. What the numbers stood for is asserted above.
// If the hash fails, review the changed keys and wording before accepting a new one. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('9be6cc7996a836338e4c6d4aaa075dc40f350dad94c72ef67c0a021870720c49')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('8d502ac088c27ca44d151dc7fd402f446c5d0a5149fb74a6d5dcb76964d3f14a')
})
test('does not leak European Portuguese UI terms', () => {
diff --git a/frontend/src/lib/pyramid.js b/frontend/src/lib/pyramid.js
new file mode 100644
index 000000000..bbb6bf824
--- /dev/null
+++ b/frontend/src/lib/pyramid.js
@@ -0,0 +1,115 @@
+// Pyramid sets (CONTEXT.md): one rep target per set, in order — a number, or PYRAMID_MAX for
+// "as many reps as you can". No load is prescribed and the exercise is never progressed.
+// Imports nothing from history.js, which imports this module.
+import { t } from './i18n-core.js'
+import { isWarmupRow } from './workout-model.js'
+
+export const PYRAMID_MAX = 'max'
+export const MAX_PYRAMID_SETS = 10
+
+// One tap in the editor replaces the list with one of these.
+export const PYRAMID_PRESETS = [
+ [12, 10, 8, 6],
+ [6, 8, 10, 12],
+ [12, 10, 8, 10, 12],
+ [12, 8, 6, PYRAMID_MAX, 12],
+]
+
+export function isPyramid(cfg) {
+ return !!cfg && Array.isArray(cfg.pyramid) && cfg.pyramid.length > 0 && (cfg.mode || 'reps') === 'reps'
+}
+
+// What the editor and a hand-edited plan file can hold, kept to what the session can train:
+// whole targets of at least one rep, "max", and no more than MAX_PYRAMID_SETS sets. `stride` 2
+// is a per-side exercise: each target is rounded up to even, so it splits evenly between L and R.
+export function normalizePyramid(list, stride = 1) {
+ if (!Array.isArray(list)) return []
+ const out = []
+ for (const v of list) {
+ if (v === PYRAMID_MAX) out.push(PYRAMID_MAX)
+ else if (v != null && v !== '' && Number.isFinite(Number(v))) {
+ const n = Math.max(1, Math.round(Number(v)))
+ out.push(Math.ceil(n / stride) * stride)
+ }
+ }
+ return out.slice(0, MAX_PYRAMID_SETS)
+}
+
+// Turning the toggle on starts from the flat "sets × reps" already there.
+export function pyramidFromFlat(cfg) {
+ const n = Math.max(1, Math.min(MAX_PYRAMID_SETS, Math.round(cfg.sets) || 1))
+ return Array(n).fill(cfg.reps || 10)
+}
+
+// Turning it off goes back to "sets × reps": the set count and the first numeric target.
+export function flatFromPyramid(list) {
+ const first = list.find(v => typeof v === 'number')
+ return { sets: list.length, reps: first || 10 }
+}
+
+/** "12 · 8 · 6 · Max · 12" */
+export function pyramidLabel(list) {
+ return list.map(v => (v === PYRAMID_MAX ? t('Max') : String(v))).join(' · ')
+}
+
+// An extra set added mid-session copies the last target.
+export function pyramidTargetAt(list, i) {
+ return i < list.length ? list[i] : list[list.length - 1]
+}
+
+// Each set's own rest in seconds, beside the targets (`pyramidRest[i]` for `pyramid[i]`). 0 is
+// "the exercise's rest". Sized to the list; all zeros is no field at all, so a pyramid that
+// never set a rest stays the shape it was.
+export function normalizePyramidRest(rest, length) {
+ const src = Array.isArray(rest) ? rest : []
+ const out = Array.from({ length }, (_, i) => Math.max(0, Math.round(Number(src[i])) || 0))
+ return out.some(v => v > 0) ? out : []
+}
+
+/** The rest a ticked work row of a pyramid earns, or 0 to fall back to the exercise's rest.
+ * `i` indexes `rows`, warm-ups included; the pyramid counts work sets only. */
+export function pyramidRestFor(target, rows, i) {
+ if (!isPyramid(target) || !Array.isArray(target.pyramidRest) || !target.pyramidRest.length) return 0
+ const row = rows?.[i]
+ if (!row || isWarmupRow(row)) return 0
+ const k = rows.slice(0, i).filter(r => !isWarmupRow(r)).length
+ return Math.max(0, Number(pyramidTargetAt(target.pyramidRest, k)) || 0)
+}
+
+// ---- Max sets read back from history ----
+
+// Every completed Max set of an exercise, oldest first: { w, r, d, t }.
+function maxSetsOf(workouts, exId) {
+ const out = []
+ for (const w of workouts || []) {
+ for (const en of w.entries || []) {
+ if (en.id !== exId) continue
+ for (const s of en.sets || []) {
+ if (s.max && s.done && s.r > 0 && !isWarmupRow(s)) out.push({ w: Number(s.w) || 0, r: s.r, d: w.d, t: w.start })
+ }
+ }
+ }
+ return out
+}
+
+/** The record a Max set at weight `w` is up against: the most reps any Max set of this exercise
+ * did at `w` or heavier (more reps on less weight is not a record). Ties: heavier, then first. */
+export function maxRecordAt(workouts, exId, w) {
+ let best = null
+ for (const s of maxSetsOf(workouts, exId)) {
+ if (s.w < (Number(w) || 0)) continue
+ if (!best || s.r > best.r || (s.r === best.r && s.w > best.w)) best = s
+ }
+ return best
+}
+
+/** Most reps in a Max set, per workout, for the Stats chart: [{ t, y, d, w }]. */
+export function maxRepsSeries(workouts, exId) {
+ const byWorkout = new Map()
+ for (const s of maxSetsOf(workouts, exId)) {
+ const key = s.t + '|' + s.d
+ const cur = byWorkout.get(key)
+ if (!cur || s.r > cur.y) byWorkout.set(key, { t: s.t, y: s.r, d: s.d, w: s.w })
+ }
+ return [...byWorkout.values()]
+}
diff --git a/frontend/src/lib/pyramid.test.js b/frontend/src/lib/pyramid.test.js
new file mode 100644
index 000000000..51b9e7521
--- /dev/null
+++ b/frontend/src/lib/pyramid.test.js
@@ -0,0 +1,237 @@
+import { describe, expect, it } from 'vitest'
+import {
+ PYRAMID_MAX, MAX_PYRAMID_SETS, isPyramid, normalizePyramid, pyramidFromFlat,
+ flatFromPyramid, pyramidLabel, pyramidTargetAt, PYRAMID_PRESETS, normalizePyramidRest, pyramidRestFor,
+ maxRecordAt, maxRepsSeries,
+} from './pyramid.js'
+import { buildSets, setsRepsOf } from './history.js'
+import { policyFor } from './progression.js'
+import { buildPlanBundle, parsePlan } from './plan-share.js'
+
+// Pyramid sets (CONTEXT.md): one rep target per set, in order, a set's target being a number or
+// "max". No load is prescribed and the exercise is never progressed automatically.
+const LIFT = '0025'
+const PYR = [12, 8, 6, PYRAMID_MAX, 12]
+const pyramidCfg = (extra = {}) => ({ id: LIFT, mode: 'reps', sets: 5, reps: 12, weight: 0, pyramid: PYR, ...extra })
+
+describe('isPyramid', () => {
+ it('is true for a reps exercise with a non-empty list', () => {
+ expect(isPyramid(pyramidCfg())).toBe(true)
+ })
+ it('is false without the list, with an empty one, or off reps mode', () => {
+ expect(isPyramid({ id: LIFT, mode: 'reps', sets: 3, reps: 10 })).toBe(false)
+ expect(isPyramid(pyramidCfg({ pyramid: [] }))).toBe(false)
+ expect(isPyramid(pyramidCfg({ mode: 'time', sec: 45 }))).toBe(false)
+ expect(isPyramid(null)).toBe(false)
+ })
+})
+
+describe('normalizePyramid', () => {
+ it('keeps whole positive targets and max, in order', () => {
+ expect(normalizePyramid([12, 8, 6, 'max', 12])).toEqual([12, 8, 6, 'max', 12])
+ })
+ it('rounds typed numbers and holds them to at least one rep', () => {
+ expect(normalizePyramid([7.6, 0, -3, '5'])).toEqual([8, 1, 1, 5])
+ })
+ it('drops what is neither a number nor max', () => {
+ expect(normalizePyramid([10, 'abc', null, undefined, 'max'])).toEqual([10, 'max'])
+ })
+ it('rounds a per-side target up to even, leaving max alone', () => {
+ expect(normalizePyramid([11, 8, 'max', 1], 2)).toEqual([12, 8, 'max', 2])
+ })
+ it(`caps the list at ${MAX_PYRAMID_SETS} sets`, () => {
+ expect(MAX_PYRAMID_SETS).toBe(10)
+ expect(normalizePyramid(Array(14).fill(8))).toHaveLength(10)
+ })
+ it('returns an empty list for anything that is not a list', () => {
+ expect(normalizePyramid(undefined)).toEqual([])
+ expect(normalizePyramid('12-8-6')).toEqual([])
+ })
+})
+
+describe('switching the toggle (Q14)', () => {
+ it('turning it on starts from the flat sets × reps', () => {
+ expect(pyramidFromFlat({ sets: 3, reps: 10 })).toEqual([10, 10, 10])
+ })
+ it('turning it on holds the count to 1..10 and an empty reps to 10', () => {
+ expect(pyramidFromFlat({ sets: 0, reps: 8 })).toEqual([8])
+ expect(pyramidFromFlat({ sets: 20, reps: 5 })).toHaveLength(10)
+ expect(pyramidFromFlat({ sets: 2 })).toEqual([10, 10])
+ })
+ it('turning it off gives the set count and the first numeric target', () => {
+ expect(flatFromPyramid([12, 8, 6, 'max', 12])).toEqual({ sets: 5, reps: 12 })
+ expect(flatFromPyramid(['max', 6, 4])).toEqual({ sets: 3, reps: 6 })
+ })
+ it('turning it off with only max targets falls back to 10 reps', () => {
+ expect(flatFromPyramid(['max', 'max'])).toEqual({ sets: 2, reps: 10 })
+ })
+})
+
+describe('pyramidLabel (Q12)', () => {
+ it('reads as the targets joined by a dot', () => {
+ expect(pyramidLabel(PYR)).toBe('12 · 8 · 6 · Max · 12')
+ })
+})
+
+describe('pyramidTargetAt (Q16)', () => {
+ it('is the set’s own target inside the list', () => {
+ expect(pyramidTargetAt(PYR, 0)).toBe(12)
+ expect(pyramidTargetAt(PYR, 3)).toBe('max')
+ })
+ it('copies the last target for an extra set past the list', () => {
+ expect(pyramidTargetAt(PYR, 5)).toBe(12)
+ expect(pyramidTargetAt([10, 'max'], 7)).toBe('max')
+ })
+})
+
+describe('plan and history read the pyramid (Q12)', () => {
+ it('setsRepsOf prints the pyramid instead of "5 × 12"', () => {
+ expect(setsRepsOf(pyramidCfg())).toBe('12 · 8 · 6 · Max · 12')
+ })
+ it('a flat config still reads the way it did', () => {
+ expect(setsRepsOf({ id: LIFT, mode: 'reps', sets: 3, reps: 10 })).toBe('3 × 10')
+ })
+})
+
+describe('pyramid sets are never progressed (Q7)', () => {
+ it('policyFor is off even when the exercise or the routine names a rule', () => {
+ expect(policyFor(pyramidCfg(), null, 'reps')).toBe('off')
+ expect(policyFor(pyramidCfg({ prog: 'linear' }), { prog: 'greyskull' }, 'reps')).toBe('off')
+ })
+})
+
+describe('buildSets with pyramid sets (Q9, Q13)', () => {
+ it('a first session opens at each set’s own target, the max set empty and marked', () => {
+ const S = { exWeights: {}, workouts: [] }
+ expect(buildSets(S, pyramidCfg())).toEqual([
+ { w: 0, r: 12, done: false },
+ { w: 0, r: 8, done: false },
+ { w: 0, r: 6, done: false },
+ { w: 0, r: 0, done: false, max: true },
+ { w: 0, r: 12, done: false },
+ ])
+ })
+ it('later sessions take each set’s weight from the same set last time, and the max set its reps', () => {
+ const S = {
+ exWeights: {},
+ workouts: [{
+ id: 'w1', d: '2026-09-28', entries: [{
+ id: LIFT, sets: [
+ { w: 60, r: 10, done: true },
+ { w: 70, r: 8, done: true },
+ { w: 80, r: 6, done: true },
+ { w: 85, r: 9, done: true, max: true },
+ { w: 50, r: 12, done: true },
+ ],
+ }],
+ }],
+ }
+ expect(buildSets(S, pyramidCfg())).toEqual([
+ // the plan owns the numeric targets: 10 logged last time, 12 asked for again
+ { w: 60, r: 12, done: false },
+ { w: 70, r: 8, done: false },
+ { w: 80, r: 6, done: false },
+ { w: 85, r: 9, done: false, max: true },
+ { w: 50, r: 12, done: false },
+ ])
+ })
+ it('planned warm-ups still go in front of the pyramid (Q10)', () => {
+ const S = { exWeights: {}, workouts: [] }
+ const rows = buildSets(S, pyramidCfg({ weight: 0, warmupSets: 1 }), { step: 2.5 })
+ expect(rows).toHaveLength(6)
+ expect(rows[0].phase).toBe('warmup')
+ expect(rows.slice(1).map(r => r.r)).toEqual([12, 8, 6, 0, 12])
+ })
+})
+
+describe('a shared plan keeps the pyramid', () => {
+ const stateWith = ex => ({ routines: [{ id: 'r1', name: 'Push', ex: [ex] }], week: {}, customEx: [] })
+ it('survives export and import', () => {
+ const back = parsePlan(JSON.stringify(buildPlanBundle(stateWith(pyramidCfg()), 'Plan'))).routines[0].ex[0]
+ expect(back.pyramid).toEqual(PYR)
+ })
+ it('a flat exercise gains no pyramid field', () => {
+ const back = parsePlan(JSON.stringify(buildPlanBundle(stateWith({ id: LIFT, sets: 3, reps: 10 }), 'Plan'))).routines[0].ex[0]
+ expect(back).not.toHaveProperty('pyramid')
+ })
+})
+
+describe('a planned session builds the pyramid with useTarget (progression off)', () => {
+ it('the max set still opens at what it did last time, each weight at the same set’s', () => {
+ const S = {
+ exWeights: {},
+ workouts: [{ id: 'w1', d: '2026-09-28', entries: [{ id: LIFT, sets: [
+ { w: 60, r: 12, done: true }, { w: 70, r: 8, done: true }, { w: 80, r: 6, done: true },
+ { w: 85, r: 9, done: true, max: true }, { w: 50, r: 12, done: true },
+ ] }] }],
+ }
+ const rows = buildSets(S, pyramidCfg(), { useTarget: true, planReps: true })
+ expect(rows.map(r => r.w)).toEqual([60, 70, 80, 85, 50])
+ expect(rows.map(r => r.r)).toEqual([12, 8, 6, 9, 12])
+ expect(rows[3].max).toBe(true)
+ })
+})
+
+describe('presets', () => {
+ it('are four valid pyramids, the back-off one with a max set', () => {
+ expect(PYRAMID_PRESETS).toHaveLength(4)
+ for (const p of PYRAMID_PRESETS) expect(normalizePyramid(p)).toEqual(p)
+ expect(PYRAMID_PRESETS.map(pyramidLabel)).toContain('12 · 8 · 6 · Max · 12')
+ })
+})
+
+describe('rest per set (pyramidRest)', () => {
+ it('normalizePyramidRest sizes the list and drops an all-zero one', () => {
+ expect(normalizePyramidRest([90, 120], 4)).toEqual([90, 120, 0, 0])
+ expect(normalizePyramidRest([90, 120, 60, 30, 15], 3)).toEqual([90, 120, 60])
+ expect(normalizePyramidRest([0, 0], 2)).toEqual([])
+ expect(normalizePyramidRest(undefined, 3)).toEqual([])
+ expect(normalizePyramidRest([-5, 'x', 44.6], 3)).toEqual([0, 0, 45])
+ })
+ const target = pyramidCfg({ pyramidRest: [60, 90, 180, 120, 0] })
+ const rows = [{ w: 30, r: 5, phase: 'warmup' }, { r: 12 }, { r: 8 }, { r: 6 }, { r: 0, max: true }, { r: 12 }, { r: 12 }]
+ it('pyramidRestFor counts work sets only, past warm-ups', () => {
+ expect(pyramidRestFor(target, rows, 1)).toBe(60)
+ expect(pyramidRestFor(target, rows, 3)).toBe(180)
+ expect(pyramidRestFor(target, rows, 5)).toBe(0)
+ })
+ it('a warm-up row and an extra set past the list', () => {
+ expect(pyramidRestFor(target, rows, 0)).toBe(0)
+ expect(pyramidRestFor(target, rows, 6)).toBe(0)
+ expect(pyramidRestFor(pyramidCfg({ pyramidRest: [60, 90] }), [{ r: 1 }, { r: 1 }, { r: 1 }], 2)).toBe(90)
+ })
+ it('is 0 without a rest list or off a pyramid', () => {
+ expect(pyramidRestFor(pyramidCfg(), rows, 1)).toBe(0)
+ expect(pyramidRestFor({ mode: 'reps', sets: 3, reps: 10, pyramidRest: [60] }, [{ r: 10 }], 0)).toBe(0)
+ })
+ it('travels with a shared plan', () => {
+ const stateWith = ex => ({ routines: [{ id: 'r1', name: 'Push', ex: [ex] }], week: {}, customEx: [] })
+ const back = parsePlan(JSON.stringify(buildPlanBundle(stateWith(pyramidCfg({ pyramidRest: [60, 90, 180, 120, 0] })), 'Plan'))).routines[0].ex[0]
+ expect(back.pyramidRest).toEqual([60, 90, 180, 120, 0])
+ })
+})
+
+describe('Max set records (Q20, Q21)', () => {
+ const workouts = [
+ { id: 'a', d: '2026-09-01', start: 1, entries: [{ id: LIFT, sets: [{ w: 85, r: 9, done: true, max: true }, { w: 50, r: 12, done: true }] }] },
+ { id: 'b', d: '2026-09-08', start: 2, entries: [{ id: LIFT, sets: [{ w: 80, r: 11, done: true, max: true }] }] },
+ { id: 'c', d: '2026-09-15', start: 3, entries: [{ id: LIFT, sets: [{ w: 90, r: 20, done: false, max: true }, { w: 85, r: 10, done: true }] }] },
+ { id: 'd', d: '2026-09-22', start: 4, entries: [{ id: '9999', sets: [{ w: 100, r: 30, done: true, max: true }] }] },
+ ]
+ it('more reps on less weight is not a record', () => {
+ expect(maxRecordAt(workouts, LIFT, 85)).toMatchObject({ w: 85, r: 9, d: '2026-09-01' })
+ })
+ it('at a lighter weight every heavier Max set counts', () => {
+ expect(maxRecordAt(workouts, LIFT, 80)).toMatchObject({ w: 80, r: 11 })
+ })
+ it('only done Max sets of this exercise count; none heavier is no record', () => {
+ expect(maxRecordAt(workouts, LIFT, 86)).toBeNull()
+ expect(maxRecordAt([], LIFT, 0)).toBeNull()
+ })
+ it('maxRepsSeries is the most reps in a Max set per workout', () => {
+ expect(maxRepsSeries(workouts, LIFT)).toEqual([
+ { t: 1, y: 9, d: '2026-09-01', w: 85 },
+ { t: 2, y: 11, d: '2026-09-08', w: 80 },
+ ])
+ })
+})
diff --git a/frontend/src/lib/supersetFlow.js b/frontend/src/lib/supersetFlow.js
index 7c4adec66..cf49ecfbb 100644
--- a/frontend/src/lib/supersetFlow.js
+++ b/frontend/src/lib/supersetFlow.js
@@ -81,12 +81,14 @@ export function restOnRecheck({ timerRunning, unitDone, lastUnit }) {
* have no rest of their own, but an exercise that explicitly asks for one still gets it — the
* setting is a default, and this field overrides the default.
*/
-export function restSecFor(entries, unit, defaultRestSec) {
+export function restSecFor(entries, unit, defaultRestSec, setRest = null) {
const fallback = defaultRestSec > 0 ? defaultRestSec : 0
const idxs = Array.isArray(unit) && unit.length ? unit : []
if (!idxs.length) return fallback
return idxs.reduce((longest, idx) => {
- const own = entries?.[idx]?.target?.restSec
+ // `setRest` is the ticked set's own rest ({ idx, sec }, a pyramid set): it stands in for
+ // that member's exercise rest, and a superset still takes the longest of the group.
+ const own = setRest && setRest.idx === idx && setRest.sec > 0 ? setRest.sec : entries?.[idx]?.target?.restSec
return Math.max(longest, own > 0 ? own : fallback)
}, 0)
}
diff --git a/frontend/src/lib/supersetFlow.test.js b/frontend/src/lib/supersetFlow.test.js
index e5af59b9c..1487f00ea 100644
--- a/frontend/src/lib/supersetFlow.test.js
+++ b/frontend/src/lib/supersetFlow.test.js
@@ -178,3 +178,18 @@ describe('warmupRestSecFor', () => {
expect(warmupRestSecFor({ target: {}, sets: [] }, 0, 120)).toBe(120)
})
})
+
+describe('restSecFor with a pyramid set’s own rest', () => {
+ const entries = [{ target: { restSec: 90 } }, { target: { restSec: 60 } }]
+ it('the set’s rest stands in for its exercise’s', () => {
+ expect(restSecFor(entries, [0], 120, { idx: 0, sec: 180 })).toBe(180)
+ expect(restSecFor(entries, [0], 120, { idx: 0, sec: 30 })).toBe(30)
+ })
+ it('0 falls back to the exercise’s rest', () => {
+ expect(restSecFor(entries, [0], 120, { idx: 0, sec: 0 })).toBe(90)
+ })
+ it('a superset still takes the longest of the group', () => {
+ expect(restSecFor(entries, [0, 1], 120, { idx: 1, sec: 30 })).toBe(90)
+ expect(restSecFor(entries, [0, 1], 120, { idx: 1, sec: 200 })).toBe(200)
+ })
+})
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index 07697206c..3ac371757 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1716,4 +1716,14 @@ export default {
'Teal': 'أزرق مخضر',
'Yellow': 'أصفر',
'Enter how long it took — at least 1 minute.': 'أدخل المدة التي استغرقها — دقيقة واحدة على الأقل.',
+ 'Pyramid sets': 'مجموعات هرمية',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'هدف تكرارات مختلف لكل مجموعة، مثل 12 · 8 · 6 · أقصى · 12.',
+ 'Max': 'أقصى',
+ 'Max: as many reps as you can': 'أقصى: أكبر عدد ممكن من التكرارات',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'الوزن تختاره أنت: المجموعات الهرمية لا تتدرج تلقائيًا.',
+ 'Record: {0} reps at {1}': 'الرقم القياسي: {0} تكرار بوزن {1}',
+ 'Record: {0} reps': 'الرقم القياسي: {0} تكرار',
+ 'Max reps': 'تكرارات أقصى',
+ 'Most reps in a Max set per workout': 'أكبر عدد تكرارات في مجموعة أقصى لكل تمرين',
+ 'A set left at 0 rest uses the exercise’s rest.': 'المجموعة ذات الراحة 0 تستخدم راحة التمرين.',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 663a5a5bb..beba2af4f 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1683,4 +1683,14 @@ export default {
'Teal': 'Türkis',
'Yellow': 'Gelb',
'Enter how long it took — at least 1 minute.': 'Gib ein, wie lange es gedauert hat — mindestens 1 Minute.',
+ 'Pyramid sets': 'Pyramidensätze',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Ein eigenes Wiederholungsziel für jeden Satz, z. B. 12 · 8 · 6 · Max · 12.',
+ 'Max': 'Max',
+ 'Max: as many reps as you can': 'Max: so viele Wiederholungen wie möglich',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'Das Gewicht wählst du selbst: Pyramidensätze werden nicht automatisch gesteigert.',
+ 'Record: {0} reps at {1}': 'Rekord: {0} Wdh. mit {1}',
+ 'Record: {0} reps': 'Rekord: {0} Wdh.',
+ 'Max reps': 'Max-Wdh.',
+ 'Most reps in a Max set per workout': 'Meiste Wiederholungen in einem Max-Satz pro Training',
+ 'A set left at 0 rest uses the exercise’s rest.': 'Ein Satz mit 0 Pause nutzt die Pause der Übung.',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 8e1d9aa99..77d0e7076 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1663,4 +1663,14 @@ export default {
'Teal': 'Turquesa',
'Yellow': 'Amarillo',
'Enter how long it took — at least 1 minute.': 'Indica cuánto duró — al menos 1 minuto.',
+ 'Pyramid sets': 'Series piramidales',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Un objetivo de repeticiones distinto para cada serie, p. ej. 12 · 8 · 6 · Máx · 12.',
+ 'Max': 'Máx',
+ 'Max: as many reps as you can': 'Máx: tantas repeticiones como puedas',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'El peso lo eliges tú: las series piramidales no progresan automáticamente.',
+ 'Record: {0} reps at {1}': 'Récord: {0} reps con {1}',
+ 'Record: {0} reps': 'Récord: {0} reps',
+ 'Max reps': 'Reps Máx',
+ 'Most reps in a Max set per workout': 'Más repeticiones en una serie Máx por entrenamiento',
+ 'A set left at 0 rest uses the exercise’s rest.': 'Una serie con descanso 0 usa el descanso del ejercicio.',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index ee904194c..06657b7c4 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1663,4 +1663,14 @@ export default {
'Teal': 'Turquoise',
'Yellow': 'Jaune',
'Enter how long it took — at least 1 minute.': 'Indique combien de temps ça a duré — au moins 1 minute.',
+ 'Pyramid sets': 'Séries pyramidales',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Un objectif de répétitions différent pour chaque série, p. ex. 12 · 8 · 6 · Max · 12.',
+ 'Max': 'Max',
+ 'Max: as many reps as you can': 'Max : autant de répétitions que possible',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'Le poids, c’est toi qui le choisis : les séries pyramidales ne progressent pas automatiquement.',
+ 'Record: {0} reps at {1}': 'Record : {0} reps à {1}',
+ 'Record: {0} reps': 'Record : {0} reps',
+ 'Max reps': 'Reps Max',
+ 'Most reps in a Max set per workout': 'Le plus de répétitions sur une série Max par séance',
+ 'A set left at 0 rest uses the exercise’s rest.': 'Une série avec 0 de repos utilise le repos de l’exercice.',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index ccb0ca2aa..5f3644b27 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1663,4 +1663,14 @@ export default {
'Teal': 'फ़िरोज़ी',
'Yellow': 'पीला',
'Enter how long it took — at least 1 minute.': 'बताएँ कि इसमें कितना समय लगा — कम से कम 1 मिनट।',
+ 'Pyramid sets': 'पिरामिड सेट',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'हर सेट के लिए अलग रेप लक्ष्य, जैसे 12 · 8 · 6 · मैक्स · 12।',
+ 'Max': 'मैक्स',
+ 'Max: as many reps as you can': 'मैक्स: जितने रेप कर सकें',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'वज़न आप चुनें: पिरामिड सेट अपने आप नहीं बढ़ते।',
+ 'Record: {0} reps at {1}': 'रिकॉर्ड: {1} पर {0} रेप',
+ 'Record: {0} reps': 'रिकॉर्ड: {0} रेप',
+ 'Max reps': 'मैक्स रेप',
+ 'Most reps in a Max set per workout': 'हर वर्कआउट में मैक्स सेट के सबसे ज़्यादा रेप',
+ 'A set left at 0 rest uses the exercise’s rest.': '0 आराम वाला सेट एक्सरसाइज़ का आराम इस्तेमाल करता है।',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 61b151edc..2a3f2915e 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1666,4 +1666,14 @@ export default {
'Teal': 'Türkiz',
'Yellow': 'Sárga',
'Enter how long it took — at least 1 minute.': 'Add meg, meddig tartott — legalább 1 perc.',
+ 'Pyramid sets': 'Piramis sorozatok',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Minden sorozatnak saját ismétlésszám-célja van, pl. 12 · 8 · 6 · Max · 12.',
+ 'Max': 'Max',
+ 'Max: as many reps as you can': 'Max: annyi ismétlés, amennyi megy',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'A súlyt te választod: a piramis sorozatok nem progresszálnak automatikusan.',
+ 'Record: {0} reps at {1}': 'Rekord: {0} ism. {1} súllyal',
+ 'Record: {0} reps': 'Rekord: {0} ism.',
+ 'Max reps': 'Max ism.',
+ 'Most reps in a Max set per workout': 'A legtöbb ismétlés egy Max sorozatban edzésenként',
+ 'A set left at 0 rest uses the exercise’s rest.': 'A 0 pihenőjű sorozat a gyakorlat pihenőjét használja.',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 48e5dd34d..88b7a46a6 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1663,4 +1663,14 @@ export default {
'Teal': 'Turchese',
'Yellow': 'Giallo',
'Enter how long it took — at least 1 minute.': 'Inserisci quanto è durato — almeno 1 minuto.',
+ 'Pyramid sets': 'Serie piramidale',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Un target di ripetizioni diverso per ogni serie, es. 12 · 8 · 6 · Max · 12.',
+ 'Max': 'Max',
+ 'Max: as many reps as you can': 'Max: più ripetizioni che riesci',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'Il peso lo scegli tu: la serie piramidale non ha progressione automatica.',
+ 'Record: {0} reps at {1}': 'Record: {0} rip a {1}',
+ 'Record: {0} reps': 'Record: {0} rip',
+ 'Max reps': 'Rip Max',
+ 'Most reps in a Max set per workout': 'Più ripetizioni in una serie Max per allenamento',
+ 'A set left at 0 rest uses the exercise’s rest.': 'Una serie con riposo 0 usa il riposo dell’esercizio.',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 02628fa0a..800b55322 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1663,4 +1663,14 @@ export default {
'Teal': '청록',
'Yellow': '노랑',
'Enter how long it took — at least 1 minute.': '걸린 시간을 입력하세요 — 최소 1분.',
+ 'Pyramid sets': '피라미드 세트',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': '세트마다 다른 목표 반복 수, 예: 12 · 8 · 6 · 최대 · 12.',
+ 'Max': '최대',
+ 'Max: as many reps as you can': '최대: 할 수 있는 만큼 반복',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': '무게는 직접 정합니다: 피라미드 세트는 자동으로 증량되지 않습니다.',
+ 'Record: {0} reps at {1}': '기록: {1}로 {0}회',
+ 'Record: {0} reps': '기록: {0}회',
+ 'Max reps': '최대 반복',
+ 'Most reps in a Max set per workout': '운동마다 최대 세트의 최다 반복 수',
+ 'A set left at 0 rest uses the exercise’s rest.': '휴식이 0인 세트는 운동의 휴식 시간을 사용합니다.',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index f5910a684..46f79caec 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1663,4 +1663,14 @@ export default {
'Teal': 'Turkusowy',
'Yellow': 'Żółty',
'Enter how long it took — at least 1 minute.': 'Wpisz, ile to trwało — co najmniej 1 minutę.',
+ 'Pyramid sets': 'Serie piramidalne',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Inny cel powtórzeń dla każdej serii, np. 12 · 8 · 6 · Maks · 12.',
+ 'Max': 'Maks',
+ 'Max: as many reps as you can': 'Maks: tyle powtórzeń, ile dasz radę',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'Ciężar wybierasz sam: serie piramidalne nie mają automatycznej progresji.',
+ 'Record: {0} reps at {1}': 'Rekord: {0} powt. z {1}',
+ 'Record: {0} reps': 'Rekord: {0} powt.',
+ 'Max reps': 'Powt. Maks',
+ 'Most reps in a Max set per workout': 'Najwięcej powtórzeń w serii Maks na trening',
+ 'A set left at 0 rest uses the exercise’s rest.': 'Seria z przerwą 0 używa przerwy ćwiczenia.',
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index 41505d76e..1aac428c1 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -1008,6 +1008,10 @@ export const PT_BR_OVERRIDES = {
'Teal': 'Turquesa',
'Yellow': 'Amarelo',
'Enter how long it took — at least 1 minute.': 'Informe quanto tempo levou — pelo menos 1 minuto.',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Uma meta de repetições diferente para cada série, ex.: 12 · 8 · 6 · Máx · 12.',
+ 'Max: as many reps as you can': 'Máx: o máximo de repetições que você conseguir',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'Você escolhe o peso: as séries em pirâmide não progridem automaticamente.',
+ 'Most reps in a Max set per workout': 'Mais repetições em uma série Máx por treino',
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 65dd8ff54..5ac76e8e6 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1663,4 +1663,14 @@ export default {
'Teal': 'Turquesa',
'Yellow': 'Amarelo',
'Enter how long it took — at least 1 minute.': 'Indica quanto tempo demorou — pelo menos 1 minuto.',
+ 'Pyramid sets': 'Séries em pirâmide',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Um objetivo de repetições diferente para cada série, p. ex. 12 · 8 · 6 · Máx · 12.',
+ 'Max': 'Máx',
+ 'Max: as many reps as you can': 'Máx: o máximo de repetições que conseguires',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'O peso escolhes tu: as séries em pirâmide não progridem automaticamente.',
+ 'Record: {0} reps at {1}': 'Recorde: {0} reps com {1}',
+ 'Record: {0} reps': 'Recorde: {0} reps',
+ 'Max reps': 'Reps Máx',
+ 'Most reps in a Max set per workout': 'Mais repetições numa série Máx por treino',
+ 'A set left at 0 rest uses the exercise’s rest.': 'Uma série com descanso 0 usa o descanso do exercício.',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 2df1568f7..82256bd64 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1663,4 +1663,14 @@ export default {
'Teal': 'Бирюзовый',
'Yellow': 'Жёлтый',
'Enter how long it took — at least 1 minute.': 'Укажите, сколько это длилось — не меньше 1 минуты.',
+ 'Pyramid sets': 'Пирамида',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Своя цель по повторам для каждого подхода, например 12 · 8 · 6 · Макс · 12.',
+ 'Max': 'Макс',
+ 'Max: as many reps as you can': 'Макс: столько повторов, сколько сможете',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'Вес выбираете вы: пирамида не прогрессирует автоматически.',
+ 'Record: {0} reps at {1}': 'Рекорд: {0} повт. с {1}',
+ 'Record: {0} reps': 'Рекорд: {0} повт.',
+ 'Max reps': 'Повт. Макс',
+ 'Most reps in a Max set per workout': 'Больше всего повторов в подходе Макс за тренировку',
+ 'A set left at 0 rest uses the exercise’s rest.': 'Подход с отдыхом 0 использует отдых упражнения.',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 3604d80fa..341f71c61 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1674,4 +1674,14 @@ export default {
'Teal': 'เขียวน้ำทะเล',
'Yellow': 'เหลือง',
'Enter how long it took — at least 1 minute.': 'ใส่ระยะเวลาที่ใช้ — อย่างน้อย 1 นาที',
+ 'Pyramid sets': 'เซ็ตพีระมิด',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'เป้าหมายจำนวนครั้งแยกสำหรับแต่ละเซ็ต เช่น 12 · 8 · 6 · สูงสุด · 12',
+ 'Max': 'สูงสุด',
+ 'Max: as many reps as you can': 'สูงสุด: ทำให้ได้มากที่สุด',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'น้ำหนักให้คุณเลือกเอง: เซ็ตพีระมิดไม่เพิ่มน้ำหนักอัตโนมัติ',
+ 'Record: {0} reps at {1}': 'สถิติ: {0} ครั้งที่ {1}',
+ 'Record: {0} reps': 'สถิติ: {0} ครั้ง',
+ 'Max reps': 'ครั้งสูงสุด',
+ 'Most reps in a Max set per workout': 'จำนวนครั้งมากที่สุดในเซ็ตสูงสุดต่อการฝึก',
+ 'A set left at 0 rest uses the exercise’s rest.': 'เซ็ตที่พัก 0 จะใช้เวลาพักของท่านั้น',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 1c96ebc30..96547f20d 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1663,4 +1663,14 @@ export default {
'Teal': 'Turkuaz',
'Yellow': 'Sarı',
'Enter how long it took — at least 1 minute.': 'Ne kadar sürdüğünü gir — en az 1 dakika.',
+ 'Pyramid sets': 'Piramit setler',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Her set için ayrı bir tekrar hedefi, ör. 12 · 8 · 6 · Maks · 12.',
+ 'Max': 'Maks',
+ 'Max: as many reps as you can': 'Maks: yapabildiğin kadar tekrar',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'Ağırlığı sen seçersin: piramit setler otomatik olarak ilerletilmez.',
+ 'Record: {0} reps at {1}': 'Rekor: {1} ile {0} tekrar',
+ 'Record: {0} reps': 'Rekor: {0} tekrar',
+ 'Max reps': 'Maks tekrar',
+ 'Most reps in a Max set per workout': 'Antrenman başına bir Maks setteki en çok tekrar',
+ 'A set left at 0 rest uses the exercise’s rest.': 'Dinlenmesi 0 olan set, egzersizin dinlenmesini kullanır.',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index ba239e0c8..4b4fb405a 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1660,4 +1660,14 @@ export default {
'Teal': 'Бірюзовий',
'Yellow': 'Жовтий',
'Enter how long it took — at least 1 minute.': 'Вкажи, скільки це тривало — щонайменше 1 хвилину.',
+ 'Pyramid sets': 'Піраміда',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': 'Окрема ціль повторів для кожного підходу, наприклад 12 · 8 · 6 · Макс · 12.',
+ 'Max': 'Макс',
+ 'Max: as many reps as you can': 'Макс: стільки повторів, скільки зможеш',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': 'Вагу обираєш ти: піраміда не прогресує автоматично.',
+ 'Record: {0} reps at {1}': 'Рекорд: {0} повт. з {1}',
+ 'Record: {0} reps': 'Рекорд: {0} повт.',
+ 'Max reps': 'Повт. Макс',
+ 'Most reps in a Max set per workout': 'Найбільше повторів у підході Макс за тренування',
+ 'A set left at 0 rest uses the exercise’s rest.': 'Підхід із відпочинком 0 використовує відпочинок вправи.',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 84237894a..27ad56d4a 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1663,4 +1663,14 @@ export default {
'Teal': '青色',
'Yellow': '黄色',
'Enter how long it took — at least 1 minute.': '请输入用时 — 至少 1 分钟。',
+ 'Pyramid sets': '金字塔组',
+ 'A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.': '每组设定不同的目标次数,例如 12 · 8 · 6 · 力竭 · 12。',
+ 'Max': '力竭',
+ 'Max: as many reps as you can': '力竭:能做多少做多少',
+ 'Weight is up to you: pyramid sets are not progressed automatically.': '重量由你决定:金字塔组不会自动递增。',
+ 'Record: {0} reps at {1}': '纪录:{1} 做 {0} 次',
+ 'Record: {0} reps': '纪录:{0} 次',
+ 'Max reps': '力竭次数',
+ 'Most reps in a Max set per workout': '每次训练中力竭组的最多次数',
+ 'A set left at 0 rest uses the exercise’s rest.': '休息为 0 的组使用该动作的休息时间。',
}
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 71020da59..8b8622b96 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -32,6 +32,7 @@ import { estimate1RM, best1RM, is1RMRecord, REP_CAP } from './lib/onerm.js'
import { exerciseHistory } from './lib/exercise-history.js'
import { policyFor, defaultIncrement, POLICIES_FOR, POLICY_NAME, POLICY_DESC, MAX_BW_SETS, weightIncrement } from './lib/progression.js'
import { normalizeRepRange } from './lib/rep-range.js'
+import { isPyramid, normalizePyramid, normalizePyramidRest, pyramidFromFlat, flatFromPyramid, pyramidLabel, PYRAMID_MAX, MAX_PYRAMID_SETS, PYRAMID_PRESETS } from './lib/pyramid.js'
import { MOBILE, shareExport, printHtml } from './lib/mobile.js'
import { speedUnitOf, toSpeed, fromSpeed } from './lib/speed.js'
import { buildCompletedWorkout } from './lib/finish-workout.js'
@@ -1380,7 +1381,10 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
// Both default from the dataset and are then whatever the config says — see isBw.
const bw = !cardio && isBw({ ...c, id: ex.id })
const perSide = isPerSide(c)
- const progressionPolicy = policyFor({ ...c, id: ex.id }, routine, mode)
+ // Pyramid sets: one rep target per set, in place of the flat Sets × Reps (CONTEXT.md).
+ const pyramid = mode === 'reps' && isPyramid({ ...c, mode })
+ const setPyramidAt = (i, v) => setC(x => ({ ...x, pyramid: x.pyramid.map((p, j) => (j === i ? v : p)) }))
+ const progressionPolicy =policyFor({ ...c, id: ex.id }, routine, mode)
const progressionStepInvalid = !progressionStepIsValid(progressionStepOf(c, mode, ex, st.unit), progressionPolicy)
const activePolicy = policyFor({ ...c, id: ex.id }, routine, mode)
const double = mode === 'reps' && activePolicy === 'double'
@@ -1441,12 +1445,18 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
reps = range.reps
}
const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...flags, ...(perSide ? { side: true } : {}), ...prog, ...withNote, ...withWarmups, ...withRest }
+ // The list is the prescription; sets and reps follow it, so everything that reads the
+ // flat target (a config sheet reopened with the toggle off, older builds) still makes sense.
+ const list = pyramid ? normalizePyramid(c.pyramid, stride) : []
+ if (list.length) Object.assign(out, flatFromPyramid(list), { pyramid: list })
+ const pyramidRest = list.length ? normalizePyramidRest(c.pyramidRest, list.length) : []
+ if (pyramidRest.length) out.pyramidRest = pyramidRest
if (double) out.repsMin = range.repsMin
// A ceiling below the working reps would tell you to add a set on day one.
if (bw && !(out.weight > 0) && c.repsMax > 0) out.repsMax = Math.max(reps, Math.round(c.repsMax))
// Every set in this exercise becomes a drop-set/rest-pause (buildSets stamps the rows) —
// decided here, in the plan, not re-decided live each time you train it.
- if (c.intensifier && c.intensifier.type) out.intensifier = intensifierToSave(c.intensifier)
+ if (!list.length && c.intensifier && c.intensifier.type) out.intensifier = intensifierToSave(c.intensifier)
onSave(out)
}
}
@@ -1485,14 +1495,50 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
</> : <>
{/* Rest-pause always trains as exactly two rows — a warm-up at this rep count, then one
rest-pause work set — so "Sets" has nothing left to mean and only invites a mismatch. */}
- {c.intensifier?.type !== 'restpause' &&
+ {c.intensifier?.type !== 'restpause' && !pyramid &&
<Stepper label={t('Sets')} value={c.sets} step={1} decimal={false} onChange={v => setC(x => ({ ...x, sets: v }))} />}
- {!double && <Stepper label={t('Reps')} value={c.reps} step={perSide ? 2 : 1} decimal={false} onChange={v => setC(x => ({ ...x, reps: v }))} />}
+ {!double && !pyramid && <Stepper label={t('Reps')} value={c.reps} step={perSide ? 2 : 1} decimal={false} onChange={v => setC(x => ({ ...x, reps: v }))} />}
{/* On bodyweight work the weight stepper is the click #32 is about, so it is not here
until there is a belt to describe — see the added-weight row below. */}
- {!bw && <Stepper label={t('Weight ({0})', st.unit)} value={c.weight} step={2.5} onChange={v => setC(x => ({ ...x, weight: v }))} />}
+ {!bw && !pyramid && <Stepper label={t('Weight ({0})', st.unit)} value={c.weight} step={2.5} onChange={v => setC(x => ({ ...x, weight: v }))} />}
</>}
</div>
+ {/* Pyramid sets: a row per set, each with its own reps or Max. No weight — that is picked
+ set by set while training, seeded from the same set last time (buildSets). */}
+ {pyramid && <div style={{ marginTop: -10, marginBottom: 18 }}>
+ {/* Presets replace the list (and its rests) in one tap; the sheet is not saved until Save. */}
+ <div className="chips" style={{ marginBottom: 10 }}>
+ {PYRAMID_PRESETS.map((preset, k) => <button key={k} type="button" className="chip"
+ onClick={() => setC(x => ({ ...x, pyramid: [...preset], pyramidRest: undefined }))}>{pyramidLabel(preset)}</button>)}
+ </div>
+ {c.pyramid.map((p, i) => <div key={i} style={{ marginBottom: 10 }}>
+ <div className="row cfgrow" style={{ marginBottom: 4 }}>
+ {p === PYRAMID_MAX
+ ? <div className="small"><strong>{t('Set {0}', i + 1)}</strong> · {t('Max: as many reps as you can')}</div>
+ : <Stepper label={t('Set {0}', i + 1)} value={p} step={perSide ? 2 : 1} min={1} decimal={false} onChange={v => setPyramidAt(i, v)} />}
+ <Stepper label={t('Rest (s)')} value={(c.pyramidRest || [])[i] || 0} step={15} decimal={false}
+ onChange={v => setC(x => {
+ const rest = Array.from({ length: x.pyramid.length }, (_, j) => (x.pyramidRest || [])[j] || 0)
+ rest[i] = v
+ return { ...x, pyramidRest: rest }
+ })} />
+ </div>
+ <div className="row" style={{ justifyContent: 'flex-end', gap: 8 }}>
+ <Button size="sm" variant={p === PYRAMID_MAX ? 'primary' : 'plain'} aria-pressed={p === PYRAMID_MAX}
+ onClick={() => setPyramidAt(i, p === PYRAMID_MAX ? (c.reps || 10) : PYRAMID_MAX)}>{t('Max')}</Button>
+ {c.pyramid.length > 1 && <Button size="sm" icon="trash" aria-label={t('Remove set')} title={t('Remove set')}
+ onClick={() => setC(x => ({ ...x, pyramid: x.pyramid.filter((_, j) => j !== i), pyramidRest: x.pyramidRest?.filter((_, j) => j !== i) }))} />}
+ </div>
+ </div>)}
+ <Button size="sm" icon="plus" disabled={c.pyramid.length >= MAX_PYRAMID_SETS}
+ onClick={() => setC(x => ({
+ ...x,
+ pyramid: [...x.pyramid, x.pyramid[x.pyramid.length - 1]],
+ // The new set copies the last one's rest too, like its target.
+ pyramidRest: x.pyramidRest?.length ? [...x.pyramid.map((_, j) => x.pyramidRest[j] || 0), x.pyramidRest[x.pyramid.length - 1] || 0] : x.pyramidRest,
+ }))}>{t('Add set')}</Button>
+ <div className="small dim" style={{ marginTop: 8 }}>{t('A set left at 0 rest uses the exercise’s rest.')}</div>
+ </div>}
{c.intensifier?.type === 'restpause' && <div className="small dim" style={{ marginTop: -10, marginBottom: 18 }}>
{t('Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.')}
</div>}
@@ -1540,6 +1586,14 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
: next
})} />
</Row>}
+ {/* Off keeps the list as `pyramidDraft`, so a stray tap does not lose it before Save
+ (save writes neither field unless the toggle is on). */}
+ {mode === 'reps' && <Row icon="target" iconTint="var(--acc)" title={t('Pyramid sets')}
+ subtitle={t('A different rep target for each set, e.g. 12 · 8 · 6 · Max · 12.')}>
+ <Switch checked={pyramid} onChange={v => setC(x => (v
+ ? { ...x, pyramid: x.pyramidDraft || pyramidFromFlat(x), intensifier: undefined }
+ : { ...x, ...flatFromPyramid(x.pyramid), pyramidDraft: x.pyramid, pyramid: undefined }))} />
+ </Row>}
</div>}
{/* A stepper is too wide to sit in a list row next to a label — it squeezes the text to
one word per line — so added weight gets the same full-width treatment as sets and
@@ -1563,7 +1617,8 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
? t('Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.', c.repsMax, MAX_BW_SETS)
: t('Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.')}
</div>}
- {mode === 'reps' && <>
+ {/* A pyramid already shapes every set; a drop-set or rest-pause would reshape them again. */}
+ {mode === 'reps' && !pyramid && <>
<h4 className="sec">{t('Drop-set / rest-pause')}</h4>
<div className="sect-b" style={{ marginBottom: 8 }}>
<SelectRow title={t('Intensifier')} sheetTitle={t('Intensifier')} value={c.intensifier?.type || ''}
@@ -1606,7 +1661,9 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i
<h4 className="sec">{t('Plate loading')}</h4>
<BarWeightEditor ex={ex} cfg={c} extra={t('Applies to this exercise everywhere, not just this plan.')} />
</>}
- <ProgressionFields ex={ex} mode={mode} c={c} setC={setC} routine={routine} unit={st.unit} perSide={perSide} />
+ {pyramid
+ ? <div className="small dim" style={{ marginBottom: 18 }}>{t('Weight is up to you: pyramid sets are not progressed automatically.')}</div>
+ : <ProgressionFields ex={ex} mode={mode} c={c} setC={setC} routine={routine} unit={st.unit} perSide={perSide} />}
<textarea className="input" rows={3} maxLength={500} style={{ marginBottom: 18 }}
placeholder={t('Note (optional) — loading cues, "bar only then +1 plate/side each set", anything worth remembering here')}
value={c.note || ''} onChange={e => setC(x => ({ ...x, note: e.target.value }))} />
diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsx
index d96d0ab47..5c9f7d4fd 100644
--- a/frontend/src/views/Stats.jsx
+++ b/frontend/src/views/Stats.jsx
@@ -16,6 +16,7 @@ import { fatigueOf, strengthOf, STRENGTH_FLOOR, LB_TO_KG } from '../lib/recovery
import { strengthExerciseRowsForMuscle } from '../lib/strength-exercises.js'
import { fatigueStateOf } from '../lib/recovery-view.js'
import { e1rmSeries, best1RM } from '../lib/onerm.js'
+import { maxRepsSeries } from '../lib/pyramid.js'
import {
hasEffort, displayScale, scaleName, toScale, avgRir, effortSummary, effortWeeks,
effortHistogram, isHardSet, HARD_RIR
@@ -437,8 +438,17 @@ export default function Stats() {
const exRir = exPts.map(p => avgRir(p.sets))
const showEff = exRir.filter(v => v != null).length >= 3
const effPts = exPts.map((p, i) => (exRir[i] == null ? null : { t: p.t, y: toScale(kind, exRir[i]), d: p.d })).filter(Boolean)
+ // Pyramid sets' Max sets: the most reps in one, per workout — the point of a Max set is seeing
+ // that number climb, which the top-set weight line does not show.
+ const maxPts = useMemo(
+ () => (curEx && curMode === 'reps' ? maxRepsSeries(workouts, curEx).map(p => ({ t: p.t, y: p.y, d: p.d, note: p.w > 0 ? fmtNum(p.w) + ' ' + S.unit : undefined })) : []),
+ [workouts, curEx, curMode, S.unit],
+ )
+ const showMax = maxPts.length > 0
+ const maxBest = showMax ? Math.max(...maxPts.map(p => p.y)) : 0
const onE1 = showE1 && exMetric === 'e1rm'
const onEff = showEff && exMetric === 'effort'
+ const onMax = showMax && exMetric === 'max'
const topPts = exPts.map((p, i) => ({
t: p.t, y: p.y, d: p.d,
// 0 RIR (nothing left) is a full dot, 4+ a faint one; unrated sessions keep the plain line.
@@ -448,6 +458,7 @@ export default function Stats() {
const exOpts = [{ value: 'top', label: t('Top set') }]
if (showE1) exOpts.push({ value: 'e1rm', label: t('Est. 1RM') })
if (showEff) exOpts.push({ value: 'effort', label: t('Effort') })
+ if (showMax) exOpts.push({ value: 'max', label: t('Max reps') })
return <>
<div className="hdr"><div><h1>{t('Stats')}</h1><div className="sub">{t('Progress & history')}</div></div>
@@ -510,22 +521,24 @@ export default function Stats() {
match: (option, query) => matchExercise(matcherOf(option.value), query),
}} />
</div>
- {exOpts.length > 1 && <Segmented className="seg-range" value={onEff ? 'effort' : onE1 ? 'e1rm' : 'top'} onChange={setExMetric} options={exOpts} />}
+ {exOpts.length > 1 && <Segmented className="seg-range" value={onMax ? 'max' : onEff ? 'effort' : onE1 ? 'e1rm' : 'top'} onChange={setExMetric} options={exOpts} />}
<div className="chart">
- {onEff
+ {onMax
+ ? <LineChart points={maxPts} h={150} unit={t('reps')} color="var(--blue)" />
+ : onEff
? <LineChart points={effPts} h={150} unit={hd} color="var(--yellow)" invert={kind === 'rir'} />
: <LineChart points={onE1 ? e1ChartPts : topPts} h={150} unit={exUnit} color="var(--blue)" />}
</div>
<div style={{ marginTop: 8 }}>{exList.map((p, i) => <div key={i} className="row between small" style={{ padding: '6px 0', borderBottom: 'var(--hair) solid var(--sep)' }}>
<span className="muted">{fmtDate(p.d, true)}</span><span>{p.sets.map(s => setLabel(curEx, s, p.target, speedUnit)).join(' ')}</span></div>)}</div>
<div className="small dim" style={{ marginTop: 8 }}>
- {onEff ? t('Average effort per workout') : onE1 ? t('Estimated 1RM per workout') : curCardio ? t('Top speed per workout') : curTimed ? t('Longest hold per workout') : repsOnly ? t('Most reps in a set per workout') : t('Best set weight per workout')}
- {onEff ? '' : <> · {t('Best:')}{' '}<b className="accent">{fmtNum(onE1 ? e1Best.est : exBest)} {onE1 ? S.unit : exUnit}</b></>}
+ {onMax ? <>{t('Most reps in a Max set per workout')} · {t('Best:')}{' '}<b className="accent">{maxBest} {t('reps')}</b></> : onEff ? t('Average effort per workout') : onE1 ? t('Estimated 1RM per workout') : curCardio ? t('Top speed per workout') : curTimed ? t('Longest hold per workout') : repsOnly ? t('Most reps in a set per workout') : t('Best set weight per workout')}
+ {onEff || onMax ? '' : <> · {t('Best:')}{' '}<b className="accent">{fmtNum(onE1 ? e1Best.est : exBest)} {onE1 ? S.unit : exUnit}</b></>}
</div>
{onE1 && <div className="small dim" style={{ marginTop: 4 }}>
{t('Best estimate from {0} on {1} — an estimate, not a tested max.', fmtNum(e1Best.w) + ' ' + S.unit + ' × ' + e1Best.r, fmtDate(e1Best.d, true))}
</div>}
- {!onEff && !onE1 && showEff && <div className="small dim" style={{ marginTop: 4 }}>
+ {!onEff && !onE1 && !onMax && showEff && <div className="small dim" style={{ marginTop: 4 }}>
{t('A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.', hd)}
</div>}
</> : <div className="muted small">{t('Finish your first workout to see progress curves here.')}</div>}
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 39340a4ed..20a9b72c3 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -13,6 +13,7 @@ import { speedUnitOf, toSpeed, fromSpeed } from '../lib/speed.js'
import { beep, vibrate, unlock } from '../lib/sound.js'
import { t, exerciseNameFor, exerciseNameClass } from '../lib/i18n.js'
import { api, beacon } from '../lib/api.js'
+import { pyramidRestFor, maxRecordAt } from '../lib/pyramid.js'
import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor, warmupRestSecFor } from '../lib/supersetFlow.js'
import Media from '../components/Media.jsx'
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, finishWorkout, exitWorkoutEdit, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, renameWorkoutSheet, swapActiveWorkoutExercise, barWeightSheet, menuSheet, effortPickerSheet, exerciseHistorySheet, addRoutineToSessionSheet } from '../sheets.jsx'
@@ -563,6 +564,13 @@ function ExerciseBlock({ entryIdx, compact, dense, editing, onToggle, onToggleSi
return <div key={i}>
{isFirstWarmup && <div className="setph">{t('Warm-up')}</div>}
{!warm && warmBefore && <div className="setsep" />}
+ {/* A pyramid's Max set: the reps are what you managed, not a number to hit. */}
+ {/* With the record to beat at this set's weight or heavier, from before this session. */}
+ {!warm && s.max && <div className="setph">{t('Max: as many reps as you can')}{(() => {
+ const rec = maxRecordAt(H.workouts, entry.id, s.w)
+ if (!rec) return null
+ return ' · ' + (rec.w > 0 ? t('Record: {0} reps at {1}', rec.r, fmtNum(rec.w) + ' ' + S.unit) : t('Record: {0} reps', rec.r))
+ })()}</div>}
{perSide && !warm && isSideSet(s) ? (
// Unilateral work set: the number sits beside a two-row L/R stack, each side logged
// and ticked on its own (issue #60).
@@ -783,7 +791,8 @@ function ActiveWorkout() {
if (m === 'cardio') e.sets.push({ min: l ? l.min : (e.target.min || 20), speed: l ? l.speed : (e.target.speed || 8), done: false })
else if (m === 'time') e.sets.push({ sec: l ? l.sec : (e.target.sec || 45), w: l ? (l.w || 0) : (e.target.weight || 0), done: false })
else {
- const row = { w: l ? l.w : 0, r: l ? l.r : e.target.reps, done: false }
+ // An extra set past a pyramid copies the last one's target, Max included.
+ const row = { w: l ? l.w : 0, r: l ? l.r : e.target.reps, done: false, ...(l && l.max ? { max: true } : {}) }
// A unilateral exercise keeps adding per-side rows (issue #60): seed each side from the
// previous set's own side when it had one, else split the row's total evenly.
e.sets.push(isPerSide({ ...(e.target || {}), id: e.id })
@@ -1120,7 +1129,9 @@ function ActiveWorkout() {
// The rest this set has earned: the exercise's own restSec when it set one, the global
// timer when it did not, and the longest of the group's across a superset (issue #10).
// Resolved once here so every branch below times the same break.
- const restSec = restSecFor(fresh.entries, freshUnit || [idx], S.restSec)
+ // A pyramid set may carry its own rest, standing in for the exercise's (pyramidRestFor).
+ const setRest = { idx, sec: pyramidRestFor(fresh.entries[idx].target, fresh.entries[idx].sets, i) }
+ const restSec = restSecFor(fresh.entries, freshUnit || [idx], S.restSec, setRest)
// A warm-up ramp set may rest shorter than a work set (the exercise's warmupRestSec); the
// last ramp set, into the first work set, still gets the working rest.
const restAfter = warmupRestSecFor(fresh.entries[idx], i, restSec)
diff --git a/mcp/package-lock.json b/mcp/package-lock.json
index 6cefdf4d1..016e81381 100644
--- a/mcp/package-lock.json
+++ b/mcp/package-lock.json
@@ -280,9 +280,6 @@
"arm64"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -300,9 +297,6 @@
"arm64"
],
"dev": true,
- "libc": [
- "musl"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -320,9 +314,6 @@
"ppc64"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -340,9 +331,6 @@
"s390x"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -360,9 +348,6 @@
"x64"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -380,9 +365,6 @@
"x64"
],
"dev": true,
- "libc": [
- "musl"
- ],
"license": "MIT",
"optional": true,
"os": [
@@ -1561,9 +1543,6 @@
"arm64"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1585,9 +1564,6 @@
"arm64"
],
"dev": true,
- "libc": [
- "musl"
- ],
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1609,9 +1585,6 @@
"x64"
],
"dev": true,
- "libc": [
- "glibc"
- ],
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1633,9 +1606,6 @@
"x64"
],
"dev": true,
- "libc": [
- "musl"
- ],
"license": "MPL-2.0",
"optional": true,
"os": [
diff --git a/mcp/src/labels.js b/mcp/src/labels.js
index abb813918..5b884e89e 100644
--- a/mcp/src/labels.js
+++ b/mcp/src/labels.js
@@ -3,6 +3,7 @@
import { MUSCLE_NAME, MUSCLES } from '../../frontend/src/lib/muscles.js'
import { modeOf, fmtSec, setLabel } from '../../frontend/src/lib/history.js'
import { POLICY_NAME } from '../../frontend/src/lib/progression.js'
+import { isPyramid, pyramidLabel } from '../../frontend/src/lib/pyramid.js'
import { fmtDate, fmtNum, fmtDur } from '../../frontend/src/lib/format.js'
// Apply {0},{1},… substitutions to the template strings the lib returns.
@@ -20,6 +21,8 @@ export function exLine(cfg, unit) {
const load = cfg.weight ? ' · ' + fmtNum(cfg.weight) + ' ' + unit : ''
if (mode === 'cardio') return `${n} × ${cfg.min || 20} min @ ${fmtNum(cfg.speed || 8)} km/h`
if (mode === 'time') return `${n} × ${fmtSec(cfg.sec || 45)}${load}`
+ // Pyramid sets read as their per-set targets, the way the app shows them ("12 · 8 · 6 · Max · 12").
+ if (isPyramid(cfg)) return pyramidLabel(cfg.pyramid)
// A double-progression range is stored as its top (`reps`) and bottom (`repsMin`); it reads
// as the range, the way the app's routine editor shows it ("3 × 8–12").
const reps = cfg.repsMin > 0 && cfg.repsMin < cfg.reps ? `${cfg.repsMin}–${cfg.reps}` : `${cfg.reps}`
diff --git a/mcp/src/tools.js b/mcp/src/tools.js
index dd4600aa8..53b151ead 100644
--- a/mcp/src/tools.js
+++ b/mcp/src/tools.js
@@ -106,7 +106,7 @@ export const listRoutines = {
/** get_routine — the full exercise list for one routine, including set/rep targets. */
export const getRoutine = {
name: 'get_routine',
- description: 'Get the full exercise list for a single routine (the same view the routine editor shows). Returns mode (reps/time/cardio), set/rep/weight targets, superset links, any per-exercise custom increment or Epley deload factor, and each exercise\'s own rest in seconds (absent means it inherits the global rest timer). Use routine_id from list_routines.',
+ description: 'Get the full exercise list for a single routine (the same view the routine editor shows). Returns mode (reps/time/cardio), set/rep/weight targets (a `pyramid` list of per-set rep targets, \'max\' meaning as many reps as possible, when the exercise uses pyramid sets), superset links, any per-exercise custom increment or Epley deload factor, and each exercise\'s own rest in seconds (absent means it inherits the global rest timer). Use routine_id from list_routines.',
schema: { routine_id: z.string().min(1) },
handler: ({ routine_id }) => {
const S = getState()
@@ -134,6 +134,10 @@ export const getRoutine = {
reps: mode === 'reps' ? (cfg.reps || 0) : undefined,
reps_min: mode === 'reps' && cfg.repsMin != null ? cfg.repsMin : undefined,
reps_max: mode === 'reps' && cfg.repsMax != null ? cfg.repsMax : undefined,
+ // Pyramid sets: one rep target per set, in order; 'max' is as many reps as possible.
+ pyramid: mode === 'reps' && Array.isArray(cfg.pyramid) && cfg.pyramid.length ? cfg.pyramid : undefined,
+ // Each pyramid set's own rest in seconds, 0 meaning the exercise's rest.
+ pyramid_rest_sec: mode === 'reps' && Array.isArray(cfg.pyramid) && cfg.pyramid.length && Array.isArray(cfg.pyramidRest) && cfg.pyramidRest.length ? cfg.pyramidRest : undefined,
sec: mode === 'time' ? (cfg.sec || 0) : undefined,
min: mode === 'cardio' ? (cfg.min || 0) : undefined,
speed: mode === 'cardio' ? (cfg.speed || 0) : undefined,
diff --git a/mcp/test/tools.test.js b/mcp/test/tools.test.js
index 0eb77a959..741dc3c3f 100644
--- a/mcp/test/tools.test.js
+++ b/mcp/test/tools.test.js
@@ -135,6 +135,14 @@ describe('get_routine', () => {
expect(r.exercises[0].summary).toBe('3 × 8–12 · 40 kg')
})
+ test('reports pyramid sets as the per-set targets, not as sets × reps', () => {
+ const cfg = S.routines[0].ex[0]
+ Object.assign(cfg, { mode: 'reps', sets: 5, reps: 12, weight: 0, pyramid: [12, 8, 6, 'max', 12] })
+ delete cfg.repsMin
+ const r = call('get_routine', { routine_id: S.routines[0].id })
+ expect(r.exercises[0]).toMatchObject({ pyramid: [12, 8, 6, 'max', 12], policy: 'off', summary: '12 · 8 · 6 · Max · 12' })
+ })
+
test('reports an exercise\'s own rest, and leaves it out when it inherits the timer', () => {
S.routines[0].ex[0].restSec = 180
delete S.routines[0].ex[1]?.restSec