Skip to content

feat(rook): scaffold package layout with domain types, CLI, and module stubs#601

Merged
yacosta738 merged 4 commits into
developfrom
feat/rook-580-package-layout
Apr 19, 2026
Merged

feat(rook): scaffold package layout with domain types, CLI, and module stubs#601
yacosta738 merged 4 commits into
developfrom
feat/rook-580-package-layout

Conversation

@yacosta738
Copy link
Copy Markdown
Contributor

Summary

Implements issue #580 — establishes the complete clients/rook/ package layout for Corvus Rook v1, the local-first provider gateway.

What's included

  • clients/rook/Cargo.toml — standalone Rust workspace with path deps to shared agent-runtime crates
  • clients/rook/src/main.rs — CLI with clap: subcommands serve, tui, doctor, config export
  • clients/rook/src/lib.rs — module declarations
  • clients/rook/src/domain/mod.rs — core domain types: ProviderVendor, ProviderAccount, ProviderPool, ModelRoute, RoutingPolicy, SelectionStrategy, RookError
  • Module stubs: registry, routing, gateway, dashboard, tui, config
  • clients/rook/README.md — product README

Validation

cargo check --manifest-path clients/rook/Cargo.toml — clean (0 errors, 0 warnings)

Part of

Milestone: Corvus Rook v1 (#5)
Parent: Foundation (#573)

Close #580

@yacosta738 yacosta738 added this to the Corvus Rook v1 milestone Apr 19, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 19, 2026

Deploying corvus with  Cloudflare Pages  Cloudflare Pages

Latest commit: 40315f3
Status: ✅  Deploy successful!
Preview URL: https://ac366e9d.corvus-42x.pages.dev
Branch Preview URL: https://feat-rook-580-package-layout.corvus-42x.pages.dev

View logs

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 19, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new standalone Rust crate clients/rook with Cargo manifest, CLI binary, library root, README, a populated domain model, and documentation-only module skeletons for config, registry, routing, gateway, dashboard, and TUI; runtime behavior and most implementations remain unimplemented stubs.

Changes

Cohort / File(s) Summary
Package Infrastructure
clients/rook/Cargo.toml, clients/rook/src/lib.rs, clients/rook/src/main.rs
New crate manifest declaring binary (src/main.rs) and library (src/lib.rs) targets with dependencies (clap, tokio, axum, serde, tracing, rusqlite, path dep ../agent-runtime/crates/corvus-traits). Adds CLI with Serve, Tui, Doctor, and Config::Export subcommands; CLI commands are stubbed and exit with "not yet implemented". Exposes public module exports.
Domain Models
clients/rook/src/domain/mod.rs
Implements domain layer: RookError enum (including Io and Other from conversions), UUID-backed newtypes (AccountId, PoolId, RouteId), ProviderVendor, SelectionStrategy, and structs ProviderAccount, ProviderPool, ModelRoute, RoutingPolicy with serde support and unit tests validating serde and error conversions.
Module Documentation (Stubs)
clients/rook/src/config/mod.rs, clients/rook/src/dashboard/mod.rs, clients/rook/src/gateway/mod.rs, clients/rook/src/registry/mod.rs, clients/rook/src/routing/mod.rs, clients/rook/src/tui/mod.rs
Added six module skeletons containing documentation, TODO/FIXME notes and intended responsibilities (config loading/validation, embedded admin UI, OpenAI-compatible gateway surface, SQLite-backed registry, routing engine, operator TUI). No executable implementations or public API items added.
Project Documentation
clients/rook/README.md
New README describing Corvus Rook, feature list (multi-provider routing, local-first, health-aware, operator TUI), quick-start commands (compile/run/diagnostics/config export) marked as stubs, module map, dependency notes and licensing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning Title exceeds 72-character limit (76 chars) despite following Conventional Commits format with 'feat(rook):' prefix and clearly summarizing the main changeset. Shorten title to ≤72 characters; consider: 'feat(rook): scaffold package layout with domain types and CLI'
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed PR description covers purpose, deliverables, and validation; however, it omits the full description template structure, particularly 'Tested Information', 'Documentation Impact', 'Breaking Changes', and 'Checklist' sections.
Linked Issues check ✅ Passed Code changes directly implement #580 objectives: modular layout (lib.rs exports, module stubs), domain types (ProviderVendor, Account, Pool, Route, Policy, SelectionStrategy, RookError), CLI scaffold, and validation via cargo check.
Out of Scope Changes check ✅ Passed All changes are in-scope: clients/rook/ package structure, domain types, CLI scaffold, and documentation directly fulfill #580 objectives without introducing unrelated refactors or external component modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rook-580-package-layout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 19, 2026

✅ Contributor Report

User: @yacosta738
Status: Passed (12/13 metrics passed)

Metric Description Value Threshold Status
PR Merge Rate PRs merged vs closed 91% >= 30%
Repo Quality Repos with ≥100 stars 0 >= 0
Positive Reactions Positive reactions received 11 >= 1
Negative Reactions Negative reactions received 0 <= 5
Account Age GitHub account age 3095 days >= 30 days
Activity Consistency Regular activity over time 108% >= 0%
Issue Engagement Issues with community engagement 0 >= 0
Code Reviews Code reviews given to others 584 >= 0
Merger Diversity Unique maintainers who merged PRs 2 >= 0
Repo History Merge Rate Merge rate in this repo 92% >= 0%
Repo History Min PRs Previous PRs in this repo 255 >= 0
Profile Completeness Profile richness (bio, followers) 90 >= 0
Suspicious Patterns Spam-like activity detection 1 N/A

Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-04-19 to 2026-04-19

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/rook/README.md`:
- Around line 40-53: Update the fenced code block in clients/rook/README.md (the
directory tree block that currently begins with ``` ) to include a language
specifier (use `text`) so the block starts with ```text; this resolves the MD040
lint by making the directory tree a `text`-fenced block.
- Around line 31-35: Update the Quick Start in clients/rook/README.md to mark
the cargo subcommands "doctor" and "config export" as stubs/not-implemented
instead of presenting them as functional; specifically change the entries for
the commands shown (the "doctor" and "config export" lines) to indicate "(stub -
not yet implemented)" or add a brief parenthetical note that they only print
"not yet implemented", so users won't expect working diagnostics or config
export.
- Around line 1-71: Add an explicit note about English/Spanish parity in the
README: update the top-level Corvus Rook README (e.g., the "# Corvus Rook"
header and/or "Status" section) to either state that an official Spanish
translation exists or, if none yet, include a clear "ES translation pending"
line indicating translations are planned and where to contribute; reference the
README sections like "Quick Start" or "Status" so the note is visible to users
and maintainers.

In `@clients/rook/src/domain/mod.rs`:
- Around line 1-159: Add unit tests covering serde and error conversions: write
a serde round-trip test for ProviderVendor that serializes known variants and an
Other(String) slug via serde_json and asserts deserializing yields the original
(ensure the Other case round-trips); add a test asserting SelectionStrategy
serializes to snake_case strings and deserializes back (Priority -> "priority",
RoundRobin -> "round_robin", etc.) to lock config stability; and add a smoke
test for RookError From conversions that constructs a std::io::Error and an
anyhow::Error, converts each into RookError via From (or ? operator) and asserts
they match the Io and Other variants respectively. Place these tests in a tests
module (or #[cfg(test)] mod tests) near domain/mod.rs so they run with cargo
test and reference ProviderVendor, SelectionStrategy, and RookError by name.
- Around line 43-53: The newtype ID structs (AccountId, PoolId, RouteId)
currently expose their inner Uuid as pub and are non-Copy; change each to hide
the inner field (remove pub), add Copy to the derives (e.g., #[derive(Debug,
Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]), and annotate each
with #[serde(transparent)] so the serialized wire format remains a bare UUID
string; this preserves encapsulation for future invariants and restores Uuid's
copy semantics to avoid unnecessary clones while keeping serde behavior
identical.
- Around line 57-71: ProviderVendor currently uses externally-tagged
serialization so a raw string like "mistral" fails to map to
ProviderVendor::Other(String); change the enum to be untagged by adding
#[serde(untagged)] on the ProviderVendor enum so plain string values deserialize
into Other(String) while known unit variants still map to their named cases, and
add round-trip serde tests that serialize+deserialize known vendor slugs (e.g.,
"anthropic") and unknown slugs (e.g., "mistral") to prevent regressions.

In `@clients/rook/src/main.rs`:
- Around line 47-62: The CLI match arms for unimplemented variants
(Commands::Serve, Commands::Tui, Commands::Doctor, and the Commands::Config {
action: ConfigCommands::Export } arm) currently only print a stub and exit with
success; change them to return a non-zero exit status—either by calling
std::process::exit(1) after the println! or by refactoring main to return a
Result and returning an Err for those branches—so the program signals failure
for unimplemented commands.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b42664dd-33be-4e69-a64d-73f32a958243

📥 Commits

Reviewing files that changed from the base of the PR and between 8758858 and c723f32.

⛔ Files ignored due to path filters (1)
  • clients/rook/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (11)
  • clients/rook/Cargo.toml
  • clients/rook/README.md
  • clients/rook/src/config/mod.rs
  • clients/rook/src/dashboard/mod.rs
  • clients/rook/src/domain/mod.rs
  • clients/rook/src/gateway/mod.rs
  • clients/rook/src/lib.rs
  • clients/rook/src/main.rs
  • clients/rook/src/registry/mod.rs
  • clients/rook/src/routing/mod.rs
  • clients/rook/src/tui/mod.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

⚙️ CodeRabbit configuration file

**/*.rs: Focus on Rust idioms, memory safety, and ownership/borrowing correctness.
Flag unnecessary clones, unchecked panics in production paths, and weak error context.
Prioritize unsafe blocks, FFI boundaries, concurrency races, and secret handling.

Files:

  • clients/rook/src/tui/mod.rs
  • clients/rook/src/routing/mod.rs
  • clients/rook/src/registry/mod.rs
  • clients/rook/src/config/mod.rs
  • clients/rook/src/lib.rs
  • clients/rook/src/gateway/mod.rs
  • clients/rook/src/dashboard/mod.rs
  • clients/rook/src/main.rs
  • clients/rook/src/domain/mod.rs
**/*

⚙️ CodeRabbit configuration file

**/*: Security first, performance second.
Validate input boundaries, auth/authz implications, and secret management.
Look for behavioral regressions, missing tests, and contract breaks across modules.

Files:

  • clients/rook/src/tui/mod.rs
  • clients/rook/src/routing/mod.rs
  • clients/rook/src/registry/mod.rs
  • clients/rook/src/config/mod.rs
  • clients/rook/src/lib.rs
  • clients/rook/src/gateway/mod.rs
  • clients/rook/src/dashboard/mod.rs
  • clients/rook/README.md
  • clients/rook/src/main.rs
  • clients/rook/Cargo.toml
  • clients/rook/src/domain/mod.rs
**/*.{md,mdx}

⚙️ CodeRabbit configuration file

**/*.{md,mdx}: Verify technical accuracy and that docs stay aligned with code changes.
For user-facing docs, check EN/ES parity or explicitly note pending translation gaps.

Files:

  • clients/rook/README.md
🧠 Learnings (10)
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/providers/**/*.rs : Implement `Provider` trait in `src/providers/` and register in `src/providers/mod.rs` factory when adding a new provider

Applied to files:

  • clients/rook/src/routing/mod.rs
  • clients/rook/src/registry/mod.rs
  • clients/rook/src/config/mod.rs
  • clients/rook/src/lib.rs
  • clients/rook/src/gateway/mod.rs
  • clients/rook/src/dashboard/mod.rs
  • clients/rook/src/domain/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/*.rs : Run `cargo fmt --all -- --check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test` for code validation, or document which checks were skipped and why

Applied to files:

  • clients/rook/src/config/mod.rs
  • clients/rook/src/lib.rs
  • clients/rook/src/gateway/mod.rs
  • clients/rook/src/dashboard/mod.rs
  • clients/rook/README.md
  • clients/rook/src/main.rs
  • clients/rook/Cargo.toml
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/{security,gateway,tools}/**/*.rs : Treat `src/security/`, `src/gateway/`, `src/tools/` as high-risk surfaces and never broaden filesystem/network execution scope without explicit policy checks

Applied to files:

  • clients/rook/src/lib.rs
  • clients/rook/src/gateway/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/{security,gateway,tools,config}/**/*.rs : Do not silently weaken security policy or access constraints; keep default behavior secure-by-default with deny-by-default where applicable

Applied to files:

  • clients/rook/src/gateway/mod.rs
  • clients/rook/README.md
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/channels/**/*.rs : Implement `Channel` trait in `src/channels/` with consistent `send`, `listen`, and `health_check` semantics and cover auth/allowlist/health behavior with tests

Applied to files:

  • clients/rook/src/gateway/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Preserve CLI contract unless change is intentional and documented; prefer explicit errors over silent fallback for unsupported critical paths

Applied to files:

  • clients/rook/src/gateway/mod.rs
  • clients/rook/README.md
  • clients/rook/src/main.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Do not add heavy dependencies for minor convenience; justify new crate additions

Applied to files:

  • clients/rook/README.md
  • clients/rook/src/main.rs
  • clients/rook/Cargo.toml
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Keep startup path lean and avoid heavy initialization in command parsing flow

Applied to files:

  • clients/rook/src/main.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/tools/**/*.rs : Implement `Tool` trait in `src/tools/` with strict parameter schema, validate and sanitize all inputs, and return structured `ToolResult` without panics in runtime path

Applied to files:

  • clients/rook/src/main.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Preserve release-size profile assumptions in `Cargo.toml` and avoid adding heavy dependencies unless clearly justified

Applied to files:

  • clients/rook/Cargo.toml
🪛 markdownlint-cli2 (0.22.0)
clients/rook/README.md

[warning] 40-40: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (2)
clients/rook/src/lib.rs (1)

1-11: LGTM.

Crate root is a clean module manifest; no premature re‑exports, no glob imports. Appropriate for a scaffolding PR.

clients/rook/Cargo.toml (1)

1-8: ⚠️ Potential issue | 🟡 Minor

Address cross-workspace path dependency.

Rook is indeed standalone (no parent workspace exists). However, it depends on corvus-traits via a path dependency into the clients/agent-runtime workspace (../agent-runtime/crates/corvus-traits). This cross-workspace path dependency works but indicates a structural issue.

Better approaches:

  • Merge both into a single root workspace (preferred for monorepos with shared internal crates).
  • Publish corvus-traits to a registry and use normal versioned dependencies.

Simply adding [workspace] to rook won't resolve the fundamental cross-workspace coupling.

⛔ Skipped due to learnings
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Do not add heavy dependencies for minor convenience; justify new crate additions
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Preserve release-size profile assumptions in `Cargo.toml` and avoid adding heavy dependencies unless clearly justified

Comment thread clients/rook/README.md Outdated
Comment thread clients/rook/README.md Outdated
Comment thread clients/rook/README.md
Comment on lines +40 to +53
```
src/
├── main.rs CLI entrypoint (clap subcommands)
├── lib.rs Library root / module declarations
├── domain/ Core data model: ProviderAccount, ProviderPool,
│ ModelRoute, RoutingPolicy, RookError
├── registry/ SQLite persistence for all domain objects
├── routing/ Request-time account selection (Priority, RoundRobin,
│ Weighted, Failover) and health-aware fallback
├── gateway/ OpenAI-compatible axum HTTP handlers
├── dashboard/ Embedded admin UI + management REST API
├── tui/ Operator terminal interface (ratatui, future)
└── config/ Rook-specific TOML/env config loading
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a language to the fenced block.

This trips MD040; use text for the directory tree.

Lint fix
-```
+```text
 src/
 ├── main.rs          CLI entrypoint (clap subcommands)
🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 40-40: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@clients/rook/README.md` around lines 40 - 53, Update the fenced code block in
clients/rook/README.md (the directory tree block that currently begins with ```
) to include a language specifier (use `text`) so the block starts with ```text;
this resolves the MD040 lint by making the directory tree a `text`-fenced block.

Comment thread clients/rook/src/domain/mod.rs
Comment thread clients/rook/src/domain/mod.rs Outdated
Comment thread clients/rook/src/domain/mod.rs
Comment thread clients/rook/src/main.rs
Comment on lines +47 to +62
match cli.command {
Commands::Serve => {
println!("rook serve: not yet implemented");
}
Commands::Tui => {
println!("rook tui: not yet implemented");
}
Commands::Doctor => {
println!("rook doctor: not yet implemented");
}
Commands::Config {
action: ConfigCommands::Export,
} => {
println!("rook config export: not yet implemented");
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Return a non-zero error for unimplemented commands.

These branches currently exit successfully after printing a stub message, which can make scripts or health checks believe serve, doctor, or config export completed correctly.

Behavior fix
-    match cli.command {
+    match cli.command {
         Commands::Serve => {
-            println!("rook serve: not yet implemented");
+            anyhow::bail!("rook serve: not yet implemented");
         }
         Commands::Tui => {
-            println!("rook tui: not yet implemented");
+            anyhow::bail!("rook tui: not yet implemented");
         }
         Commands::Doctor => {
-            println!("rook doctor: not yet implemented");
+            anyhow::bail!("rook doctor: not yet implemented");
         }
         Commands::Config {
             action: ConfigCommands::Export,
         } => {
-            println!("rook config export: not yet implemented");
+            anyhow::bail!("rook config export: not yet implemented");
         }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
match cli.command {
Commands::Serve => {
println!("rook serve: not yet implemented");
}
Commands::Tui => {
println!("rook tui: not yet implemented");
}
Commands::Doctor => {
println!("rook doctor: not yet implemented");
}
Commands::Config {
action: ConfigCommands::Export,
} => {
println!("rook config export: not yet implemented");
}
}
match cli.command {
Commands::Serve => {
anyhow::bail!("rook serve: not yet implemented");
}
Commands::Tui => {
anyhow::bail!("rook tui: not yet implemented");
}
Commands::Doctor => {
anyhow::bail!("rook doctor: not yet implemented");
}
Commands::Config {
action: ConfigCommands::Export,
} => {
anyhow::bail!("rook config export: not yet implemented");
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@clients/rook/src/main.rs` around lines 47 - 62, The CLI match arms for
unimplemented variants (Commands::Serve, Commands::Tui, Commands::Doctor, and
the Commands::Config { action: ConfigCommands::Export } arm) currently only
print a stub and exit with success; change them to return a non-zero exit
status—either by calling std::process::exit(1) after the println! or by
refactoring main to return a Result and returning an Err for those branches—so
the program signals failure for unimplemented commands.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 19, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 3 file(s) based on 6 unresolved review comments.

