{"data":{"slug":"github-xberg-io-xberg-ai-rulez-skills-crate-structure-5792a875d3ef","title":"Crate Structure Management","summary":"Organize Rust workspace crates, distribution packages, and tools with precise ignore rules and Docker integration.","url":"https:\/\/skillshunter.net\/skills\/github-xberg-io-xberg-ai-rulez-skills-crate-structure-5792a875d3ef","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-xberg-io-xberg-ai-rulez-skills-crate-structure-5792a875d3ef","markdown_url":"https:\/\/skillshunter.net\/skills\/github-xberg-io-xberg-ai-rulez-skills-crate-structure-5792a875d3ef.md","download_url":"https:\/\/skillshunter.net\/skills\/github-xberg-io-xberg-ai-rulez-skills-crate-structure-5792a875d3ef\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"This skill requires a Rust workspace with a root `Cargo.toml` file. The user must ensure that `.dockerignore` and `.gitignore` files are properly configured with allowlists for new crates. The `mise run verify:docker-crates` command is essential to validate Docker and ignore rules.","instructions":"---\ntype: Playbook\ntitle: Crate Structure\ndescription: \"Place code or crates: workspace members, versions, package paths and ignore rules.\"\nx-ai-rulez:\n  kind: skill\n  id: crate-structure\n  metadata:\n    name: crate-structure\n---\n\n# Crate Structure\n\nVersion source of truth: root `Cargo.toml` `[workspace.package] version`.\n\n## Workspace members (`crates\/`)\n\n- `xberg` \u2014 core library: extraction engine, MIME detection, plugin system, OCR, chunking, embeddings, API\/MCP server\n- `xberg-cli` \u2014 CLI binary. Defines no `cli` feature of its own; its `core-cli` feature is what forwards to the core `xberg\/cli`\n- `xberg-ffi` \u2014 C FFI layer; opaque handles, cbindgen headers. Consumed by Go (cgo), C# (P\/Invoke), Zig (C ABI), Swift (swift-bridge shim, which injects the dependency itself) and Java (Panama FFM)\n- `xberg-jni` \u2014 JNI bindings backing `packages\/kotlin-android`. The Java package does **not** go through this: `alef.toml [crates.java]` sets `ffi_style = \"panama\"`, i.e. Panama FFM over `xberg-ffi`\n- `xberg-node` \u2014 NAPI-RS Node.js\/TypeScript bindings\n- `xberg-py` \u2014 PyO3 Python bindings\n- `xberg-php` \u2014 ext-php-rs PHP bindings\n- `xberg-wasm` \u2014 wasm-bindgen WASM bindings; `wasm-target` feature set\n- `xberg-native-pdf` \u2014 pure-Rust PDF engine, vendored into this workspace. Path dependency with **no** `package =` alias, so the extern crate name is `xberg_native_pdf`. Exports `LOG_TARGET_ROOT = module_path!()`; derive log-target filters from that constant, never a string literal\n- `xberg-pdfium-render` \u2014 pdfium FFI backend behind the `pdf-pdfium` feature. Aliased: `pdfium-render = { package = \"xberg-pdfium-render\", \u2026 }`, so call sites still write `pdfium_render::`\n- `xberg-paddle-ocr` \u2014 PaddleOCR; ORT and tract engines. On WASM only the PaddleOCR config types are available (they compile in every build), but `paddle-ocr` **is** in `windows-target`\n- `xberg-tesseract` \u2014 Tesseract OCR bindings\n- `xberg-candle-ocr` \u2014 candle VLM OCR backends (TrOCR, PaddleOCR-VL, GLM-OCR, DeepSeek-OCR)\n- `xberg-gliner` \u2014 GLiNER NER inference\n- `xberg-libheif` \u2014 libheif bindings for HEIC\/HEIF\n- `xberg-libwpd` \u2014 libwpd bindings for WordPerfect (`.wpd`)\n\nTwo members live outside `crates\/`: `packages\/dart\/rust` and `packages\/swift\/rust`.\n\n`exclude`d \u2014 **not** members, and invisible to `cargo check --workspace`:\n`e2e\/rust`, `packages\/elixir\/native\/xberg_nif`, `packages\/ruby\/ext\/xberg_rb`.\n\n`default-members = [\"crates\/xberg\", \"crates\/xberg-cli\"]`.\n\n## Distribution packages (`packages\/`)\n\n`python` (PyPI\/maturin), `ruby` (RubyGems\/Magnus), `php` (Composer), `go` (cgo over xberg-ffi),\n`java` (Maven, Panama FFM over xberg-ffi), `csharp` (NuGet, P\/Invoke), `elixir` (Hex\/Rustler),\n`dart` (pub.dev, flutter_rust_bridge), `kotlin-android` (AAR; JNI over xberg-jni),\n`swift` (SwiftPM, swift-bridge), `zig` (C ABI over xberg-ffi).\n\n## Tools (`tools\/`)\n\n`benchmark-harness` (the only workspace member here), `generate_test_fixtures`, `ocr-measure`,\n`perf`.\n\nThere is no `tools\/e2e-generator` \u2014 e2e generation is `alef e2e generate`, configured in\n`alef.toml` `[crates.e2e]`. See the `alef-generated-bindings` skill.\n\n## Adding a workspace member\n\nAdding to `[workspace] members` and to the Dockerfiles is not enough. Two ignore files use\n\"ignore everything, then allowlist\", so a new crate is invisible to Docker and its `vendor\/`\nis never committed:\n\n1. `.dockerignore` \u2014 `*` at the top, then a per-crate allowlist; add `!crates\/<name>\/`.\n   Missing it fails every image build with\n   `failed to compute cache key: \"\/crates\/<name>\": not found`.\n2. `.gitignore` \u2014 bare `vendor\/` with per-crate un-ignores; add `!crates\/<name>\/src\/vendor\/`\n   if the crate vendors source. Missing it means `git add -A` commits nothing under `vendor\/`\n   and a fresh clone will not build.\n3. Every `docker\/Dockerfile.*` must either `COPY crates\/<name>\/` or `sed`-exclude the member\n   from the workspace list.\n4. Run `mise run verify:docker-crates`. It checks (1) and (3) in both directions \u2014 it also catches\n   a `COPY` line naming a crate that no longer exists. It does **not** look at `.gitignore`;\n   verify that by hand.\n\nDeleting a crate is the same problem in reverse: a stale allowlist entry is what hides a\nreal omission.\n","use_cases":["Organizing a multi-crate Rust project with Docker integration","Maintaining ignore rules for Docker and Git"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/xberg-io\/xberg\/blob\/ffbf7971796a126fc52f6bb8fb40418772071f61\/.ai-rulez\/skills\/crate-structure\/SKILL.md","source_commit":"ffbf7971796a126fc52f6bb8fb40418772071f61","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T13:24:16.000000Z","updated_at":"2026-11-16T05:16:54.000000Z","seo_title":"Crate Structure Management for Rust Workspaces","seo_description":"Manage Rust workspace crates, distribution packages, and Docker ignore rules for efficient development.","seo_keywords":["Rust workspace management","Docker ignore rules","Cargo.toml configuration","multi-crate project setup","Rust distribution packages"]}}