Skip to content

iter-32: consolidate bunny-api-* into one crate, split CLI as hoppy-cli#37

Merged
ractive merged 1 commit into
mainfrom
iter-32/consolidate-crates
May 10, 2026
Merged

iter-32: consolidate bunny-api-* into one crate, split CLI as hoppy-cli#37
ractive merged 1 commit into
mainfrom
iter-32/consolidate-crates

Conversation

@ractive

@ractive ractive commented May 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Consolidate the 8 bunny-api-* library crates into a single bunny-api crate with services (core, compute, containers, database, recording, shield, storage, stream) as feature-gated modules. Mirrors the hyalo project's shape.
  • Move the root-level hoppy binary into crates/hoppy-cli/ (package hoppy-cli, binary still named hoppy). Root Cargo.toml is now pure [workspace] with default-members = ["crates/hoppy-cli"].
  • bunny-syslog-receiver stays standalone (genuinely independent).
  • Workspace version bumped to 0.3.0 (structural breaking change to the public Rust API; CLI binary is backwards-compatible).
  • release.yml reduced from 9 sequential cargo publish steps to 3 (bunny-api, bunny-syslog-receiver, hoppy-cli).
  • Install line becomes cargo install hoppy-cli; README, CLAUDE.md, decision-log updated accordingly.

Test plan

  • cargo fmt --check clean
  • cargo clippy --workspace --all-targets -- -D warnings clean
  • cargo test --workspace --quiet — 16 test suites, 0 failures
  • cargo audit clean
  • cargo deny check clean
  • ./target/release/hoppy --versionhoppy 0.3.0 (...)
  • cargo run -- --help works from workspace root (proves default-members is wired)
  • Dogfood against a real bunny.net account (BUNNY_API_KEY=$TEST_BUNNY_API_KEY ./target/release/hoppy auth check)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Version bumped to 0.3.0.
    • Updated installation package name to hoppy-cli (binary name hoppy remains unchanged).
    • Reorganized internal project structure for improved maintainability.

Review Change Stack

Mirror the hyalo project's shape: one `bunny-api` library crate with
services (core, compute, containers, database, recording, shield,
storage, stream) as feature-gated modules, and a separate `hoppy-cli`
binary crate. `bunny-syslog-receiver` stays standalone.

- Workspace bumped to 0.3.0
- Root Cargo.toml is now pure [workspace], default-members = hoppy-cli
- CLI binary still named `hoppy`; install line becomes `cargo install hoppy-cli`
- release.yml reduced from 9 publish steps to 3
- CLAUDE.md, README.md, decision-log updated

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 10, 2026 21:31
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR consolidates seven per-service API crates into a single feature-gated bunny-api crate, relocates the CLI binary to crates/hoppy-cli/, updates all import paths workspace-wide, and adjusts release workflows and documentation accordingly.

Changes

Workspace Consolidation and CLI Relocation