Files modified:

  • clients/rook/README.md
  • clients/rook/src/domain/mod.rs
  • clients/rook/src/main.rs

Commit: 2fd86674ffd1f6f5a4ca0d1b230d499526bd7295

The changes have been pushed to the feat/rook-580-package-layout branch.

Time taken: 6m 52s

Fixed 3 file(s) based on 6 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
clients/rook/src/main.rs (1)

47-66: 🧹 Nitpick | 🔵 Trivial

Prefer anyhow::bail! over std::process::exit(1).

std::process::exit short-circuits destructors and the tokio runtime teardown — harmless today with empty handlers, but a footgun once serve/tui open sockets, DB handles, or spawn tasks. Since main already returns Result<()>, returning Err is both idiomatic and CI-friendly (non-zero exit preserved, and the error is printed via anyhow).

♻️ Proposed change
     match cli.command {
         Commands::Serve => {
-            println!("rook serve: not yet implemented");
-            std::process::exit(1);
+            anyhow::bail!("rook serve: not yet implemented");
         }
         Commands::Tui => {
-            println!("rook tui: not yet implemented");
-            std::process::exit(1);
+            anyhow::bail!("rook tui: not yet implemented");
         }
         Commands::Doctor => {
-            println!("rook doctor: not yet implemented");
-            std::process::exit(1);
+            anyhow::bail!("rook doctor: not yet implemented");
         }
         Commands::Config {
             action: ConfigCommands::Export,
         } => {
-            println!("rook config export: not yet implemented");
-            std::process::exit(1);
+            anyhow::bail!("rook config export: not yet implemented");
         }
     }

