alef-generated-bindings

Guides regeneration and verification of Alef-generated language bindings from Rust sources.

9.2k|581|Updated Jan 31, 2025
One-click install
npx skills add https://github.com/kreuzberg-dev/kreuzberg --skill alef-generated-bindings
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: alef-generated-bindings
Source: https://github.com/kreuzberg-dev/kreuzberg/tree/main/.ai-rulez/skills/alef-generated-bindings
Command: npx skills add https://github.com/kreuzberg-dev/kreuzberg --skill alef-generated-bindings

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Editing generated binding files by hand or regenerating them incorrectly leaves the repository silently stale or breaks the build across a dozen language targets. This Skill encodes the exact Alef regeneration workflow, the alef.toml layout, and the core-side Rust edits that break a regen, so changes to packages/* and binding crates stay consistent.

Core Features & Use Cases

  • Regeneration Workflow: Runs task alef:generate, task alef:verify, and the e2e task chain in the correct order, with atomic commits of Rust source, alef.toml, and generated output.
  • Freshness Verification: Uses alef verify and .alef/ hash caches instead of under-scoped git diffs, covering crates/xberg-py, xberg-node, xberg-ffi, packages/dart/rust, and e2e output.
  • Breakage Prevention: Documents the core-side edits that abort a regen, such as missing #[cfg_attr(alef, alef(skip))] on new extractors, #[non_exhaustive] on binding-facing types, and trait return types lacking Default + Serialize + Deserialize for the FFI bridge.
  • Use Case: You added a method to a trait with a generated FFI bridge. The Skill tells you the return type needs Default + Serialize + Deserialize, and to verify with cargo check -p xberg-ffi rather than the workspace check.

Quick Start

Ask the assistant to regenerate the Alef bindings after modifying a Rust extractor and verify the output is fresh.

Frequently Asked Questions about alef-generated-bindings

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I regenerate Alef-generated language bindings?

Run task alef:generate, which shells out to the globally installed alef binary and formats output via poly. Then run task alef:verify to confirm freshness, followed by task e2e:generate and task e2e:test to verify behavior.

Why does my Alef regeneration abort after adding a new extractor?

A new extractor struct needs #[cfg_attr(alef, alef(skip))] on the struct declaration, not the impl block. Without it the regen aborts globally and nothing regenerates, leaving the tree silently stale.

Can I hand-edit generated files in packages/* or binding crates?

No. Files under packages/* and the binding crates are generated by Alef, and a regen restores them. Fix alef.toml or the Rust source instead, then regenerate and re-verify.

Why does cargo check --workspace not catch FFI bridge errors?

crates/xberg-ffi is built by no ci-rust.yaml leg, only publish-path jobs, so the workspace check cannot fail on it. Verify with the scoped cargo check -p xberg-ffi instead.

What trait return types work with the generated FFI bridge?

The generated bridge marshals every trait method return value through JSON and falls back to Default::default() on failures. Any new trait method return type needs Default + Serialize + Deserialize, including unit-only enums.

Why is git diff over packages/ not enough to check binding freshness?

Generated output also lands in crates/xberg-py, xberg-php, xberg-jni, xberg-node, xberg-wasm, xberg-ffi, packages/dart/rust, packages/swift/rust, and e2e/. Use task alef:verify, which checks Alef's source and output hashes.