iac_forge/lib.rs
1//! Platform-independent `IaC` code generation core library.
2//!
3//! Defines the IR types ([`IacType`], [`IacAttribute`], [`IacResource`]),
4//! the [`Backend`] trait, the resolver functions, and shared test fixtures
5//! that all `*-forge` backends consume.
6
7/// Backend trait and generated artifact types.
8pub mod backend;
9/// Error types for the iac-forge pipeline.
10pub mod error;
11/// Fleet: named collection of IacResource values with composite hashing.
12pub mod fleet;
13/// Hex encode/decode helpers shared across sexpr consumers.
14pub mod hex;
15/// Platform-independent intermediate representation (IR).
16pub mod ir;
17/// Structure-preserving maps with composable proofs.
18pub mod morphism;
19/// Naming convention helpers (snake_case, camelCase, etc.).
20pub mod naming;
21/// Sexpr ↔ Nix AST bridge (NixValue + round-trip to SExpr).
22pub mod nix;
23/// Nix backend: `Backend` impl rendering IR as Nix attribute sets.
24pub mod nix_backend;
25/// Nix-powered IR transforms (external evaluator: nix-instantiate or sui).
26pub mod nix_transform;
27/// Pipelines of representation with promotions and mutations + Trace.
28pub mod pipeline;
29/// Policy-as-code over sexpr patterns.
30pub mod policy;
31/// Remediation harness: bounded transform application with invariants.
32pub mod remediation;
33/// Content-addressed cache over backend rendering.
34pub mod render_cache;
35/// Resolver: spec + `OpenAPI` → IR.
36pub mod resolve;
37/// Per-language SDK naming conventions for emitted backends.
38pub mod sdk_naming;
39/// Canonical s-expression interchange for IR values.
40pub mod sexpr;
41/// Semantic diff over sexpr trees.
42pub mod sexpr_diff;
43/// `ToSExpr` / `FromSExpr` impls for the IR value types.
44mod sexpr_ir;
45/// TOML spec types for resources, data sources, and providers.
46pub mod spec;
47/// Rust-level sui integration — in-process Nix transforms.
48#[cfg(feature = "sui-eval")]
49pub mod sui_transform;
50/// Shared test fixtures for backend tests.
51pub mod testing;
52/// User-extensible IR transforms with a minimal s-expr script surface.
53pub mod transform;
54/// Type mapping from `OpenAPI` / takumi types to `IacType`.
55pub mod type_map;
56
57// Re-export key types for convenience.
58pub use backend::{ArtifactKind, Backend, GeneratedArtifact, NamingConvention};
59pub use error::IacForgeError;
60pub use ir::{
61 AuthInfo, CrudInfo, HasAttributes, IacAction, IacAttribute, IacDataSource, IacProvider,
62 IacResource, IacType, IdentityInfo,
63};
64pub use naming::{
65 strip_provider_prefix, to_camel_case, to_kebab_case, to_pascal_case, to_snake_case,
66};
67pub use resolve::{resolve_action, resolve_data_source, resolve_provider, resolve_resource};
68pub use spec::{
69 ActionMapping, AuthConfig, ConfigLoader, CrudMapping, DataSourceMeta, DataSourceSpec,
70 FieldOverride, IdentityConfig, ProviderDefaults, ProviderMeta, ProviderSpec, ReadMapping,
71 ResourceMeta, ResourceSpec,
72};
73pub use testing::{
74 TestAttributeBuilder, test_data_source, test_provider, test_resource, test_resource_with_type,
75};
76pub use type_map::{apply_enum_constraint, is_valid_type_override, openapi_to_iac};