Utoo is a unified frontend toolchain with a Rust core and TypeScript bindings. It has two main products:
- Package Manager (PM) — the
utoo/utCLI, implemented incrates/pm - Bundler (Pack) —
@utoo/pack, built on Turbopack, with Rust core incrates/pack-coreand Node.js bindings via NAPI-RS incrates/pack-napi
The next.js/ directory is a git submodule (utooland/next.js) providing Turbopack crates. Many Rust crates depend on paths within it. Initialize with git submodule update --init --recursive.
| Crate | Purpose |
|---|---|
pm |
Package manager CLI (utoo/ut). Modules: cmd/ (CLI commands), service/ (business logic), util/ (registry, cache, linker), helper/ (workspace, deps) |
pack-core |
Bundler core built on Turbopack |
pack-api |
API layer for bundling operations (ProjectContainer, entrypoints) |
pack-napi |
NAPI-RS bindings exposing bundler to Node.js |
pack-schema |
Configuration schema definitions |
pack-tests |
Snapshot-based bundler integration tests |
pack-cli |
Rust CLI wrapper for the bundler |
ruborist |
Dependency resolution helper for PM |
utoo-wasm |
WebAssembly bindings for @utoo/web |
| Package | Purpose |
|---|---|
@utoo/pack |
Main bundler library wrapping pack-napi, includes Webpack compatibility layer |
@utoo/pack-cli |
CLI for bundler (up/utoopack commands) |
@utoo/pack-shared |
Shared types and utilities |
@utoo/web |
Browser-compatible toolchain via WASM |
- Pack: User config →
@utoo/pack(TS) →pack-napi(NAPI bridge) →pack-api→pack-core(Turbopack) → bundled output - PM: CLI args →
crates/pm/src/cmd/(command parsing) →crates/pm/src/service/(business logic) →crates/pm/src/util/(registry, cache, linker) - Web:
@utoo/webis an independent TS project that usesutoo-wasmfor browser-compatible toolchain. Demo workflow:ut build:local --workspace @utoo/webut start --workspace utooweb-demo
- Install deps:
npm install(or bootstrap via globalutoo/utor locally builttarget/releasebinary) - Build all packages:
npm run build(via Turbo) - Build specific package:
npx turbo run build --filter=@utoo/pack - Watch mode:
npm run dev - Build Rust crates:
cargo build - Faster local release build (no LTO):
cargo build --profile release-local
- PM unit tests:
cargo test -p utoo-pm - Bundler snapshot tests:
cargo test -p pack-tests - Update snapshots:
UPDATE=1 cargo test -p pack-tests - PM end-to-end tests:
./e2e/utoo-pm.sh - All JS tests:
npm run test(via Turbo)
Bundler snapshot tests live in crates/pack-tests/tests/snapshot/. Each test case has an input/ dir and an output/ dir with expected results. Set UPDATE=1 to regenerate snapshots.
- Format JS/JSON:
npm run biome(Biome, double quotes, 2-space indent) - Format Rust:
cargo fmt - Format TOML:
tombi format(ornpx tombi format) - Spellcheck:
typos
The pre-push hook runs: cargo fmt --check, tombi format --check, npx biome ci, typos.
- Commits: Conventional Commits with scopes —
feat(pm):,feat(pack):,fix(wasm):, etc. - Rust edition: 2024, nightly toolchain (version pinned in
rust-toolchain.toml) - JS formatting: Biome with double quotes, 2-space indent
- Monorepo: npm workspaces (JS) + Cargo workspace (Rust), orchestrated by Turborepo
- Platform binaries: Pack builds per-platform NAPI binaries (darwin-arm64, linux-gnu, linux-musl, win32-msvc)
- Follow Conventional Commits:
feat(scope):,fix(scope):,docs:,refactor(scope):, etc. - Group related changes; avoid bundling unrelated refactors.
- Keep commit messages concise and action-oriented.
Agent definitions live in agents/ and are symlinked to .claude/agents/ for Claude Code discovery.
| Agent | Path | Purpose |
|---|---|---|
| rust-code-guard | agents/rust-code-guard.md |
Rust idiom & style review agent. Enforces idiomatic patterns and project conventions based on real PR review cases. |
| utoopack-performance | agents/utoopack-performance-agent.md |
Turbopack performance diagnostics via Chrome Trace analysis across a 5-tier priority matrix. |
After modifying Rust code, always run these checks before considering the task done:
cargo fmt
cargo clippy --all-targets -- -D warnings --no-depsFix any issues found. Do not leave clippy warnings or formatting drift for the user to clean up.
- When adding a new
AGENTS.mdanywhere in the repo, also add aCLAUDE.mdsymlink pointing to it (example:ln -s AGENTS.md CLAUDE.md). - When answering questions, respond with high-confidence answers only: verify in code; do not guess.
- Never edit
node_modules. - Lint/format churn:
- If staged+unstaged diffs are formatting-only, auto-resolve without asking.
- If commit/push already requested, auto-stage and include formatting-only follow-ups in the same commit, no extra confirmation.
- Only ask when changes are semantic (logic/data/behavior).