Skip to content

Restructure into a crates/ workspace layout#22

Merged
MattJackson merged 2 commits into
mainfrom
refactor/crates-layout
Jul 15, 2026
Merged

Restructure into a crates/ workspace layout#22
MattJackson merged 2 commits into
mainfrom
refactor/crates-layout

Conversation

@MattJackson

Copy link
Copy Markdown
Owner

What

Move all five Rust crates under a single crates/ directory, so code is cleanly separated from non-code at the repo root:

crates/{busbar, api, auth-tokens, auth-admin-tokens, hooks-ranking}
examples/  scripts/  docs/  bench/  config.yaml  providers.yaml  Dockerfile   ← non-Rust, at root

Previously the binary sat at the root (src/ + the root Cargo.toml package) with the satellite crates scattered as auth/tokens, hooks/ranking, etc. — which made it hard to tell code from non-code at a glance. This is the layout newcomers expect: crates/ = Rust, everything else = not.

Why

Pure navigability. The dependency architecture is unchanged (busbar → api ← plugins; each plugin is an optional, default-on feature). It just reads more clearly.

Notes

  • No behavior change. The binary and every crate are functionally identical; only file paths move. Git tracked the moves as renames, so history is preserved.
  • No version bump, no changelog entry, no tag — this is an internal reorganization, invisible to anyone running the binary. It rides along in the next real release.
  • Root Cargo.toml is now a virtual workspace manifest; [profile.release] stays there (Cargo reads profiles only from the workspace root). Each crate's [package] is in crates/<name>/Cargo.toml.
  • Four CARGO_MANIFEST_DIR test reads gained ../../ to reach the repo-root providers.yaml/config.yaml.
  • scripts/structure-lint.sh now scans crates/; docs/code-layout.md documents the workspace layout.
  • The website's sync-docs.mjs reads the crate version from crates/busbar/Cargo.toml (updated in the marketing repo, with a root fallback so it works across the transition).

Verification (local)

  • cargo test — full suite passes
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo fmt --check — clean
  • cargo build --no-default-features — clean
  • scripts/structure-lint.sh — passes

All Rust crates now live under crates/ (busbar, api, auth-tokens, auth-admin-tokens,
hooks-ranking), so code is cleanly separated from non-code (examples/, scripts/, docs/, bench/,
config). No behavior change — the binary and every crate are functionally identical; only paths move.

- crates/busbar/ holds the engine + binary (was root src/ + the root package). The root Cargo.toml
  is now a virtual workspace manifest; [profile.release] stays there (Cargo reads profiles only from
  the workspace root).
- Plugin path deps rewired (../api); the four CARGO_MANIFEST_DIR test reads gain ../../ to reach the
  repo-root providers.yaml/config.yaml.
- scripts/structure-lint.sh scans crates/; docs/code-layout.md documents the workspace layout.

Verified: cargo test, clippy -D warnings, fmt, structure-lint, and the --no-default-features build
all pass. No version bump / no changelog entry — internal reorganization, invisible to users.
The ../../ path fix pushed the concat! read past rustfmt's 100-col limit; stable rustfmt breaks
.unwrap() onto its own line.
@MattJackson
MattJackson merged commit ab7d1cf into main Jul 15, 2026
8 of 9 checks passed
@MattJackson
MattJackson deleted the refactor/crates-layout branch July 15, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant