pub mod answers;
pub mod batch;
pub mod capabilities;
pub mod changes;
pub mod context;
pub mod diagnostics;
pub mod inspect;
pub mod mcp;
mod ops;
mod ops_analysis;
mod ops_ff;
mod ops_picture;
pub mod png;
pub mod render;
mod run;
pub mod session;
pub mod skill;
pub mod verbs;
pub use answers::Answer;
pub use batch::run_verbs;
pub use capabilities::{Capabilities, capability_report};
pub use changes::{ChangeBurst, changes_for};
pub use diagnostics::{Diagnostic, DiagnosticReport, Severity, diagnose};
pub use inspect::inspect_structure;
pub use mcp::{McpServer, serve_stdio};
pub use render::{RenderOptions, render_png, render_svg};
pub use session::{Session, SessionOptions};
pub use skill::{SkillDocument, default_directory};
pub use verbs::{ParameterKind, VerbInfo, catalogue, lookup};
#[derive(Debug, Clone, PartialEq, thiserror::Error)]
pub enum Error {
#[error("unknown verb {0}")]
UnknownVerb(String),
#[error("invalid argument {name}: {reason}")]
Argument {
name: String,
reason: String,
},
#[error("unknown document {0}")]
UnknownDocument(String),
#[error("no active document; call `load` first")]
NoDocument,
#[error("io: {0}")]
Io(String),
#[error("core: {0}")]
Core(#[from] xtalforge_core::Error),
#[error("analysis: {0}")]
Analysis(String),
#[error("force field: {0}")]
ForceField(#[from] xtalforge_ff::Error),
#[error("json: {0}")]
Json(String),
}
impl Error {
#[must_use]
pub fn code(&self) -> &'static str {
match self {
Self::UnknownVerb(_) => "unknown_verb",
Self::Argument { .. } => "invalid_argument",
Self::UnknownDocument(_) => "unknown_document",
Self::NoDocument => "no_document",
Self::Io(_) => "io",
Self::Core(error) => error.code(),
Self::Analysis(_) => "analysis",
Self::ForceField(error) => error.code(),
Self::Json(_) => "json",
}
}
}