Engine: each command lists what it needs, and execute checks it first

CommandSpec gains `requires: &[Requirement]` (crates/engine/src/requirement.rs): an open
design, geometry, nodes, a mesh, something to analyse, materials and sections for the
elements, sets, the definition an edit or delete acts on, a step, a result. Session::execute
checks them before running, so a command missing one fails at once with no partial work,
naming each missing piece and the toolbar entry that provides it ("Needs a material —
Properties › Material"). Requirements are real prerequisites (the model's own reference
checks and model.check's rules), never a workflow order. engine.commands / list_commands
list them.

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 18:43:29 -04:00
1 parent 06b98f01c7
commit e0d5adba23
20 files changed
+448 -25

No files matched your search

+2
View File
@@ -275,6 +275,8 @@ fn file_access_stays_inside_the_roots() {
refused(&mut s, "save", json!({"path": outside.join("m.fieldcraft")}));
refused(&mut s, "save", json!({"path": input.join("m.fieldcraft")}));
refused(&mut s, "execute", json!({"command": "file.save_as", "params": {"path": outside.join("m.fieldcraft")}}));
// A model with all a deck needs, so write_deck reaches its path.
ok(&mut s, "execute", json!({"command": "file.sample", "params": {"name": "cantilever"}}));
refused(&mut s, "write_deck", json!({"format": "abaqus", "path": outside.join("m.inp")}));
refused(&mut s, "screenshot", json!({"path": outside.join("x.png")}));
refused(&mut s, "screenshot", json!({"path": input.join("x.png")}));