Schema: one phrasing of a problem, by key or by label; Required by field kind

Problem::phrase serves both for_agents and for_form. A required name says "enter a name", a
path "enter a path", anything else "required" (no more "Autosave: enter an autosave"). New
kinds for what commands check (positive, range, list, name, path, invalid), and refine() to
look a command's problem up in its form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-14 22:42:19 -04:00
1 parent 70c5c9b26f
commit de8b7b6321
2 files changed
+98 -20

No files matched your search

+1 -1
View File
@@ -791,7 +791,7 @@ mod tests {
assert_eq!(m.first(), Some(&("name".to_string(), "Material: choose a material".to_string())), "{m:?}");
let load = fieldcraft_engine::find_command("model.load.create").and_then(|c| c.form).unwrap();
let m: Vec<String> = messages(load, &json!({"type": "force"}).as_object().cloned().unwrap_or_default()).into_iter().map(|(_, m)| m).collect();
assert_eq!(m, ["Name: enter a name", "Target: choose a set or a reference point", "Force: enter a value"]);
assert_eq!(m, ["Name: enter a name", "Target: choose a set or a reference point", "Force: required"]);
}
/// A problem waits until its field is edited or OK is tried; a refused parameter shows at once.