gen-macros — proc-macros that auto-implement the universal
gen_types::ecosystem traits.
Materializes the Pillar 12 directive (generation over composition):
a new package-manager adapter declares its typed shapes and the
macros emit the Spec / QuirkRegistry impls. The author writes
N lines of typed data; the trait surface is mechanical.
See theory/ECOSYSTEM-INTAKE.md § "The macros" for the contract.
#[derive(SpecShape, serde::Serialize, serde::Deserialize)]
#[spec(args = "BuildRustCrateArgs", quirk = "CrateQuirk")]
pub struct BuildSpec {
pub version: u32,
pub crates: indexmap::IndexMap<String, CrateSpec>,
pub root_crate: String,
pub workspace_members: Vec<String>,
}
emits:
impl gen_types::Spec for BuildSpec {
type Args = BuildRustCrateArgs;
type Quirk = CrateQuirk;
fn schema_version(&self) -> u32 { self.version }
fn root_key(&self) -> &str { self.root_crate.as_str() }
fn member_keys(&self) -> Vec<&str> { self.workspace_members.iter().map(String::as_str).collect() }
fn args_for(&self, key: &str) -> Option<&Self::Args> {
self.crates.get(key).map(|c| &c.build_rust_crate_args)
}
fn quirks_for(&self, key: &str) -> &[Self::Quirk] {
self.crates.get(key).map(|c| c.quirks.as_slice()).unwrap_or(&[])
}
}