Layer / File(s) Summary
Workspace Configuration
Cargo.toml
Root transitions to pure workspace with crates/* glob members. Version bumped to 0.3.0. Workspace dependencies now reference bunny-api, bunny-syslog-receiver, and hoppy-cli instead of seven per-service bunny-api-* crates and root hoppy.
Old Per-Service Crate Removal
crates/bunny-api-compute/*, crates/bunny-api-containers/*, crates/bunny-api-core/*, crates/bunny-api-database/*, crates/bunny-api-recording/*, crates/bunny-api-shield/*, crates/bunny-api-storage/*, crates/bunny-api-stream/*
Cargo.toml and README files deleted from seven per-service API crates. Code consolidated into single bunny-api crate with feature gates.
New bunny-api Crate
crates/bunny-api/Cargo.toml, crates/bunny-api/src/lib.rs
Creates unified API crate with features for each service (recording, core, compute, containers, database, shield, storage, stream). Feature dependencies form a hierarchy with core depending on recording and other services depending on core. Public module surface is feature-gated via #[cfg(feature = "...")].
API Module Import Consolidation
crates/bunny-api/src/*/client.rs, crates/bunny-api/src/*/mod.rs, crates/bunny-api/src/*/types.rs
Updates internal module imports to consolidate recording helpers from crate::recording and types from super::types instead of external crate paths or crate-level paths. Documentation examples updated to reference new bunny_api::service paths.
CLI Package Creation
crates/hoppy-cli/Cargo.toml
Creates CLI package with hoppy binary target, e2e test target, and live-api feature. Dependencies include feature-gated bunny-api and other CLI utilities (clap, tokio, reqwest). Adds Debian and RPM packaging metadata with binary, man, completion, and doc artifacts.
CLI Source Code Updates
crates/hoppy-cli/src/auth.rs, crates/hoppy-cli/src/cli.rs, crates/hoppy-cli/src/commands/*
Updates all CLI source files to import clients (DatabaseClient, CoreClient, etc.) and types from consolidated bunny_api::service paths instead of per-service bunny_api_service namespaces. Trait From implementations retargeted to new type paths.
E2E Test Updates
crates/bunny-api/tests/*/e2e/*.rs, crates/hoppy-cli/tests/e2e/support/mod.rs
Updates test files to use new bunny_api::service import paths and adjusts include_str! fixture paths by adding one directory level (../ segment) to account for deeper test directory structure. Error type downcasts updated (e.g., bunny_api::core::ApiError).
Release Workflow
.github/workflows/release.yml
Version check now reads from hoppy-cli crate. Smoke test runs -p hoppy-cli. Linux packaging commands target hoppy-cli crate. Publishing sequence changed: bunny-api first (with retry loop), then hoppy-cli last. Old explicit mid-tier bunny-api-* publish steps removed.
Documentation & Guidance
.github/copilot-instructions.md, CLAUDE.md, README.md, hoppy-knowledgebase/decision-log.md, hoppy-knowledgebase/iterations/iteration-32-consolidate-crates.md, xtask/*
Documentation and guidance updated to reflect new workspace structure: feature-gated modules under crates/bunny-api/src/service/, CLI in crates/hoppy-cli/ with hoppy binary. README installation updated to cargo install hoppy-cli. Decision log and iteration docs capture consolidation rationale and scope. xtask dependency updated to reference hoppy-cli crate.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes


🐰 With hoppy ears held high,
Seven crates unified as one,
CLI bounds now anew—
Feature gates control the feast,
The workspace hops along! 🌱

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.90% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main architectural change: consolidating eight bunny-api-* crates into a single bunny-api crate and splitting the CLI into hoppy-cli.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch iter-32/consolidate-crates

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR restructures the workspace by merging the previously split bunny-api-* service crates into a single feature-gated bunny-api crate, and relocating the CLI into a dedicated hoppy-cli crate (package name hoppy-cli, binary name hoppy). It also updates docs and test scaffolding to match the new workspace layout and publishing/install story.

Changes:

  • Consolidate API clients into crates/bunny-api/ with feature-gated service modules (core/compute/containers/database/shield/storage/stream) and migrate imports/tests accordingly.
  • Split the CLI into crates/hoppy-cli/, wire workspace default-members, and update xtask + documentation to reference hoppy-cli.
  • Add/refresh CLI e2e tests and snapshots under the new crate layout.

Reviewed changes

Copilot reviewed 65 out of 215 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Cargo.toml Convert root manifest to workspace-only, set default-members, bump workspace version, and switch workspace deps to bunny-api + hoppy-cli.
Cargo.lock Update lockfile for crate consolidation/renames and version bump.
README.md Update install instructions to cargo install hoppy-cli and clarify package vs binary naming.
CLAUDE.md Update contributor guidance to reflect the new crate layout and conventions.
.github/copilot-instructions.md Update repository layout documentation to reflect bunny-api + hoppy-cli structure.
hoppy-knowledgebase/decision-log.md Record the iter-32 decision/rationale for consolidating the API crates and splitting the CLI crate.
xtask/Cargo.toml Point xtask at the new hoppy-cli workspace dependency.
xtask/src/main.rs Update CLI type import path from hoppy to hoppy_cli.
crates/hoppy-cli/Cargo.toml Define the new CLI package, binary target, e2e test target, and dependencies.
crates/hoppy-cli/build.rs Add build provenance embedding (git SHA + spec date) for hoppy --version.
crates/hoppy-cli/src/main.rs New CLI entrypoint and command dispatch for the relocated binary crate.
crates/hoppy-cli/src/lib.rs Export CLI/date modules for reuse (e.g., xtask).
crates/hoppy-cli/src/auth.rs Update client construction imports to consolidated bunny_api::* modules.
crates/hoppy-cli/src/cli.rs Update type references/imports to bunny_api::* consolidated modules.
crates/hoppy-cli/src/output.rs Introduce shared output helpers (json/table/text) and a paginated JSON envelope helper.
crates/hoppy-cli/src/progress.rs Add progress/spinner helpers gated by TTY + --quiet.
crates/hoppy-cli/src/commands/mod.rs Define CLI command module structure under the new crate.
crates/hoppy-cli/src/commands/auth.rs Update core API type imports to bunny_api::core::types.
crates/hoppy-cli/src/commands/pull_zone.rs Update core API imports to bunny_api::core.
crates/hoppy-cli/src/commands/dns.rs Update core API imports to bunny_api::core.
crates/hoppy-cli/src/commands/storage_zone.rs Update core API imports to bunny_api::core::types.
crates/hoppy-cli/src/commands/storage.rs Update storage API imports to bunny_api::storage.
crates/hoppy-cli/src/commands/stream.rs Update stream/core API imports to bunny_api::{core,stream} and adjust paginated list typing.
crates/hoppy-cli/src/commands/shield.rs Update shield API imports to bunny_api::shield::types.
crates/hoppy-cli/src/commands/script.rs Update compute API imports to bunny_api::compute.
crates/hoppy-cli/src/commands/container.rs Update containers API imports to bunny_api::containers.
crates/hoppy-cli/src/commands/database.rs Update database API imports to bunny_api::database.
crates/hoppy-cli/src/commands/statistics.rs Add statistics command handler under the new crate layout.
crates/hoppy-cli/src/commands/video_library.rs Add video-library stats handler under the new crate layout.
crates/hoppy-cli/src/commands/purge.rs Add purge command handler under the new crate layout.
crates/hoppy-cli/tests/e2e/mod.rs Add e2e test module entrypoint for the new CLI crate.
crates/hoppy-cli/tests/e2e/support/mod.rs Adjust fixture loading to account for the new crate-relative manifest dir.
crates/hoppy-cli/tests/e2e/cli_auth.rs Add/port auth e2e coverage under the new CLI crate.
crates/hoppy-cli/tests/e2e/cli_statistics.rs Add/port statistics e2e coverage under the new CLI crate.
crates/hoppy-cli/tests/e2e/cli_video_library.rs Add video-library e2e coverage under the new CLI crate.
crates/hoppy-cli/tests/e2e/snapshots/* Add/update insta snapshots for the e2e test suite under hoppy-cli.
crates/bunny-api/Cargo.toml Define the consolidated API client crate with feature-gated services and test targets.
crates/bunny-api/src/lib.rs Add feature-gated module declarations for the unified bunny-api crate.
crates/bunny-api/src/recording/mod.rs Move recording helper into the unified crate for shared use across services.
crates/bunny-api/src/core/mod.rs Update docs and keep flat re-exports for ergonomic bunny_api::core::* imports.
crates/bunny-api/src/core/client.rs Update recording import path and adjust type paths to super::types.
crates/bunny-api/src/core/types.rs Fix module-relative serde helper imports after consolidation.
crates/bunny-api/src/database/mod.rs Update docs/examples for new import paths.
crates/bunny-api/src/database/client.rs Update recording import path and adjust type paths to super::types.
crates/bunny-api/src/shield/mod.rs Update docs/examples for new import paths.
crates/bunny-api/src/shield/client.rs Update recording import path and adjust type paths to super::types.
crates/bunny-api/src/stream/mod.rs Update docs/examples for new import paths and keep flat re-exports.
crates/bunny-api/src/stream/client.rs Update recording import path and adjust type paths to super::types.
crates/bunny-api/src/storage/mod.rs Introduce unified storage module exports under bunny-api.
crates/bunny-api/src/storage/client.rs Update recording import path and adjust type paths to super::types.
crates/bunny-api/src/storage/types.rs Add storage API types into the unified crate.
crates/bunny-api/src/compute/mod.rs Add compute module exports under bunny-api.
crates/bunny-api/src/compute/client.rs Update recording import path and adjust type paths to super::types.
crates/bunny-api/src/containers/mod.rs Add containers module exports under bunny-api.
crates/bunny-api/src/containers/client.rs Update recording import path and adjust type paths to super::types.
crates/bunny-api/tests/core/e2e/* Update e2e tests to use bunny_api::core and fix fixture include paths.
crates/bunny-api/tests/compute/e2e/* Update e2e tests to use bunny_api::compute and fix fixture include paths.
crates/bunny-api/tests/containers/e2e/* Update e2e tests to use bunny_api::containers and fix fixture include paths.
crates/bunny-api/tests/database/e2e/* Update e2e tests to use bunny_api::database and fix fixture include paths.
crates/bunny-api/tests/shield/e2e/* Update e2e tests to use bunny_api::shield (module wiring added).
crates/bunny-api/tests/storage/e2e/* Update e2e tests to use bunny_api::storage and fix fixture include paths.
crates/bunny-api/tests/stream/e2e/* Update e2e tests to use bunny_api::stream and fix fixture include paths.
crates/bunny-api-core/* Remove per-service crate manifests/READMEs as part of consolidation.
crates/bunny-api-compute/* Remove per-service crate manifests/READMEs as part of consolidation.
crates/bunny-api-containers/* Remove per-service crate manifests/READMEs as part of consolidation.
crates/bunny-api-database/* Remove per-service crate manifests/READMEs as part of consolidation.
crates/bunny-api-shield/* Remove per-service crate manifests/READMEs as part of consolidation.
crates/bunny-api-storage/* Remove per-service crate manifests/READMEs as part of consolidation.
crates/bunny-api-stream/* Remove per-service crate manifests/READMEs as part of consolidation.
crates/bunny-api-recording/* Remove standalone recording crate manifests/READMEs as part of consolidation.

@ractive
ractive merged commit 5de03da into main May 10, 2026
10 of 11 checks passed
@ractive
ractive deleted the iter-32/consolidate-crates branch May 10, 2026 21:38
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.

2 participants