As per coding guidelines ("Focus on Rust idioms … unchecked panics in production paths").

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@clients/rook/src/main.rs` around lines 47 - 66, Replace the
std::process::exit(1) calls in the match handling of cli.command (specifically
inside the Commands::Serve, Commands::Tui, Commands::Doctor, and
Commands::Config { action: ConfigCommands::Export } arms) with an anyhow error
return (e.g., use anyhow::bail! or return Err(anyhow!(...))) so main's
Result<()> propagates the non-zero exit instead of short-circuiting destructors;
remove the exit calls and invoke bail! with the same "rook ...: not yet
implemented" message for each arm.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/rook/src/domain/mod.rs`:
- Around line 92-115: The ProviderAccount struct currently uses capabilities:
Vec<String>; replace this with the typed corvus_traits::ProviderCapabilities to
avoid divergent vocabularies: import ProviderCapabilities from corvus_traits,
change the capabilities field on ProviderAccount from Vec<String> to
ProviderCapabilities, and update any code that constructs,
serializes/deserializes, or matches on ProviderAccount::capabilities (e.g.,
ModelRoute::capability_constraints) to use the struct's fields instead of string
matching; keep tags as Vec<String> unless you want to migrate them too, and
ensure serde derives/traits still compile after the type substitution.
- Around line 64-74: The enum ProviderVendor has #[serde(untagged)] incorrectly
applied to the whole enum causing unit variants to serialize as null and strings
to be parsed into Other; remove #[serde(untagged)] from the enum-level
attributes and instead apply serde attributes on the Other variant so that
Other(String) is untagged (e.g., make Other carry #[serde(untagged)] or use the
appropriate per-variant serde annotation) while keeping rename_all =
"snake_case" for the unit variants; update the enum declaration around
ProviderVendor and the Other variant accordingly and run the full test suite
(cargo test --manifest-path clients/rook/Cargo.toml) to confirm the assertions
for serialization/deserialization pass.

