Skip to content

refactor: split into Cargo workspace with fine-grained crates + CI/E2E#3

Open
loonghao wants to merge 10 commits intoiOfficeAI:mainfrom
loonghao:refactor/workspace-crates
Open

refactor: split into Cargo workspace with fine-grained crates + CI/E2E#3
loonghao wants to merge 10 commits intoiOfficeAI:mainfrom
loonghao:refactor/workspace-crates

Conversation

@loonghao
Copy link
Copy Markdown

@loonghao loonghao commented Apr 4, 2026

Summary

Refactors the monolithic single-crate layout into a clean Cargo workspace with 8 purpose-built crates, adds workspace-hack for build acceleration, automated release versioning via release-please, and a complete CI/E2E testing pipeline.

Workspace Structure

crates/
├── aion-types/      # Shared data types (LLM, message, tool) — zero deps
├── aion-protocol/   # JSON stream protocol events/commands + ToolApprovalManager
├── aion-config/     # Config, ProviderCompat, Auth, Hooks, BedrockConfig, VertexConfig
├── aion-providers/  # LLM provider impls (Anthropic, OpenAI, Bedrock, Vertex)
├── aion-tools/      # Built-in tools (Read, Write, Edit, Bash, Grep, Glob)
├── aion-mcp/        # MCP client (stdio/SSE/HTTP transports)
├── aion-agent/      # AgentEngine, session, spawner, orchestration, output sinks
└── aion-cli/        # CLI binary — thin wrapper over aion-agent
workspace-hack/      # cargo-hakari for build deduplication

Dependency order (no cycles)

aion-types → aion-protocol → aion-config → aion-providers
                           ↘              ↘
                            aion-tools  →  aion-mcp  →  aion-agent  →  aion-cli

CI / Testing

ci.yml — runs on every PR and push to main

  • 3-platform matrix: Linux / macOS / Windows
  • nextest with --profile ci (parallel, 2× retry, JUnit output)
  • cargo-audit security scan
  • code coverage on push to main (Codecov)
  • JUnit results annotated on PR via dorny/test-reporter

e2e.yml — real API smoke tests

  • Triggered on push to main (path-filtered) and workflow_dispatch
  • Per-provider matrix: anthropic / openai
  • Graceful skip when ANTHROPIC_API_KEY / OPENAI_API_KEY are absent
  • Separate nextest profile e2e: sequential, 120 s timeout, no retries
  • Tests: single-turn completion + tool-use (Read tool)

release-please.yml — automated versioning

  • Two-job design mirroring loonghao/vx to avoid duplicate-PR bug
  • Conventional commits → automatic semver bump + CHANGELOG

release.yml — multi-platform binaries

  • 8 target platforms (Linux gnu/musl x64/arm64, macOS x64/arm64, Windows x64/arm64)
  • Triggered by version tag or workflow_dispatch

Other

  • justfile: unified vx just recipes (test, test-ci, test-e2e, check-all, coverage, …)
  • .config/nextest.toml: default / ci / e2e profiles
  • rust-toolchain.toml: pins stable channel
  • Tests migrated to per-crate tests/ directories

Required Secrets

Secret Purpose
CODECOV_TOKEN Coverage upload (optional)
ANTHROPIC_API_KEY E2E Anthropic tests (optional)
OPENAI_API_KEY E2E OpenAI tests (optional)

loonghao added 10 commits April 4, 2026 07:12
…e dirs

- Delete src/ (original monolith source, fully migrated to crates/)
- Delete tests/ (integration tests, migrated to crates/aion-agent/tests/
  and crates/aion-providers/tests/)
- Delete crates/aion-core/ (transitional catch-all crate, now split into
  aion-types, aion-protocol, aion-config, aion-providers, aion-tools,
  aion-mcp, aion-agent)
- Remove stale crates/aion-types/src/protocol.rs (content lives in aion-protocol)
- Mark shell-dependent hook tests as #[cfg(unix)] to pass on Windows
- Update AGENTS.md with final workspace layout and dependency order
- .config/nextest.toml: three profiles (default/ci/e2e) with per-profile
  timeout, retry, thread and JUnit output settings
- .github/workflows/ci.yml: three-platform matrix (Linux/macOS/Windows),
  nextest --profile ci, JUnit report via dorny/test-reporter
- .github/workflows/e2e.yml: separate E2E workflow triggered on push to main
  and workflow_dispatch; graceful skip when API keys are absent; per-provider
  matrix (anthropic/openai) with nextest --profile e2e
- crates/aion-agent/tests/e2e/: Anthropic and OpenAI smoke tests
  (single-turn completion + tool-use), tempfile-based, graceful skip
- justfile: test/test-ci/test-e2e/coverage recipes unified under nextest
- Fix stale aionrs:: and aion_core:: refs in spawn_test.rs and
  provider_openai_test.rs
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