Currently, src/bin/wasmtime.rs acts as a minimal glue layer that delegates command execution directly to sub-modules via Wasmtime::parse().execute(). While keeping the entry point lightweight is clean, the binary currently lacks centralized global initialization—such as global environment logging (env_logger / tracing) setup—and custom top-level error formatting/context handling.
Moving these cross-cutting concerns to the top-level binary entry point would provide a more consistent experience across all subcommands (run, compile, serve, etc.) and improve debuggability when CLI commands fail.
Proposed Changes
Global Logging Initialization: Set up logging/tracing once at the start of main() in src/bin/wasmtime.rs before dispatching to subcommands.
Enhanced Error Context: Wrap the execution error handling in main() with clearer diagnostic reporting or pretty printing rather than returning a raw wasmtime::Result<()>.
Steps to Reproduce / Motivation
Run a wasmtime subcommand with environment log flags set (e.g., RUST_LOG=debug).
Observe that logging setup is handled inconsistently or localized strictly within individual command implementations rather than at the top level binary.
Expected Behavior
The CLI entry point should handle global process initialization (logging/tracing, diagnostic context) before dispatching execution to subcommands.
Currently, src/bin/wasmtime.rs acts as a minimal glue layer that delegates command execution directly to sub-modules via Wasmtime::parse().execute(). While keeping the entry point lightweight is clean, the binary currently lacks centralized global initialization—such as global environment logging (env_logger / tracing) setup—and custom top-level error formatting/context handling.
Moving these cross-cutting concerns to the top-level binary entry point would provide a more consistent experience across all subcommands (run, compile, serve, etc.) and improve debuggability when CLI commands fail.
Proposed Changes
Global Logging Initialization: Set up logging/tracing once at the start of main() in src/bin/wasmtime.rs before dispatching to subcommands.
Enhanced Error Context: Wrap the execution error handling in main() with clearer diagnostic reporting or pretty printing rather than returning a raw wasmtime::Result<()>.
Steps to Reproduce / Motivation
Run a wasmtime subcommand with environment log flags set (e.g., RUST_LOG=debug).
Observe that logging setup is handled inconsistently or localized strictly within individual command implementations rather than at the top level binary.
Expected Behavior
The CLI entry point should handle global process initialization (logging/tracing, diagnostic context) before dispatching execution to subcommands.