engine: a typed parameter schema per command (CommandSpec::form)

Field, Kind, Dim and Collection describe a command's JSON parameters: numbers with
unit dimensions, choices, vectors, references to model items, groups, one-of
variants and rows. prefill, switch_variant and problems serve forms; json_schema
gives the same as JSON Schema. No command is described yet (form: None).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-14 13:20:04 -04:00
1 parent 6a604c24b6
commit 5c5516aae0
16 files changed
+816 -10

No files matched your search

+4
View File
@@ -20,6 +20,7 @@ pub use cmd::analytic_surfaces;
pub mod history;
pub mod results;
pub mod sample;
pub mod schema;
pub mod view;
use std::collections::BTreeMap;
@@ -108,6 +109,9 @@ pub struct CommandSpec {
pub label: &'static str,
/// The JSON parameters, documented for scripts, `fieldcraft-cli commands` and agents.
pub params: &'static str,
/// The parameters field by field, for forms and JSON Schema; `None` when not described yet
/// (the form is then the JSON text alone).
pub form: Option<&'static [schema::Field]>,
pub kind: CommandKind,
pub run: fn(&mut Session, &Value) -> Result<Value>,
}