diff --git a/documentation/cli/00_overview.md b/documentation/cli/00_overview.md index d6f5b4e04..9b4090901 100644 --- a/documentation/cli/00_overview.md +++ b/documentation/cli/00_overview.md @@ -62,3 +62,19 @@ Specifies the path to Leo program root folder. Defaults to `./`. #### `--home ` Specifies the path to the `.aleo` program registry. This is where programs downloaded from the network will be cached. Defaults to `~/.aleo/registry`. + +#### `--json-output[=]` +Saves structured JSON output to disk. + +- **Default location**: `build/json-outputs/.json` +- **Custom path**: `--json-output=my-results.json` + +Supported commands: `deploy`, `upgrade`, `run`, `execute`, `test`, `query`, `synthesize`. + +```bash title="Examples" +# Save to default location (build/json-outputs/run.json) +leo run --json-output main 1u32 2u32 + +# Save to custom path +leo execute main --json-output=my-results.json +``` diff --git a/documentation/cli/06_deploy.md b/documentation/cli/06_deploy.md index 22a571db3..bffca3a21 100644 --- a/documentation/cli/06_deploy.md +++ b/documentation/cli/06_deploy.md @@ -77,6 +77,35 @@ Once it is deployed, it CANNOT be changed. See the **[Deploying](./../guides/03_deploying.md)** guide for more details. +### JSON Output + +Use `--json-output` to save structured JSON results to disk for programmatic use: + +```bash +# Save to default location (build/json-outputs/deploy.json) +leo deploy --json-output -y + +# Save to custom path +leo deploy --json-output=deployment_result.json -y +``` + +Example output (`build/json-outputs/deploy.json`): +```json +{ + "deployments": [ + { + "program_id": "my_program.aleo", + "transaction_id": "at1..." + } + ] +} +``` + +This is useful for scripting and CI/CD pipelines: +```bash +# Deploy and extract the transaction ID +jq '.deployments[0].transaction_id' build/json-outputs/deploy.json +``` ### Flags: