Skip to content

Example: Creating a New gbapp Virtual Crate 🟑 BETA

The old "gbapp virtual crate under src/" layout is not present in this tree; a new capability is added as a feature crate, a BASIC keyword module or a .gbdialog tool script.

Choose the surface

Goal Where the code goes Feature in botserver/Cargo.toml
A service many bots use botserver/crates/<name>/ with its own Cargo.toml A named feature that enables dep:<name>.
A BASIC statement botserver/crates/botbasic_*/src/keywords/ or botserver/src/basic/keywords/ scripting (via Rhai).
A bot-specific tool {bot}.gbdialog/<tool>.bas in the bot's ALM repository None; compiled to .ast at load.
A UI app botui/ui/suite/<app>/ plus an entry in botserver/src/apps/registry/ The app's own feature.

Minimum crate skeleton

botserver/crates/<name>/
β”œβ”€β”€ Cargo.toml     # description + workspace dependencies
└── src/
    └── lib.rs     # public API and module declarations

The manifest description is the documented responsibility. Declare Diesel tables only in botschema and re-export them with pub use botschema::<table>; (root AGENTS.md). Do not add table! macros to a feature crate.

Wiring steps

create crate β†’ declare feature (dep:<name>) β†’ mount in a host module β†’ register keywords/app β†’ cargo check -p <name> β†’ cargo test -p <name>

Production code must not use unwrap, expect, panic!, #[allow] or direct Command::new(); use propagated errors, SafeCommand and log_and_sanitize. Keep each file under 450 lines.

Limits

Claim Status
A src/<name>.gbapp/ directory Not present; do not create one as documentation.
Schema ownership table! and joinable! live only in botschema.
New files in the repository root Forbidden by the root AGENTS.md (except DESIGN-SYSTEM.md).