pub struct AlefConfig {Show 45 fields
pub version: Option<String>,
pub crate_config: CrateConfig,
pub languages: Vec<Language>,
pub exclude: ExcludeConfig,
pub include: IncludeConfig,
pub output: OutputConfig,
pub python: Option<PythonConfig>,
pub node: Option<NodeConfig>,
pub ruby: Option<RubyConfig>,
pub php: Option<PhpConfig>,
pub elixir: Option<ElixirConfig>,
pub wasm: Option<WasmConfig>,
pub ffi: Option<FfiConfig>,
pub gleam: Option<GleamConfig>,
pub go: Option<GoConfig>,
pub java: Option<JavaConfig>,
pub dart: Option<DartConfig>,
pub kotlin: Option<KotlinConfig>,
pub swift: Option<SwiftConfig>,
pub csharp: Option<CSharpConfig>,
pub r: Option<RConfig>,
pub zig: Option<ZigConfig>,
pub scaffold: Option<ScaffoldConfig>,
pub readme: Option<ReadmeConfig>,
pub lint: Option<HashMap<String, LintConfig>>,
pub update: Option<HashMap<String, UpdateConfig>>,
pub test: Option<HashMap<String, TestConfig>>,
pub setup: Option<HashMap<String, SetupConfig>>,
pub clean: Option<HashMap<String, CleanConfig>>,
pub build_commands: Option<HashMap<String, BuildCommandConfig>>,
pub publish: Option<PublishConfig>,
pub custom_files: Option<HashMap<String, Vec<PathBuf>>>,
pub adapters: Vec<AdapterConfig>,
pub custom_modules: CustomModulesConfig,
pub custom_registrations: CustomRegistrationsConfig,
pub sync: Option<SyncConfig>,
pub opaque_types: HashMap<String, String>,
pub generate: GenerateConfig,
pub generate_overrides: HashMap<String, GenerateConfig>,
pub format: FormatConfig,
pub format_overrides: HashMap<String, FormatConfig>,
pub dto: DtoConfig,
pub e2e: Option<E2eConfig>,
pub trait_bridges: Vec<TraitBridgeConfig>,
pub tools: ToolsConfig,
}Expand description
Root configuration from alef.toml.
Fields§
§version: Option<String>Pinned alef CLI version (e.g. “0.7.7”). Used by install-alef to install the exact version this project expects.
crate_config: CrateConfig§languages: Vec<Language>§exclude: ExcludeConfig§include: IncludeConfig§output: OutputConfig§python: Option<PythonConfig>§node: Option<NodeConfig>§ruby: Option<RubyConfig>§php: Option<PhpConfig>§elixir: Option<ElixirConfig>§wasm: Option<WasmConfig>§ffi: Option<FfiConfig>§gleam: Option<GleamConfig>§go: Option<GoConfig>§java: Option<JavaConfig>§dart: Option<DartConfig>§kotlin: Option<KotlinConfig>§swift: Option<SwiftConfig>§csharp: Option<CSharpConfig>§r: Option<RConfig>§zig: Option<ZigConfig>§scaffold: Option<ScaffoldConfig>§readme: Option<ReadmeConfig>§lint: Option<HashMap<String, LintConfig>>§update: Option<HashMap<String, UpdateConfig>>§test: Option<HashMap<String, TestConfig>>§setup: Option<HashMap<String, SetupConfig>>§clean: Option<HashMap<String, CleanConfig>>§build_commands: Option<HashMap<String, BuildCommandConfig>>§publish: Option<PublishConfig>Publish pipeline configuration (vendoring, packaging, cross-compilation).
custom_files: Option<HashMap<String, Vec<PathBuf>>>§adapters: Vec<AdapterConfig>§custom_modules: CustomModulesConfig§custom_registrations: CustomRegistrationsConfig§sync: Option<SyncConfig>§opaque_types: HashMap<String, String>Declare opaque types from external crates that alef can’t extract. Map of type name → Rust path (e.g., “Tree” = “tree_sitter_language_pack::Tree”). These get opaque wrapper structs in all backends.
generate: GenerateConfigControls which generation passes alef runs (all default to true).
generate_overrides: HashMap<String, GenerateConfig>Per-language overrides for generate flags (key = language name, e.g., “python”).
format: FormatConfigPost-generation formatting configuration (default: enabled for all languages).
format_overrides: HashMap<String, FormatConfig>Per-language formatting overrides (key = language name, e.g., “elixir”).
dto: DtoConfigPer-language DTO/type generation style (dataclass vs TypedDict, zod vs interface, etc.).
e2e: Option<E2eConfig>E2E test generation configuration.
trait_bridges: Vec<TraitBridgeConfig>Trait bridge configurations — generate FFI bridge code that allows foreign language objects to implement Rust traits.
tools: ToolsConfigGlobal tooling preferences — package managers and dev tools used by the default per-language pipeline commands. Sensible defaults apply when omitted.
Implementations§
Source§impl AlefConfig
impl AlefConfig
Sourcepub fn resolve_field_name(
&self,
lang: Language,
type_name: &str,
field_name: &str,
) -> Option<String>
pub fn resolve_field_name( &self, lang: Language, type_name: &str, field_name: &str, ) -> Option<String>
Resolve the binding field name for a given language, type, and field.
Resolution order (highest to lowest priority):
- Per-language
rename_fieldsmap for the key"TypeName.field_name". - Automatic keyword escaping: if the field name is a reserved keyword in the target
language, append
_(e.g.class→class_). - Original field name unchanged.
Returns Some(escaped_name) when the field needs renaming, None when the original
name can be used as-is. Call sites that always need a String should use
resolve_field_name(...).unwrap_or_else(|| field_name.to_string()).
Sourcepub fn features_for_language(&self, lang: Language) -> &[String]
pub fn features_for_language(&self, lang: Language) -> &[String]
Get the features to use for a specific language’s binding crate.
Checks for a per-language override first, then falls back to [crate] features.
Sourcepub fn extra_deps_for_language(&self, lang: Language) -> HashMap<String, Value>
pub fn extra_deps_for_language(&self, lang: Language) -> HashMap<String, Value>
Get the merged extra dependencies for a specific language’s binding crate.
Merges crate-level extra_dependencies with per-language overrides.
Language-specific entries override crate-level entries with the same key.
Sourcepub fn package_dir(&self, lang: Language) -> String
pub fn package_dir(&self, lang: Language) -> String
Get the package output directory for a language.
Uses scaffold_output from per-language config if set, otherwise defaults.
Defaults: packages/python, packages/node, packages/ruby, packages/php, packages/elixir
Sourcepub fn validate(&self) -> Result<(), AlefError>
pub fn validate(&self) -> Result<(), AlefError>
Validate user-supplied pipeline overrides.
Custom [lint|test|build_commands|setup|update|clean].<lang> tables
that override a main command field must declare a precondition
so the step degrades gracefully when the underlying tool is missing
on the user’s system. See validation::validate for details.
Sourcepub fn lint_config_for_language(&self, lang: Language) -> LintConfig
pub fn lint_config_for_language(&self, lang: Language) -> LintConfig
Get the effective lint configuration for a language.
Returns the explicit [lint.<lang>] config if present in alef.toml,
otherwise falls back to sensible defaults for the language.
Sourcepub fn update_config_for_language(&self, lang: Language) -> UpdateConfig
pub fn update_config_for_language(&self, lang: Language) -> UpdateConfig
Get the effective update configuration for a language.
Returns the explicit [update.<lang>] config if present in alef.toml,
otherwise falls back to sensible defaults for the language.
Sourcepub fn test_config_for_language(&self, lang: Language) -> TestConfig
pub fn test_config_for_language(&self, lang: Language) -> TestConfig
Get the effective test configuration for a language.
Returns the explicit [test.<lang>] config if present in alef.toml,
otherwise falls back to sensible defaults for the language.
Sourcepub fn setup_config_for_language(&self, lang: Language) -> SetupConfig
pub fn setup_config_for_language(&self, lang: Language) -> SetupConfig
Get the effective setup configuration for a language.
Returns the explicit [setup.<lang>] config if present in alef.toml,
otherwise falls back to sensible defaults for the language.
Sourcepub fn clean_config_for_language(&self, lang: Language) -> CleanConfig
pub fn clean_config_for_language(&self, lang: Language) -> CleanConfig
Get the effective clean configuration for a language.
Returns the explicit [clean.<lang>] config if present in alef.toml,
otherwise falls back to sensible defaults for the language.
Sourcepub fn build_command_config_for_language(
&self,
lang: Language,
) -> BuildCommandConfig
pub fn build_command_config_for_language( &self, lang: Language, ) -> BuildCommandConfig
Get the effective build command configuration for a language.
Returns the explicit [build_commands.<lang>] config if present in alef.toml,
otherwise falls back to sensible defaults for the language.
Sourcepub fn core_import(&self) -> String
pub fn core_import(&self) -> String
Get the core crate import path (e.g., “liter_llm”). Used by codegen to call into the core crate.
Sourcepub fn error_type(&self) -> String
pub fn error_type(&self) -> String
Get the crate error type name (e.g., “KreuzbergError”). Defaults to “Error”.
Sourcepub fn error_constructor(&self) -> String
pub fn error_constructor(&self) -> String
Get the error constructor pattern. {msg} is replaced with the message expression.
Defaults to "{core_import}::{error_type}::from({msg})".
Sourcepub fn run_wrapper_for_language(&self, lang: Language) -> Option<&str>
pub fn run_wrapper_for_language(&self, lang: Language) -> Option<&str>
Get the run_wrapper for a language, if set. Returns the wrapper string that prefixes default tool invocations.
Sourcepub fn extra_lint_paths_for_language(&self, lang: Language) -> &[String]
pub fn extra_lint_paths_for_language(&self, lang: Language) -> &[String]
Get the extra_lint_paths for a language. Returns a slice of paths to append to default lint commands.
Sourcepub fn project_file_for_language(&self, lang: Language) -> Option<&str>
pub fn project_file_for_language(&self, lang: Language) -> Option<&str>
Get the project_file for a language (Java or C# only). Returns the project file path that defaults use instead of output directory.
Sourcepub fn ffi_prefix(&self) -> String
pub fn ffi_prefix(&self) -> String
Get the FFI prefix (e.g., “kreuzberg”). Used by FFI, Go, Java, C# backends.
Sourcepub fn ffi_lib_name(&self) -> String
pub fn ffi_lib_name(&self) -> String
Get the FFI native library name (for Go cgo, Java Panama, C# P/Invoke).
Resolution order:
[ffi] lib_nameexplicit override- Directory name of
output.ffipath with hyphens replaced by underscores (e.g.crates/html-to-markdown-ffi/src/→html_to_markdown_ffi) {ffi_prefix}_ffifallback
Sourcepub fn ffi_header_name(&self) -> String
pub fn ffi_header_name(&self) -> String
Get the FFI header name.
Sourcepub fn dart_style(&self) -> DartStyle
pub fn dart_style(&self) -> DartStyle
Get the Dart bridging style (frb or ffi).
Sourcepub fn python_module_name(&self) -> String
pub fn python_module_name(&self) -> String
Get the Python module name.
Sourcepub fn python_pip_name(&self) -> String
pub fn python_pip_name(&self) -> String
Get the PyPI package name used as [project] name in pyproject.toml.
Returns [python] pip_name if set, otherwise falls back to the crate name.
Sourcepub fn php_autoload_namespace(&self) -> String
pub fn php_autoload_namespace(&self) -> String
Get the PHP Composer autoload namespace derived from the extension name.
Converts the extension name (e.g. html_to_markdown_rs) into a
PSR-4 namespace string (e.g. Html\\To\\Markdown\\Rs).
Sourcepub fn node_package_name(&self) -> String
pub fn node_package_name(&self) -> String
Get the Node package name.
Sourcepub fn ruby_gem_name(&self) -> String
pub fn ruby_gem_name(&self) -> String
Get the Ruby gem name.
Sourcepub fn php_extension_name(&self) -> String
pub fn php_extension_name(&self) -> String
Get the PHP extension name.
Sourcepub fn elixir_app_name(&self) -> String
pub fn elixir_app_name(&self) -> String
Get the Elixir app name.
Sourcepub fn try_go_module(&self) -> Result<String, String>
pub fn try_go_module(&self) -> Result<String, String>
Get the Go module path, returning an error when neither [go].module
nor a derivable repository URL is configured.
Resolution order:
[go].module- Derived from
[scaffold] repository/[e2e.registry] github_repoby stripping thehttps://scheme (sohttps://github.com/foo/barbecomesgithub.com/foo/bar).
Sourcepub fn go_module(&self) -> String
pub fn go_module(&self) -> String
Get the Go module path with a vendor-neutral placeholder fallback.
Sourcepub fn try_github_repo(&self) -> Result<String, String>
pub fn try_github_repo(&self) -> Result<String, String>
Get the GitHub repository URL, returning an error when no source has it set.
Resolution order:
[e2e.registry] github_repo[scaffold] repository
Callers that can render meaningful output without a repository URL should
use Self::github_repo instead, which falls back to a vendor-neutral
placeholder (https://example.invalid/{crate.name}).
Sourcepub fn github_repo(&self) -> String
pub fn github_repo(&self) -> String
Get the GitHub repository URL with a vendor-neutral placeholder fallback.
Resolution order:
[e2e.registry] github_repo[scaffold] repository- Placeholder:
https://example.invalid/{crate.name}— surfaces missing config in code review without smuggling another organization’s URL.
Sourcepub fn try_java_package(&self) -> Result<String, String>
pub fn try_java_package(&self) -> Result<String, String>
Get the Java package name, returning an error when neither [java].package
nor a derivable repository URL is configured.
Resolution order:
[java].package- Reverse-DNS derived from
[scaffold] repository/[e2e.registry] github_repo(e.g.https://github.com/foo-org/bar→com.github.foo_org).
Sourcepub fn java_package(&self) -> String
pub fn java_package(&self) -> String
Get the Java package name with a vendor-neutral placeholder fallback.
Resolution order: see Self::try_java_package. When all sources are
missing, falls back to unconfigured.alef so the generated code fails
to compile loudly rather than silently inheriting another organization’s
namespace.
Sourcepub fn java_group_id(&self) -> String
pub fn java_group_id(&self) -> String
Get the Java Maven groupId.
Uses the full Java package as the groupId, matching Maven convention where groupId equals the package declaration.
Sourcepub fn try_kotlin_package(&self) -> Result<String, String>
pub fn try_kotlin_package(&self) -> Result<String, String>
Get the Kotlin package name, returning an error when neither
[kotlin].package nor a derivable repository URL is configured.
Resolution order:
[kotlin].package- Reverse-DNS derived from
[scaffold] repository/[e2e.registry] github_repo.
Sourcepub fn kotlin_package(&self) -> String
pub fn kotlin_package(&self) -> String
Get the Kotlin package name with a vendor-neutral placeholder fallback.
Sourcepub fn kotlin_target(&self) -> KotlinTarget
pub fn kotlin_target(&self) -> KotlinTarget
Get the Kotlin target platform.
Returns KotlinTarget::Jvm (the default) when the [kotlin] section is absent or
target is not set.
Sourcepub fn dart_pubspec_name(&self) -> String
pub fn dart_pubspec_name(&self) -> String
Get the Dart pubspec package name.
Returns [dart] pubspec_name if set, otherwise derives a snake_case
name from the crate name by replacing hyphens with underscores.
Sourcepub fn dart_frb_version(&self) -> String
pub fn dart_frb_version(&self) -> String
Get the resolved flutter_rust_bridge version, falling back to
template_versions::cargo::FLUTTER_RUST_BRIDGE.
Sourcepub fn swift_module(&self) -> String
pub fn swift_module(&self) -> String
Get the Swift module name.
Returns [swift] module_name if configured, otherwise derives a PascalCase
name from the crate name (e.g. "my-lib" → "MyLib").
Sourcepub fn swift_bridge_version(&self) -> String
pub fn swift_bridge_version(&self) -> String
Get the resolved swift-bridge version, falling back to
template_versions::cargo::SWIFT_BRIDGE.
Sourcepub fn swift_min_macos(&self) -> String
pub fn swift_min_macos(&self) -> String
Get the resolved minimum macOS deployment target.
Sourcepub fn swift_min_ios(&self) -> String
pub fn swift_min_ios(&self) -> String
Get the resolved minimum iOS deployment target.
Sourcepub fn gleam_app_name(&self) -> String
pub fn gleam_app_name(&self) -> String
Get the Gleam app name.
Sourcepub fn gleam_nif_module(&self) -> String
pub fn gleam_nif_module(&self) -> String
Get the Gleam NIF module name (Erlang atom for @external(erlang, “rustler::init! in the Rustler backend.
Sourcepub fn zig_module_name(&self) -> String
pub fn zig_module_name(&self) -> String
Get the Zig module name.
Sourcepub fn csharp_namespace(&self) -> String
pub fn csharp_namespace(&self) -> String
Get the C# namespace.
Sourcepub fn csharp_package_id(&self) -> String
pub fn csharp_package_id(&self) -> String
Get the NuGet <PackageId> to publish under. Defaults to csharp_namespace()
when [csharp].package_id is unset. Use a separate id when the
unprefixed name is owned by a third party on nuget.org and the
project must publish under a vendor-prefixed coordinate (e.g.
KreuzbergDev.HtmlToMarkdown) while keeping the in-code namespace
short.
Sourcepub fn core_crate_dir(&self) -> String
pub fn core_crate_dir(&self) -> String
Get the directory name of the core crate (derived from sources or falling back to name).
For example, if sources contains "crates/html-to-markdown/src/lib.rs", this returns
"html-to-markdown". Used by the scaffold to generate correct path = "../../crates/…"
references in binding-crate Cargo.toml files.
Sourcepub fn wasm_type_prefix(&self) -> String
pub fn wasm_type_prefix(&self) -> String
Get the WASM type name prefix (e.g. “Wasm” produces WasmConversionOptions).
Defaults to "Wasm".
Sourcepub fn node_type_prefix(&self) -> String
pub fn node_type_prefix(&self) -> String
Get the Node/NAPI type name prefix (e.g. “Js” produces JsConversionOptions).
Defaults to "Js".
Sourcepub fn r_package_name(&self) -> String
pub fn r_package_name(&self) -> String
Get the R package name.
Sourcepub fn resolved_version(&self) -> Option<String>
pub fn resolved_version(&self) -> Option<String>
Attempt to read the resolved version string from the configured version_from file.
Returns None if the file cannot be read or the version cannot be found.
Sourcepub fn serde_rename_all_for_language(&self, lang: Language) -> String
pub fn serde_rename_all_for_language(&self, lang: Language) -> String
Get the effective serde rename_all strategy for a given language.
Resolution order:
- Per-language config override (
[python] serde_rename_all = "...") - Language default:
- camelCase: node, wasm, java, csharp
- snake_case: python, ruby, php, go, ffi, elixir, r, kotlin, gleam, zig
Sourcepub fn rewrite_path(&self, rust_path: &str) -> String
pub fn rewrite_path(&self, rust_path: &str) -> String
Rewrite a rust_path using path_mappings. Matches the longest prefix first.
Sourcepub fn effective_path_mappings(&self) -> HashMap<String, String>
pub fn effective_path_mappings(&self) -> HashMap<String, String>
Return the effective path mappings for this config.
When auto_path_mappings is true, automatically derives a mapping from each source
crate to the configured core_import facade. For each source file whose path contains
crates/{crate-name}/src/, a mapping {crate_name} → {core_import} is added
(hyphens in the crate name are converted to underscores). Source crates that already
equal core_import are skipped.
Explicit entries in path_mappings always override auto-derived ones.
Trait Implementations§
Source§impl Clone for AlefConfig
impl Clone for AlefConfig
Source§fn clone(&self) -> AlefConfig
fn clone(&self) -> AlefConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more