Agent Skillsxberg-io/xberg › crate-structure

crate-structure

GitHub

描述 Xberg Rust 工作区结构,包括核心库、多语言绑定及排除项。用于导航代码、确定归属及新增 crate 配置。

.ai-rulez/skills/crate-structure/SKILL.md xberg-io/xberg

Trigger Scenarios

需要理解仓库整体架构 决定代码所属模块 添加新的 workspace crate

Install

npx skills add xberg-io/xberg --skill crate-structure -g -y
More Options

Non-standard path

npx skills add https://github.com/xberg-io/xberg/tree/main/.ai-rulez/skills/crate-structure -g -y

Use without installing

npx skills use xberg-io/xberg@crate-structure

指定 Agent (Claude Code)

npx skills add xberg-io/xberg --skill crate-structure -a claude-code -g -y

安装 repo 全部 skill

npx skills add xberg-io/xberg --all -g -y

预览 repo 内 skill

npx skills add xberg-io/xberg --list

SKILL.md

Frontmatter
{
    "name": "crate-structure",
    "description": "The Xberg workspace layout — the version source of truth (root Cargo.toml [workspace.package] version), the 19 workspace members and 3 excluded crates, the distribution packages under packages\/, the tools\/ directory, and the ignore-file allowlists a new workspace member must be added to. Load when navigating the repo, deciding where code belongs, or wiring a new crate or binding package."
}

Crate Structure

Version source of truth: root Cargo.toml [workspace.package] version.

Workspace members (crates/)

  • xberg — core library: extraction engine, MIME detection, plugin system, OCR, chunking, embeddings, API/MCP server
  • xberg-cli — CLI binary. Defines no cli feature of its own; its core-cli feature is what forwards to the core xberg/cli
  • xberg-ffi — 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)
  • xberg-jni — 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
  • xberg-node — NAPI-RS Node.js/TypeScript bindings
  • xberg-py — PyO3 Python bindings
  • xberg-php — ext-php-rs PHP bindings
  • xberg-wasm — wasm-bindgen WASM bindings; wasm-target feature set
  • xberg-native-pdf — 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
  • xberg-pdfium-render — pdfium FFI backend behind the pdf-pdfium feature. Aliased: pdfium-render = { package = "xberg-pdfium-render", … }, so call sites still write pdfium_render::
  • xberg-paddle-ocr — PaddleOCR; ORT and tract engines. On WASM only paddle-ocr-types is available, but paddle-ocr is in windows-target
  • xberg-tesseract — Tesseract OCR bindings
  • xberg-candle-ocr — candle VLM OCR backends (TrOCR, PaddleOCR-VL, GLM-OCR, DeepSeek-OCR)
  • xberg-gliner — GLiNER NER inference
  • xberg-libheif — libheif bindings for HEIC/HEIF
  • xberg-libwpd — libwpd bindings for WordPerfect (.wpd)

Two members live outside crates/: packages/dart/rust and packages/swift/rust.

excluded — not members, and invisible to cargo check --workspace: e2e/rust, packages/elixir/native/xberg_nif, packages/ruby/ext/xberg_rb.

default-members = ["crates/xberg", "crates/xberg-cli"].

Distribution packages (packages/)

python (PyPI/maturin), ruby (RubyGems/Magnus), php (Composer), go (cgo over xberg-ffi), java (Maven, Panama FFM over xberg-ffi), csharp (NuGet, P/Invoke), elixir (Hex/Rustler), dart (pub.dev, flutter_rust_bridge), kotlin-android (AAR; JNI over xberg-jni), swift (SwiftPM, swift-bridge), zig (C ABI over xberg-ffi).

Tools (tools/)

benchmark-harness (the only workspace member here), generate_test_fixtures, ocr-measure, perf.

There is no tools/e2e-generator — e2e generation is alef e2e generate, configured in alef.toml [crates.e2e]. See the alef-generated-bindings skill.

Adding a workspace member

