Generate typed Rust endpoint bindings for CLI and MCP clients #75

Open
opened 2026-10-04 18:00:09 +00:00 by kayg · 0 comments
Owner

Problem and evidence

CLI and MCP share crates/infraternal/src/http.rs and stream.rs, but route methods and DTO mappings are maintained by hand. The HTTP client imports many individual proto request/response types (http.rs:1-20); MCP tools separately encode container endpoint behavior, for example crates/infraternal/src/mcp.rs:680-709. TypeScript's generated client currently generates only an OpenAPI-fetch wrapper (packages/api-client/scripts/generate-client.ts:1-12).

Recommendation

After route/schema generation is extracted, generate typed Rust path/method/request/response bindings for the shared CLI/MCP API client where they remove duplicated endpoint knowledge. Keep human command names, dry-run/plan requirements and MCP safety annotations explicit in product code.

Payoff and estimate

Reduces path/DTO drift while preserving clear help and mutation safety. Estimate: 2–3 engineering days after route metadata is available, including generated-output equality and typed client checks.

Priority: Next milestone (PLAN step 6).

2026-10-04 owner decisions: Matches one API contract and code/tests as the spec. Keep dry-run and human safety semantics explicit; generated transport types do not decide authorization.

Report: arch-review report
Source: arch-review 2026-10-04

## Problem and evidence CLI and MCP share `crates/infraternal/src/http.rs` and `stream.rs`, but route methods and DTO mappings are maintained by hand. The HTTP client imports many individual proto request/response types (`http.rs:1-20`); MCP tools separately encode container endpoint behavior, for example `crates/infraternal/src/mcp.rs:680-709`. TypeScript's generated client currently generates only an OpenAPI-fetch wrapper (`packages/api-client/scripts/generate-client.ts:1-12`). ## Recommendation After route/schema generation is extracted, generate typed Rust path/method/request/response bindings for the shared CLI/MCP API client where they remove duplicated endpoint knowledge. Keep human command names, dry-run/plan requirements and MCP safety annotations explicit in product code. ## Payoff and estimate Reduces path/DTO drift while preserving clear help and mutation safety. Estimate: 2–3 engineering days after route metadata is available, including generated-output equality and typed client checks. **Priority:** Next milestone (PLAN step 6). **2026-10-04 owner decisions:** Matches one API contract and code/tests as the spec. Keep dry-run and human safety semantics explicit; generated transport types do not decide authorization. **Report:** [arch-review report](/mnt/hdd/infraternal/jobs/arch-review/report.md) **Source: arch-review 2026-10-04**
Commenting is not possible because the repository is archived.
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/infraternal-v0#75
No description provided.