Guide d'architecture du projet bombyx

VérifiéSûr

Vue d'ensemble de l'architecture du CLI Rust bombyx : organisation des modules, responsabilités et extension sécurisée.

Spar Skills Guide Bot
DeveloppementIntermédiaire
06/09/2026
Claude CodeCursorCodex
#rust#architecture#codebase-navigation#cli#quality-gates

Recommandé pour

Synthèse automatique

Décrit l'architecture du CLI Rust bombyx : disposition des crates, rôle de chaque module, seuils de qualité et contraintes de conception.

Points forts

  • Ventile les responsabilités module par module (config, remote, plan, doctor, update, xtask) avec les types et fonctions clés
  • Énonce des seuils de qualité chiffrés et vérifiables (clippy -D warnings, couverture 90 %/85 %, duplication ≤ 6 %, unsafe interdit, RUSTSEC)
  • Explicite la contrainte structurante du projet : ni le poste opérateur ni l'hôte VM ne lisent les fichiers du projet, tout est régénéré depuis config.toml
  • Indique où se trouve la source unique de version et comment un sous-commande est planifié puis exécuté

Limites

  • Contenu spécifique au dépôt bombyx, non réutilisable sur un autre projet
  • Le document fourni s'interrompt au tableau des portes de qualité : la procédure « ajouter une fonctionnalité » annoncée n'est pas détaillée
  • Ne donne aucun exemple concret de config.toml ni de RemoteCommand
Quand l'utiliser

À utiliser lorsqu'on travaille dans le dépôt bombyx et qu'on doit localiser le bon module ou connaître les portes de qualité à respecter.

Quand l'éviter

Inutile pour un autre projet Rust, ou pour apprendre à installer et utiliser bombyx en tant qu'opérateur.

Analyse de sécurité

Sûr
Score qualité88/100

This is a project architecture document with no declared tools, no executable instructions, and no destructive, exfiltrating, or obfuscated actions. It only references normal Rust build, testing, and quality-gate commands.

Aucun point d'attention détecté

Comment cette analyse est faite

Exemples

Locate a new subcommand
I want to add a `bombyx snapshot` subcommand. Which files in this repo do I need to touch, and how does plan() wire a subcommand to its commands?
Check merge gates
What clippy, coverage and duplication thresholds does bombyx enforce, and what does the config module need to satisfy before I open a PR?
Understand the trust boundary
Why does bombyx regenerate the Vagrantfile and bootstrap script on every boot instead of letting the VM host read the project files?

name: architect description: Project overview and architecture guide for bombyx -- crate layout, responsibilities, quality gates, and how to add a feature.

bombyx Architecture

Project Identity

| Field | Value | |-------|-------| | Language | Rust (edition 2024, stable toolchain) | | Shape | CLI only -- no services, no frontend | | License | MIT | | Version | crates/bombyx/Cargo.toml (single source) | | Versioning | SemVer 2.0.0 | | Platforms | Windows (workstation), Linux | | Template | derived from breki/rustbase |

What bombyx Does

Drives isolated AI-agent VMs on a libvirt host, usually a second machine reached over SSH. The control plane is deliberately thin: bombyx generates a Vagrantfile and a bootstrap script, writes them onto the VM host and runs vagrant there, streaming output back. When host names the machine bombyx is running on, the same script goes through sh -c instead.

The key architectural constraint: neither the workstation nor the VM host reads the project's files. Both generated files come out of the operator's own config.toml and are rewritten on every boot, so the host cannot drift, and the guest clones the project itself once it is running. See docs/trust-boundary.md.

Repository Layout

bombyx/
  .cargo/
    config.toml         # cargo xtask alias
  .claude/
    hooks/              # Claude Code hook scripts
    commands/           # slash commands
    skills/             # domain knowledge skills
    settings.json       # hook configuration
  crates/
    bombyx/
      src/
        lib.rs          # crate root, re-exports
        plan.rs         # which commands run, in what order
        config.rs       # config.toml parsing (submodules)
        remote.rs       # command building, either route
        vagrantfile.rs  # renders the two generated files
        doctor.rs       # preflight checks (submodules)
        update.rs       # self-update (submodules)
        name.rs term.rs tool.rs
        bin/bombyx/
          main.rs       # CLI entry point (thin)
      tests/
        integration_test.rs
  xtask/
    src/
      main.rs           # build automation
  scripts/              # bash wrappers
  docs/
    developer/
      DIARY.md          # development diary
      redteam-log.md    # security review findings
      artisan-log.md    # quality review findings

Module Responsibilities

config -- project configuration

Parses the operator's config.toml: a file-wide host, and one [projects.<name>] table per project carrying remote_root, an optional host, [vm] and [source]. Config::load_project(name, registry) is the one loader, and config::host::rank picks between the two host keys, the project's own winning. Every host in the file is checked as the file is read, so holding a Registry proves they all passed. Typed errors via thiserror. Computes remote paths (remote_project_dir, remote_scratch_dir).

remote -- command construction

Pure functions returning a RemoteCommand { program, args, dir }. Nothing here spawns a process. That separation is what makes quoting, path joining and command composition unit-testable with no VM host in the loop.

Includes shell_quote for POSIX single-quote escaping -- every value interpolated into a remote script goes through it.

bin/bombyx/main.rs -- entry point

Clap parsing, then plan() maps a subcommand to a sequence of Commands, which are either printed (--dry-run) or executed. Kept thin because coverage excludes src/bin/.

xtask -- build automation

Not published. validate, test, clippy, fmt, coverage, dupes, audit, dep-age*.

Quality Gates

| Gate | Threshold | |------|-----------| | Clippy | Zero warnings (-D warnings) | | Formatting | cargo fmt --check | | Coverage | 90% overall, 85% per module | | Duplication | <= 6% (production code) | | Unsafe code | Forbidden (#[forbid(unsafe_code)]) | | Advisories | RUSTSEC clean |

cargo xtask validate runs every gate; the six above are the ones worth memorising, and CLAUDE.md under Definition of Done lists them all in execution order.

The Claude Code Stop hook runs a subset: fmt-check, clippy, doc and test. It skips coverage and duplication deliberately, because both are slow -- see .claude/hooks/stop-check.sh. A coverage regression is caught by validate, not by the hook.

Adding a New Subcommand

  1. Write tests first (TDD).
  2. Add the command-building function in remote.rs with unit tests asserting the exact argv. There are two argv shapes, one per route, so assert both -- see Config::for_tests_local.
  3. Add the VmCmd variant and its action_of arm in main.rs -- the CLI surface, and nothing else.
  4. Add the Action variant and its plan() arm in plan.rs, with the unit test asserting the ordered commands. This is where the logic goes: main.rs is excluded from coverage.
  5. Add an integration test driving the real binary with --dry-run.
  6. Run cargo xtask validate.
  7. Commit with /commit.

Keep logic out of main.rs: it is excluded from coverage, so anything non-trivial there ships untested.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/architecture-guide-for-bombyx-project-mtpag76o/download' --output '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md.part' && mv '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md.part' '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && test -s '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/architect' && cp -R '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o' '.claude/skills/architect'

Cursor
test -f '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && test -s '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/architect' && cp -R '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o' '.cursor/skills/architect'

Codex
test -f '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && test -s '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/architect' && cp -R '.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o' '.agents/skills/architect'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/architecture-guide-for-bombyx-project-mtpag76o'

openskills read 'architecture-guide-for-bombyx-project-mtpag76o'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/architecture-guide-for-bombyx-project-mtpag76o/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires