Skip to main content

Crate gadk_cli

Crate gadk_cli 

Source
Expand description

gadk-cli: the gadk deploy CLI (gadk deploy cloudrun, gadk deploy agentengine) and its helper text and console utilities. Its flags, checks, generated Dockerfile CMD, gcloud invocations and console output follow ADK’s deploy CLI.

The binary gadk deploys a gadk agent (a Cargo binary target) to Cloud Run or Vertex AI Agent Engine. Everything a command touches outside the process (child processes, stdout and stderr, the working directory, the environment, the clock) goes through Env, so tests never spawn gcloud or cargo, never read the process environment and never change the current directory.

Modules§

deploy
The deploy command, with the cloudrun and agentengine subcommands each module’s init adds.
flags
Command-line flag helpers for clap: the flag kinds the gadk deploy commands register (string, int, duration and bool flags) as clap builder Args that parse like ADK’s CLI flags, the value readers, passed (the flag was on the command line) and the mapping of clap’s parse errors to ADK’s error texts (pflag_error).
root
The root command and its dispatch: the command tree gadk → deploy → {agentengine, cloudrun}, and the error reporting (Error: <msg> and the failing command’s usage on stderr, exit 1).
runner
The process seam: Cmd is a command with its program looked up in PATH and a text form; a CommandRunner starts it. Production uses TokioRunner; tests inject a recording runner, so no test spawns gcloud or cargo.
stage
The build context a deploy ships: the two-stage Dockerfile’s text, the staged source tree (copy and archive) and the temp-dir helper (a <prefix>YYYYMMDD_HHMMSS__* directory).
target
The Cargo target a deploy builds and the builder image’s Rust version.
util
The text checks and the console helpers the gadk commands print with. The flag-usage helper lives in gadk-launcher as flag_usage (the launcher’s user).

Structs§

Env
Everything a command reads or writes outside the process (stdout, stderr, the working directory, the environment, the clock and child processes).
SharedWriter
A cloneable, shared output stream (the commands’ stdout and stderr): every clone writes to the same underlying writer, one write call at a time.

Functions§

run
Runs the gadk command line (args includes the program name, as std::env::args_os) and returns the process exit code: 0, or 1 when a command failed.