---

Duplicate comments:
In `@clients/rook/src/main.rs`:
- Around line 47-66: Replace the std::process::exit(1) calls in the match
handling of cli.command (specifically inside the Commands::Serve, Commands::Tui,
Commands::Doctor, and Commands::Config { action: ConfigCommands::Export } arms)
with an anyhow error return (e.g., use anyhow::bail! or return
Err(anyhow!(...))) so main's Result<()> propagates the non-zero exit instead of
short-circuiting destructors; remove the exit calls and invoke bail! with the
same "rook ...: not yet implemented" message for each arm.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ceddabf1-2e96-4832-8172-58c1ce86fd6f

📥 Commits

Reviewing files that changed from the base of the PR and between c723f32 and 2fd8667.

📒 Files selected for processing (3)
  • clients/rook/README.md
  • clients/rook/src/domain/mod.rs
  • clients/rook/src/main.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Cloudflare Pages
  • GitHub Check: submit-gradle
🧰 Additional context used
📓 Path-based instructions (3)
**/*.rs

⚙️ CodeRabbit configuration file

**/*.rs: Focus on Rust idioms, memory safety, and ownership/borrowing correctness.
Flag unnecessary clones, unchecked panics in production paths, and weak error context.
Prioritize unsafe blocks, FFI boundaries, concurrency races, and secret handling.