Adding to [workspace] members and to the Dockerfiles is not enough. Two ignore files use "ignore everything, then allowlist", so a new crate is invisible to Docker and its vendor/ is never committed:

  1. .dockerignore* at the top, then a per-crate allowlist; add !crates/<name>/. Missing it fails every image build with failed to compute cache key: "/crates/<name>": not found.
  2. .gitignore — bare vendor/ with per-crate un-ignores; add !crates/<name>/src/vendor/ if the crate vendors source. Missing it means git add -A commits nothing under vendor/ and a fresh clone will not build.
  3. Every docker/Dockerfile.* must either COPY crates/<name>/ or sed-exclude the member from the workspace list.
  4. Run task verify:docker-crates. It checks (1) and (3) in both directions — it also catches a COPY line naming a crate that no longer exists. It does not look at .gitignore; verify that by hand.

Deleting a crate is the same problem in reverse: a stale allowlist entry is what hides a real omission.

Version History

  • d8e4815 Current 2026-08-28 18:30

    移除无法构建的 tools/snippet-runner 工具及其在 Dockerfile 中的残留引用;修正治理规则中与实际代码不符的描述及过时指标。

  • 531e0f7 2026-08-20 07:47

Same Skill Collection

.ai-rulez/skills/alef-generated-bindings/SKILL.md
.ai-rulez/skills/benchmark-workflow/SKILL.md
.ai-rulez/skills/chunking-embeddings/SKILL.md
.ai-rulez/skills/config-loading-precedence/SKILL.md
.ai-rulez/skills/extraction-pipeline-patterns/SKILL.md
.ai-rulez/skills/feature-flag-policy/SKILL.md
.ai-rulez/skills/mime-detection-routing/SKILL.md
.ai-rulez/skills/ocr-pipeline-and-quality/SKILL.md
.ai-rulez/skills/pdf-backends/SKILL.md
.ai-rulez/skills/plugin-architecture-patterns/SKILL.md
.ai-rulez/skills/polyrepo-boundaries/SKILL.md
.ai-rulez/skills/release-readiness/SKILL.md
.ai-rulez/skills/release-versioning/SKILL.md
.ai-rulez/skills/test-corpus/SKILL.md
.ai-rulez/skills/wasm-constraints/SKILL.md
.ai-rulez/skills/xberg-typescript-toolchain/SKILL.md
plugin/.ai-rulez/skills/batch-extraction/SKILL.md
plugin/.ai-rulez/skills/chunking/SKILL.md
plugin/.ai-rulez/skills/extracting-keywords/SKILL.md
plugin/.ai-rulez/skills/extracting-tables/SKILL.md
plugin/.ai-rulez/skills/extracting-with-ocr/SKILL.md
plugin/.ai-rulez/skills/picking-a-format/SKILL.md
plugin/.ai-rulez/skills/xberg/SKILL.md
plugin/.cursor-plugin/skills/batch-extraction/SKILL.md
plugin/.cursor-plugin/skills/chunking/SKILL.md
plugin/.cursor-plugin/skills/extracting-keywords/SKILL.md
plugin/.cursor-plugin/skills/extracting-tables/SKILL.md
plugin/.cursor-plugin/skills/extracting-with-ocr/SKILL.md
plugin/.cursor-plugin/skills/picking-a-format/SKILL.md
plugin/.cursor-plugin/skills/xberg/SKILL.md
plugin/skills/batch-extraction/SKILL.md
plugin/skills/chunking/SKILL.md
plugin/skills/extracting-keywords/SKILL.md
plugin/skills/extracting-tables/SKILL.md
plugin/skills/extracting-with-ocr/SKILL.md
plugin/skills/picking-a-format/SKILL.md
plugin/skills/xberg/SKILL.md
.ai-rulez/skills/api-server-mcp/SKILL.md
.ai-rulez/skills/format-specific-extraction/SKILL.md

Metadata

Files
0
Version
d8e4815
Hash
e9eac41e
Indexed
2026-08-20 07:47

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-01 06:52
浙ICP备14020137号-1 $bản đồ khách truy cập$