Comments: trim to the established cadence

The MCP code came in with 5–8 line file headers, JSDoc on every
one-line wrapper, and inline explanations that referenced the PR
itself ("so the MCP server can reuse it") — none of which matches
api/server.js or frontend/src/lib/, where comments are one-line,
fact-shaped and never mention the change that introduced them.

Trimmed across mcp/src/*.js, i18n-core.js, i18n.js, exercises.js,
format.js, mcp/test/tools.test.js, mcp/vitest.config.js and
mcp/README.md. Tool prefaces lost their numbers; duplicate fs.watch
rationale folded into one; the ASCII import diagram in the README
replaced with a paragraph; the cross-references and self-references
removed. Also fixed two real defects: a corrupted Cyrillic word in a
state.js comment and a missing space in a tools.test.js comment.

No code changes; 92 frontend + 32 MCP tests still pass.
This commit is contained in:
Pengboi committed 2026-07-26 19:47:52 +01:00
1 parent 4143ab8676
commit 6aaf2a3eea
11 files changed
+93 -245

No files matched your search

+3 -15
View File
@@ -1,25 +1,19 @@
// Formatting glue between pure lib helpers and the JSON the MCP tools return to an LLM.
//
// The lib modules speak in compact codes (e.g. `nextPrescription.why` is [template, ...args])
// because the UI also needs to translate them. An LLM doesn't read templates, so the tools
// format each value into final English text before serialising. Keeping this in one place
// means a fix to a phrasing lands in every tool at once.
// Formatting glue between lib helpers (which speak {0}/{1} templates) and the JSON returned
// to the LLM.
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 { fmtDate, fmtNum, fmtDur } from '../../frontend/src/lib/format.js'
/** Apply {0},{1},… substitutions to the template strings the lib returns. */
// Apply {0},{1},… substitutions to the template strings the lib returns.
export function fmt(template, args) {
let v = template
for (let i = 0; i < (args || []).length; i++) v = v.replaceAll('{' + i + '}', String(args[i]))
return v
}
/** Pre-formatted label for one set, e.g. "5 @ 60 kg", "1:30 · 20 kg", "20 min @ 8 km/h". */
export { setLabel }
/** A one-line description of a routine entry, e.g. "3 × 10 · 60 kg". Accepts a cfg + unit. */
export function exLine(cfg, unit) {
const mode = modeOf(cfg)
const n = cfg.sets || 1
@@ -29,31 +23,25 @@ export function exLine(cfg, unit) {
return `${n} × ${cfg.reps}${load}`
}
/** A human name for a muscle slug, falling back to the slug if unmapped. */
export function muscleName(slug) {
return MUSCLE_NAME[slug] || slug
}
/** English name of a progression policy, falling back to the slug. */
export function policyName(policy) {
return POLICY_NAME[policy] || policy
}
/** Friendly month-day for an ISO date ("3 Jul"); used in summaries so the LLM reads natural. */
export function friendlyDate(iso) {
if (!iso) return null
return fmtDate(iso)
}
/** Duration in minutes ("46 min", "1h 14m"). */
export function friendlyDuration(ms) {
return ms ? fmtDur(ms) : null
}
/** Sums vs planned and returns a "{done}/{total}" label. */
export function ratio(done, total) {
return `${done}/${total}`
}
/** Returns the muscle slugs in head-to-toe order (the same order UI lists them). */
export function muscleOrder() { return MUSCLES.slice() }