This is a command-line application. Source code is written in Rust and lives under rust/. Run cargo commands from that directory.
- Build:
cargo build - Run:
cargo run -- <command> - Test:
cargo test - Lint:
cargo clippy -- -D warnings - Format:
cargo fmt - Check:
cargo check - Regenerate API catalog:
cargo run -p generate-api-catalog— clones upstream OpenAPI specs and writesrust/schemas/api/*.json. SetGITHUB_TOKENfor full repo discovery; falls back to a hardcoded bootstrap list otherwise. - Regenerate Node.js Hosting spec:
./rust/scripts/regenerate-hosting-spec.sh
cargo check— must passcargo clippy -- -D warnings— must pass with zero warningscargo test— must passcargo fmt --check— must be clean./rust/scripts/check-module-size.sh— must pass
GoDaddy CLI is a Rust binary (edition 2024) built using:
- cli-engine: Command registration, auth (PKCE OAuth), credential storage, streaming
- clap: Argument parsing (via cli-engine's
CommandSpec/GroupSpec) - reqwest: HTTP client with rustls-tls
- serde_json: JSON serialization and API payloads
- tokio: Async runtime
- Rust edition 2024. Follow existing patterns in the codebase.
- Lints are enforced via
Cargo.toml([lints.rust]and[lints.clippy]):unsafe_code = "deny",unwrap_used = "deny",exit = "deny"- Use
.expect("reason")instead of.unwrap() - No
println!/eprintln!— usetracingorcli-engineevent streams
- Keep functions focused; avoid premature abstractions.
- Commands are
RuntimeCommandSpec(orRuntimeGroupSpecfor groups). - Register commands via
Module::new(...)and wire them inmain.rs. - Use
clap::Argfor arguments; retrieve viactx.args.get("key"). - Return
Ok(CommandResult::new(json!({...})))for success. - Prefer
crate::error::GddyError::{not_found,validation,auth,config,security,network,…}(andGddyError::fromfor module client errors) so agents get stableerror.code+ top-levelfix. UseErr(cli_engine::CliCoreError::message("..."))only for one-off cases that do not yet have a shared mapping. - Streaming commands use
RuntimeCommandSpec::new_streamingand emit events viaStreamSender.
- Rust source files should mirror the CLI command tree structure. See Code file structure for specifics.
- CI fails any
.rsfile over 1000 lines. Split file exceeding this limit.
- Handled entirely by
cli-engine(PKCE OAuth flow, secure credential storage). - The
ctx.credentialfield onCommandContextprovides the current token.
- Application settings in TOML format (
godaddy.toml,godaddy.<env>.toml). - Read/write via
crate::config::{read_config, write_config, config_path}.
- Post-bundle regex scanner in
extension/security/mod.rs(rule data inextension/security/rules.rs). - Rules SEC101–SEC110 ported from the TS scanner; SEC111–SEC115 added in the
Rust port with no TS baseline (SEC111/SEC112/SEC115 block, SEC113/SEC114
warn). Uses
fancy-regexfor lookahead support. scan_bundle(content, path) -> Vec<Finding>,is_blocked(findings) -> bool.
- The
bundle_extensionfunction spawnsesbuildas a subprocess. - It searches
node_modules/.bin/esbuildwalking up from CWD, then falls back to PATH. - Users need esbuild available (via
npm/pnpminstall or globally).