Files:

  • clients/rook/src/main.rs
  • clients/rook/src/domain/mod.rs
**/*

⚙️ CodeRabbit configuration file

**/*: Security first, performance second.
Validate input boundaries, auth/authz implications, and secret management.
Look for behavioral regressions, missing tests, and contract breaks across modules.

Files:

  • clients/rook/src/main.rs
  • clients/rook/README.md
  • clients/rook/src/domain/mod.rs
**/*.{md,mdx}

⚙️ CodeRabbit configuration file

**/*.{md,mdx}: Verify technical accuracy and that docs stay aligned with code changes.
For user-facing docs, check EN/ES parity or explicitly note pending translation gaps.

Files:

  • clients/rook/README.md
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/*.rs : Run `cargo fmt --all -- --check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test` for code validation, or document which checks were skipped and why
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Do not add heavy dependencies for minor convenience; justify new crate additions
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/providers/**/*.rs : Implement `Provider` trait in `src/providers/` and register in `src/providers/mod.rs` factory when adding a new provider
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Preserve release-size profile assumptions in `Cargo.toml` and avoid adding heavy dependencies unless clearly justified
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Preserve CLI contract unless change is intentional and documented; prefer explicit errors over silent fallback for unsupported critical paths

Applied to files:

  • clients/rook/src/main.rs
  • clients/rook/README.md
  • clients/rook/src/domain/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Keep startup path lean and avoid heavy initialization in command parsing flow

