Matériel coché dans le profil, bibliothèque « ce que mon matériel permet » (5a)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-23 02:12:25 +01:00
co-authored by Claude Opus 5.5
parent 938d6cf198
commit 72adffb613
15 changed files with 281 additions and 20 deletions
+6 -1
View File
@@ -1,11 +1,14 @@
// Le profil : ce que l'IA doit savoir pour construire le programme.
// Glossaire : docs/glossaire/profil.md
import { isKit } from "./kit.js";
/**
* @typedef {object} Profile
* @property {string} goal objectif, en une phrase
* @property {string} context pratique passée, lieu d'entraînement
* @property {string[]} equipment matériel disponible
* @property {string[]} equipment matériel disponible, en texte libre (ce que les cases ne disent pas)
* @property {import("./kit.js").Kit[]} [kit] matériel coché (lot 5a) ; absent : pas encore renseigné
* @property {string[]} constraints contraintes de sécurité et d'organisation
* @property {number|null} heightCm
* @property {number} sessionMinutes durée visée d'une séance
@@ -33,6 +36,8 @@ export function validateProfile(profile) {
for (const k of ["goal", "context"]) if (typeof p[k] !== "string") errors.push(`'${k}' doit être un texte.`);
for (const k of ["equipment", "constraints"])
if (!Array.isArray(p[k]) || !p[k].every((/** @type {unknown} */ s) => typeof s === "string")) errors.push(`'${k}' doit être une liste de textes.`);
if (p.kit !== undefined && !(Array.isArray(p.kit) && p.kit.every(isKit) && new Set(p.kit).size === p.kit.length))
errors.push("'kit' doit être une liste de clés de matériel connues, sans doublon (voir le format du profil).");
if (p.heightCm !== null && !(typeof p.heightCm === "number" && p.heightCm > 50 && p.heightCm < 260))
errors.push("'heightCm' doit être une taille en centimètres, ou null.");
if (!(typeof p.sessionMinutes === "number" && p.sessionMinutes >= 10 && p.sessionMinutes <= 240))