Engine adapter trait and conformance test suite for coding CLIs

Aperta
#205 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, tauri
Ambito
cli, security, testing

Direzione di ricerca

Read docs/guide/cli-engines.md, then crates/cli-provider/src/registry.rs and levels.rs; run cargo test -p cli-provider to see the current coverage. Start by drafting the adapter trait and choosing an engine to migrate, then get the design reviewed before coding. Done means at least two engines pass the shared conformance suite, including a deliberately broken adapter test, and the Linux and Windows test and clippy commands pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: cli-engines enhancement help wanted needs design

size: L · first-timer: no

Please comment before starting so we can agree on the design. This reshapes a security-sensitive part of the runtime, so the trait boundary must be reviewed first.

Summary

Turn the coding-CLI integrations (Claude Code, Codex, Cursor, OpenCode, Antigravity, Gemini CLI) from a static table plus per-engine special cases into an engine adapter trait with a shared conformance test suite, so adding or changing an engine means one module that must pass the same tests.

Why it matters

Praxi can hand a bot's brain to a locally installed coding CLI. Every new engine today touches several places, and behaviour that must stay identical across engines (version floors, how approval levels map onto the CLI's permission mode, untrusted installer output, no credential leakage) is only tested engine by engine. Contributors who want to add a CLI (see #185, #186, #187 for sign-in work) need a clear contract and a way to prove they met it.

Current state

  • crates/cli-provider/src/registry.rs has CliEngineSpec and the static CLI_ENGINES table: command names, version and auth probe arguments, install descriptors, minimum versions, last-resort model lists.
  • crates/cli-provider/src/levels.rs maps the bot's approval level onto each CLI's own permission mode (level_plan) and selects a native-tools driver via Driver::from_id. runtime.rs (about 1,600 lines) runs sessions; detect.rs (about 2,500 lines) probes installed engines; login.rs, install.rs, models.rs, opencode.rs, peer.rs hold engine-specific parts.
  • docs/guide/cli-engines.md records, per engine, what is detected, how auth status is read, whether Praxi's own tools can stay in charge ("brain") and the verified install command.
  • Tests exist but are engine-specific; there is no shared contract and no fake CLI executable that a new adapter can be run against.

Proposal and suggested approach

  1. Design. Draft an EngineAdapter trait covering: detection and version, auth status, install descriptor, model listing, session spawn and streaming events, and the approval-level mapping. Decide which parts are data (stay in the table) and which are behaviour.
  2. Migrate the existing engines behind the trait with no behaviour change, one engine per PR, keeping detect.rs/runtime.rs shrinking rather than growing.
  3. Conformance suite. A reusable set of tests that runs against any adapter using a scripted fake CLI executable (a small test binary or script that prints canned output): detection with and without the binary, a version below the floor is refused, auth unknown vs signed in, session start/stream/cancel and orphan-process cleanup, approval mapping never grants more than the bot's level, installer output is treated as untrusted text, and credentials/ambient API keys are not passed through.
  4. An opt-in mode (BOT_CLI_CONFORMANCE_REAL=1) that runs the read-only parts of the same suite against the real installed CLI.
  5. A short "adding an engine" guide in docs/contributing/.

Acceptance criteria

  • Trait and suite merged with at least two existing engines migrated and passing the suite; remaining engines have a tracking checklist in the PR.
  • No change to what users see in Settings > Providers or to docs/guide/cli-engines.md claims, except additions.
  • The suite fails when an adapter weakens an invariant (include a deliberately broken fake adapter test).
  • cargo test -p cli-provider and cargo clippy -p cli-provider --all-targets -- -D warnings pass on Linux and Windows.

Out of scope

Adding a brand-new engine, changing install commands, the host-side sign-in work, changing the approval model.

How to get started

Read docs/guide/cli-engines.md, then registry.rs and levels.rs; run cargo test -p cli-provider. Comment here with a draft of the trait and which engine you would migrate first.

Lingua principale
Rust
Stelle
0
Fork
1
Merge medio
6h 54m
PR unite (30g)
152

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di emreocell/Praxi-Bot

Tutte le issue di emreocell/Praxi-Bot

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.