Applied to files:

  • clients/rook/src/main.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/*.rs : Run `cargo fmt --all -- --check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test` for code validation, or document which checks were skipped and why

Applied to files:

  • clients/rook/src/main.rs
  • clients/rook/README.md
  • clients/rook/src/domain/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/tools/**/*.rs : Implement `Tool` trait in `src/tools/` with strict parameter schema, validate and sanitize all inputs, and return structured `ToolResult` without panics in runtime path

Applied to files:

  • clients/rook/src/main.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/providers/**/*.rs : Implement `Provider` trait in `src/providers/` and register in `src/providers/mod.rs` factory when adding a new provider

Applied to files:

  • clients/rook/src/domain/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/channels/**/*.rs : Implement `Channel` trait in `src/channels/` with consistent `send`, `listen`, and `health_check` semantics and cover auth/allowlist/health behavior with tests

Applied to files:

  • clients/rook/src/domain/mod.rs
🪛 markdownlint-cli2 (0.22.0)
clients/rook/README.md

[warning] 40-40: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 75-75: Files should end with a single newline character

(MD047, single-trailing-newline)

🔇 Additional comments (1)
clients/rook/README.md (1)

40-53: Add text language hint to the fenced block.

MD040 still trips on line 40 — the directory-tree block is unfenced. Adding text silences markdownlint and keeps rendering consistent.

