Extract openframe-client into a shared Rust library (openframe-agent-lib)#1265
Conversation
…entry point Move the Rust OpenFrame agent from openframe-oss-tenant into this repo under clients/openframe-client as the library crate `openframe-agent-lib` (lib name `openframe`, so existing `use openframe::...` imports are unchanged). Hoist the clap CLI out of main.rs into a library module exposing `openframe::run()`, so the tenant repos only need a thin binary that calls it. Executables (the openframe-client binary + dev helpers) are opt-in via the `bin` feature and off by default; plain `cargo build` produces the library only. Packaging assets (build/, infrastructure/) move with the crate. Set up a Cargo workspace at clients/. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01RvFQiC4VAdu8ruwst8uJto
Add the shared Rust tooling for the agent client: - rustfmt.toml (standard, edition 2021) - workspace clippy policy in clients/Cargo.toml: clippy::all = warn, correctness/suspicious = deny; crate inherits via [lints] workspace = true - committed git hooks (clients/.githooks): pre-commit runs cargo fmt --check, pre-push runs cargo clippy -D warnings; both scoped to Rust changes and skip when cargo is absent - clients/Makefile: fmt / fmt-check / clippy / lint / build / build-bin / run-bin / test / setup-hooks - CI: port the rust-setup composite action and add rust-client.yml (fmt-check + clippy + build on macOS and Windows, triggered on clients/**) - docs: clients/README.md dev guide, crate README, root README/CONTRIBUTING pointers including the one-time `make -C clients setup-hooks` Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01RvFQiC4VAdu8ruwst8uJto
Pure formatting pass (cargo fmt --all) over the imported agent code. No logic changes. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01RvFQiC4VAdu8ruwst8uJto
Make `cargo clippy --all-targets --features bin -- -D warnings` pass on the
host toolchain (1.96.0):
- Auto-applied machine-fixable lints via `cargo clippy --fix`: unused imports,
needless borrows, derivable impls, identity maps, redundant field names,
needless returns, unnecessary casts, etc.
- Manual straightforward fixes: rename `assetId` -> `asset_id`; build
InitialConfiguration via struct literal (field_reassign_with_default);
vec![] instead of Vec::new()+push; add Default for DirectoryManager;
`if let Some` instead of is_some()+unwrap (unnecessary_unwrap); add
`.truncate(true)` to a write-probe OpenOptions (suspicious_open_options).
- #[allow(clippy::too_many_arguments)] on three wide constructors and
#[allow(clippy::wrong_self_convention)] on ToolMigrator::from_type
(refactors deemed out of scope).
- Platform-conditional false positives: #[allow(unused_imports)] on
cfg(unix) imports used only in linux-gated paths; #[allow(unreachable_code)]
on a fn whose macOS branch returns early; #[allow(dead_code)] on the
Windows-only service-stop constants.
- #[allow(dead_code)] (flagged for review) on genuinely-unused items:
config::{Configuration, LoggingConfig}, permissions::ROOT_UID,
Metric/LogShipper/VelopackUpdater unread fields, and two unused methods.
- #![allow(deprecated)] in encryption_service for aes-gcm's generic-array 0.x
(proper fix: bump aes-gcm).
- Scope the lint gate to `--features bin` (not --all-features): the
tool-version override features' build.rs requires release version env vars
and is not part of the standard gate.
Windows cfg paths validate in CI (cross-compiling C deps from macOS is not
possible locally).
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RvFQiC4VAdu8ruwst8uJto
The flamingo-stack/nats.rs fork's `main` has moved past the commit that provides `ConnectOptions::custom_header`, so a fresh resolve (e.g. from a downstream thin bin crate consuming this library via git) picked up an incompatible HEAD and failed to compile. Pin to rev 3cfbf0f (the commit the lockfile already used) so every consumer builds against the known-good fork. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01RvFQiC4VAdu8ruwst8uJto
|
Important Review skippedToo many files! This PR contains 267 files, which is 117 over the limit of 150. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (267)
You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Restore the Arc import and un-underscore the installed_tool/new_tool params that an earlier macOS-only `clippy --fix` broke; scope windows-only-unused imports/vars with #[cfg]/#[allow] and fix windows-only clippy style lints so both macOS and windows pass clippy -D warnings. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… standard build Makefile - clients/Makefile now only exposes `setup-hooks`. - clients/openframe-client/Makefile is the standard client Makefile (identical to the one in openframe-oss-tenant: fmt/fmt-check/clippy/lint/build/test/ crossinstall/crossbuild), so the crate carries its own build tooling and a future clients/openframe-chat can carry its own alongside it. - CI, git hooks and docs updated to call `make -C clients/openframe-client` (binary is compiled cross-platform in CI via `cargo build --features bin`). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01RvFQiC4VAdu8ruwst8uJto
…nts/ workspace) Each crate under clients/ is now fully self-contained so a future clients/openframe-chat is independent (own Cargo.lock, no workspace member/ exclude bookkeeping, no shared lockfile). - remove clients/Cargo.toml (the workspace) - move Cargo.lock into clients/openframe-client/ - inline the clippy policy as [lints.clippy] in the crate (was [workspace.lints]) - CI: point the rust cache at clients/openframe-client Unchanged and shared at clients/: rustfmt.toml (applies to every crate below via rustfmt's ancestor search), .githooks/, and the setup-hooks Makefile. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01RvFQiC4VAdu8ruwst8uJto
What & why
Extracts the Rust OpenFrame agent (previously living only in
openframe-oss-tenant) into this repo as the shared library crateopenframe-agent-lib(lib nameopenframe), so both tenant products (openframe-oss-tenant,openframe-saas-tenant) consume it as a versioned dependency and ship only a thin binary. Also sets up requiredcargo fmt/clippytooling and an opt-in binary build.Companion PRs (open after this merges, since their git-deps resolve against this branch/tag): thin bin crates in
openframe-oss-tenantandopenframe-saas-tenant.Commits (one per logical part)
feat: import openframe-client asopenframe-agent-lib+run()— moves the full crate (lib + packagingbuild/,infrastructure/) underclients/openframe-client; hoists the clap CLI frommain.rsintoopenframe::run(); adds aclients/Cargo workspace. The binary is opt-in via thebinfeature (cargo build= library only;--features binbuilds the executable).chore: enforce cargo fmt + clippy —rustfmt.toml, workspace clippy policy (all = warn,correctness/suspicious=deny), committed git hooks (clients/.githooks: pre-commit = fmt-check, pre-push = clippy),clients/Makefile, CI (rust-client.yml+rust-setupaction), and docs.style: apply cargo fmt — pure formatting pass.fix: resolve clippy warnings — gate now passescargo clippy --all-targets --features bin -- -D warnings.fix: pin async-nats to an exact fork rev —branch = mainof the fork had drifted pastConnectOptions::custom_header; pinned to the commit the lockfile already used so downstream resolves are reproducible.Developer workflow
CI runs the same gate on macOS + Windows for changes under
clients/**.Decisions
bin; tenant deps default to the library'smainbranch (pin a tag for releases).--features bin(not--all-features): the tool-version override features'build.rsrequires release version env vars and isn't part of the standard gate.pedantic/nursery.Flagged for review (left as
#[allow(dead_code)]rather than deleted)Genuinely-unused items, candidates for deletion:
config::{Configuration, LoggingConfig},permissions::ROOT_UID,service_adapter::add_platform_specific_env,updater::get_download_path, and unread fields onMetric/LogShipper/VelopackUpdater. Also#![allow(deprecated)]inencryption_servicefor aes-gcm's bundled generic-array 0.x — proper fix is bumpingaes-gcm.Follow-ups (not in this PR)
cfgpaths are validated by the CIwindows-latestjob (cross-compiling C deps from macOS isn't possible locally).🤖 Generated with Claude Code
https://claude.ai/code/session_01RvFQiC4VAdu8ruwst8uJto