Vérification des propositions : alertes dans l'aperçu et dans la réponse MCP (5b, ADR 0011)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-23 02:28:07 +01:00
co-authored by Claude Opus 5.5
parent ebe4939f17
commit 5d1b284caf
15 changed files with 400 additions and 5 deletions
+18
View File
@@ -10,6 +10,7 @@ import { diffProfile, diffProgram } from "./program-diff.js";
import { toast } from "./feedback.js";
import { href } from "./router.js";
import { INTENSITY_LABELS, ZONE_LABELS } from "./home-model.js";
import { newFindings } from "../domain/checks.js";
/** @type {Record<string, string>} */
export const SOURCE_LABELS = {
@@ -130,6 +131,22 @@ export function diffView(current, proposed, currentProfile, proposedProfile) {
: h("li", { data: { change: "changed" } }, `${p.label} : `, h("del", null, show(p.field, p.from)), " → ", h("ins", null, show(p.field, p.to))))))));
}
/**
* Les alertes que la proposition ajoute au programme en cours (lot 5b) : à lire
* avant d'adopter, sans rien bloquer.
* @param {import("../domain/program.js").Program|null} current
* @param {import("../domain/program.js").Program} proposed
* @param {import("../domain/profile.js").Profile} profile
*/
export function findingsView(current, proposed, profile) {
const findings = newFindings(current, proposed, profile);
if (!findings.length) return null;
return h("div", { class: "findings", role: "note" },
h("p", { class: "mini-label" }, "À vérifier"),
h("ul", { class: "findings__list" }, findings.map((f) => h("li", { data: { code: f.code } }, f.text))),
h("p", { class: "muted" }, "Tu peux l'adopter quand même, ou demander une version corrigée à ton IA."));
}
/**
* Une proposition en attente, avec ses deux actions.
* @param {{proposal: import("../domain/state.js").Proposal, store: import("./store.js").Store, nav?: import("./router.js").Navigation, headingLevel?: "h1"|"h2"}} o
@@ -155,6 +172,7 @@ export function proposalCard({ proposal, store, nav, headingLevel = "h2" }) {
p.subtitle && h("p", null, p.subtitle),
proposal.reason && h("p", { class: "coach-note" }, proposal.reason),
diffView(state.program, p, state.profile, proposal.profile),
findingsView(state.program, p, proposal.profile ?? state.profile),
h("div", { class: "btn-stack" },
h("button", { type: "button", class: "btn btn--primary btn--block btn--lg", on: { click: adopt } }, "Adopter"),
h("button", { type: "button", class: "btn btn--ghost btn--block", on: { click: reject } }, "Refuser")));