Lint fix
-```
+```text
 src/
 ├── main.rs          CLI entrypoint (clap subcommands)

Comment on lines +92 to +115
/// A configured account for a specific AI provider.
///
/// FIXME: persist via registry
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProviderAccount {
/// Unique stable identifier.
pub id: AccountId,
/// Which vendor this account belongs to.
pub vendor: ProviderVendor,
/// Human-readable label shown in the dashboard and TUI.
pub display_name: String,
/// Override the vendor's default API base URL (e.g., for local proxies).
pub api_base_override: Option<String>,
/// Whether this account is eligible for routing.
pub enabled: bool,
/// Relative weight used by [`SelectionStrategy::Weighted`].
pub weight: u32,
/// Lower value = higher priority for [`SelectionStrategy::Priority`].
pub priority: u32,
/// Free-form labels for grouping and filtering.
pub tags: Vec<String>,
/// Model capabilities advertised by this account.
pub capabilities: Vec<String>,
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider reusing corvus_traits::ProviderCapabilities instead of Vec<String>.

capabilities: Vec<String> and tags: Vec<String> are free-form bags that will drift from the structured ProviderCapabilities already defined in clients/agent-runtime/crates/corvus-traits/src/providers.rs (fields like native_tool_calling, image_input, image_transport_forms). Since Rook depends on corvus-traits per the README, using the typed struct here prevents divergent "capability" vocabularies between the router and the runtime, and lets routing logic in ModelRoute::capability_constraints match on real fields instead of matching strings. Non-blocking for the skeleton, but worth aligning before the registry lands and freezes the schema.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@clients/rook/src/domain/mod.rs` around lines 92 - 115, The ProviderAccount
struct currently uses capabilities: Vec<String>; replace this with the typed
corvus_traits::ProviderCapabilities to avoid divergent vocabularies: import
ProviderCapabilities from corvus_traits, change the capabilities field on
ProviderAccount from Vec<String> to ProviderCapabilities, and update any code
that constructs, serializes/deserializes, or matches on
ProviderAccount::capabilities (e.g., ModelRoute::capability_constraints) to use
the struct's fields instead of string matching; keep tags as Vec<String> unless
you want to migrate them too, and ensure serde derives/traits still compile
after the type substitution.

- Add #[serde(untagged)] to the Other(String) variant so it round-trips
  as a bare string instead of {"other":"…"}
- Add 5 unit tests covering unit-variant snake_case, Other bare-string
  serialization, deserialization, and round-trip

Skipped: capabilities Vec<String> → ProviderCapabilities swap because
corvus_traits::ProviderCapabilities lacks Serialize/Deserialize derives;
that migration belongs in a separate issue against corvus-traits.

Skipped: process::exit(1) removal — no such calls exist in main.rs.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/rook/src/domain/mod.rs`:
- Around line 68-82: ProviderVendor's #[serde(untagged)] Other(String) silently
accepts misspelled/ differently-cased known vendors; replace the auto-derived
behavior by removing #[serde(untagged)] and adding a custom Deserialize impl for
ProviderVendor that: deserializes the input as a string, normalizes it (e.g.
lowercase, map "_" -> ""), checks against the canonical vendor tokens for
OpenAi, Anthropic, Google, OpenRouter, DeepSeek and returns the matching unit
variant when normalized-equal, otherwise returns Other(original_string);
additionally detect near-misses (using a simple similarity check or normalized
equality) and return a deserialization error or a clear warning message for
close-miss cases so typos like "openai" / "OpenAI" / "open-ai" don't silently
become Other; implement this logic in the Deserialize impl for ProviderVendor.
- Around line 43-56: The newtype ID structs AccountId, PoolId, and RouteId
currently wrap a private Uuid with no public constructor or accessor; add public
constructors and accessors (e.g., an associated fn new(uuid: Uuid) -> Self, fn
generate() -> Self to mint a random Uuid, and fn as_uuid(&self) -> Uuid or
into_inner(self) -> Uuid) for each type so callers in registry/routing/gateway
can create and read the inner Uuid; implement From<Uuid> and Into<Uuid> (or
AsRef<Uuid>) and consider implementing Display/Debug wrappers if needed to help
logging—apply the same pattern to AccountId, PoolId, and RouteId (or extract
into a small macro to avoid duplication).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3ee5f0e1-039e-445a-9307-9c6f0fac2753

📥 Commits

Reviewing files that changed from the base of the PR and between 2fd8667 and 4eaeac2.

📒 Files selected for processing (1)
  • clients/rook/src/domain/mod.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

⚙️ CodeRabbit configuration file

**/*.rs: Focus on Rust idioms, memory safety, and ownership/borrowing correctness.
Flag unnecessary clones, unchecked panics in production paths, and weak error context.
Prioritize unsafe blocks, FFI boundaries, concurrency races, and secret handling.

Files:

  • clients/rook/src/domain/mod.rs
**/*

⚙️ CodeRabbit configuration file

**/*: Security first, performance second.
Validate input boundaries, auth/authz implications, and secret management.
Look for behavioral regressions, missing tests, and contract breaks across modules.

Files:

  • clients/rook/src/domain/mod.rs
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/providers/**/*.rs : Implement `Provider` trait in `src/providers/` and register in `src/providers/mod.rs` factory when adding a new provider
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/*.rs : Run `cargo fmt --all -- --check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test` for code validation, or document which checks were skipped and why
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Do not add heavy dependencies for minor convenience; justify new crate additions
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Preserve release-size profile assumptions in `Cargo.toml` and avoid adding heavy dependencies unless clearly justified
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/providers/**/*.rs : Implement `Provider` trait in `src/providers/` and register in `src/providers/mod.rs` factory when adding a new provider

Applied to files:

  • clients/rook/src/domain/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/*.rs : Run `cargo fmt --all -- --check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test` for code validation, or document which checks were skipped and why

Applied to files:

  • clients/rook/src/domain/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/channels/**/*.rs : Implement `Channel` trait in `src/channels/` with consistent `send`, `listen`, and `health_check` semantics and cover auth/allowlist/health behavior with tests

Applied to files:

  • clients/rook/src/domain/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Preserve CLI contract unless change is intentional and documented; prefer explicit errors over silent fallback for unsupported critical paths

Applied to files:

  • clients/rook/src/domain/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/**/*.rs : Avoid unnecessary allocations, clones, and blocking operations to maintain performance and efficiency

Applied to files:

  • clients/rook/src/domain/mod.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Do not add heavy dependencies for minor convenience; justify new crate additions

Applied to files:

  • clients/rook/src/domain/mod.rs

Comment thread clients/rook/src/domain/mod.rs Outdated
Comment thread clients/rook/src/domain/mod.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant