Skip to content

Commit 5fb7528

Browse files
authored
docs(operate): auto-generate operator cli-reference.md (#23382)
## Summary Adds an auto-generator for `docs/docs-operate/operators/reference/cli-reference.md`. The file was previously hand-maintained and silently drifted between v4.2.x and v4.3.0 (`--pxe` flag removed, `--local-network.testAccounts` added, ~450 lines of help-text drift across other flags). The developer-facing CLI references (`aztec`, `aztec-wallet`, `aztec-up`) already auto-generate via `scan_cli.py` + `cli_docs_config.json`, but `aztec start` is a single flag-list dump rather than a recursive command tree, so a simpler dedicated script makes more sense than retrofitting the existing framework. ## What changed - **New script:** `scripts/cli_reference_generation/generate_operator_cli_ref.sh` runs `aztec start --help` and concatenates with the hand-curated preamble. Retries on truncated output (the dockerized CLI sometimes drops trailing stdout when captured via `$(...)` subshell — fixed by writing to a temp file). - **New preamble file:** `scripts/cli_reference_generation/operator_cli_preamble.md` holds the hand-curated frontmatter + intro. - **New yarn script:** `generate:operator-cli-reference` in `docs/package.json`. - **Batch integration:** `generate_all_cli_docs.sh` now also generates the operator ref (skipped when `OUTPUT_DIR` is set, since that's the per-version flow which doesn't touch the operator doc). - **README updated** with a note explaining the side-path. - **Regenerated** `docs-operate/operators/reference/cli-reference.md` via the new pipeline (982 lines). The diff vs `next` reflects what should have been a v4.3.0 hand-update but never happened. ## Why this isn't part of `cli_docs_config.json` The existing `scan_cli.py` infrastructure walks subcommand trees and parses `Commands:` / `Subcommands:` sections. `aztec start` has no subcommands — it's one command with ~950 flag descriptions. Folding it into the existing config would require either special-casing inside `scan_cli.py` or duplicating the preamble handling. A 70-line standalone script is simpler. ## Out of scope `scan_cli.py` exhibits the same dockerized-CLI stdout-truncation bug (visible in the dev `aztec_cli_reference.md` line 1937 where "Default" is truncated to "Defau"). Worth fixing in a follow-up — same root cause, different code path. ## Test plan - [x] `yarn generate:operator-cli-reference` produces 982-line output ending cleanly with the TXE section - [x] `./scripts/cli_reference_generation/generate_all_cli_docs.sh --force current` triggers the new step at the end of the batch - [x] Retry logic activates and recovers on flaky CLI runs - [ ] CI build runs cleanly
2 parents 562d385 + 867306e commit 5fb7528

6 files changed

Lines changed: 259 additions & 3 deletions

File tree

.claude/skills/release-network-docs/SKILL.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,28 @@ if needed).
192192
Verify the output lists the expected number of methods and has no ungrouped
193193
methods warnings.
194194

195+
### Step 5b: Regenerate Operator CLI Reference
196+
197+
The operator-facing CLI reference (`docs/docs-operate/operators/reference/cli-reference.md`)
198+
is auto-generated from `aztec start --help`. Regenerate it so the doc matches
199+
the CLI shipped with the release.
200+
201+
Pass the release version with `-v` so the script verifies the locally-installed
202+
`aztec` CLI matches before running. The mismatch is fatal in non-interactive
203+
mode (use `-f` to bypass).
204+
205+
```bash
206+
cd docs
207+
yarn generate:operator-cli-reference -v v<new_version>
208+
```
209+
210+
If `aztec --version` reports a different version, install the matching one
211+
first with `aztec-up v<new_version>` and retry.
212+
213+
The script captures `aztec start --help`, retries on the dockerized-CLI
214+
stdout-truncation race, and writes the file. Verify the resulting file is
215+
~950+ lines and ends with `Starts Aztec TXE with options`.
216+
195217
### Step 6: Build and Validate
196218

197219
Set the environment variables matching the release type so the build
@@ -306,13 +328,18 @@ Check for stash conflicts. Then report to the user:
306328
- **Some addresses are not in the RPC**: Contracts like Staking Registry,
307329
Reward Booster, Tally Slashing Proposer, and others must be queried on-chain,
308330
obtained from deployment output, or confirmed unchanged by the user.
309-
- **No heavy prerequisites**: This skill does not require aztec CLI, nargo, or
310-
a yarn-project build. Only `yarn` (for the docs build), `curl`/`jq` (for
311-
the RPC query), and `cast` (for on-chain address queries) are needed.
331+
- **Lightweight prerequisites**: This skill does not require nargo or a
332+
yarn-project build. It does need: the locally-installed `aztec` CLI to match
333+
the release version (for Step 5b), `yarn` (for the docs build), `curl`/`jq`
334+
(for the RPC query), and `cast` (for on-chain address queries).
312335
- **Node API reference is auto-generated**: Run `yarn generate:node-api-reference`
313336
(Step 5a) before building. The generator parses TypeScript source directly, so
314337
no yarn-project build is required — but `yarn-project/node_modules/` must exist
315338
(run `yarn install` from `yarn-project` if missing).
339+
- **Operator CLI reference is auto-generated**: Run `yarn generate:operator-cli-reference`
340+
(Step 5b) before building. The script runs `aztec start --help` and prepends
341+
the hand-curated frontmatter/intro. Requires the matching `aztec` CLI version
342+
to be installed locally.
316343
- **Build must pass**: Do not cut versioned docs until `yarn build` succeeds.
317344
- **COMMIT_TAG needs `v` prefix**: The preprocessor uses COMMIT_TAG for GitHub
318345
URLs and git tag references. Omitting the `v` will break links in versioned

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"generate:aztec-nr-api": "./scripts/aztec_nr_docs_generation/generate_aztec_nr_docs.sh",
1313
"generate:typescript-api": "./scripts/typescript_api_generation/generate_ts_api_docs.sh",
1414
"generate:node-api-reference": "./scripts/node_api_reference_generation/generate_node_api_reference.sh",
15+
"generate:operator-cli-reference": "./scripts/cli_reference_generation/generate_operator_cli_ref.sh",
1516
"preprocess": "yarn node -r dotenv/config ./src/preprocess/index.js",
1617
"preprocess:move": "sh scripts/move_processed.sh",
1718
"serve": "yarn docusaurus serve",

docs/scripts/cli_reference_generation/CLI_DOCS_README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ The system supports multiple CLIs:
1515
- **Aztec Wallet CLI** (`aztec-wallet`) - Wallet-specific commands
1616
- **Aztec Version Manager** (`aztec-up`) - Version management tool
1717

18+
Additionally, the operator-facing `aztec start` reference is generated by a
19+
separate, simpler script (`generate_operator_cli_ref.sh`) and is wired into
20+
the same batch run. It bypasses `scan_cli.py` because `aztec start` is a
21+
single flag-list dump rather than a recursive command tree. The script
22+
concatenates a hand-curated preamble (`operator_cli_preamble.md`) with the
23+
fenced output of `aztec start --help` and writes
24+
`docs-operate/operators/reference/cli-reference.md`. Run it directly via
25+
`yarn generate:operator-cli-reference` or as part of
26+
`generate_all_cli_docs.sh`.
27+
1828
## Quick Start
1929

2030
### Step 1: Scan the CLI

docs/scripts/cli_reference_generation/generate_all_cli_docs.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,20 @@ for cli in "${VALID_CLIS[@]}"; do
9090
echo ""
9191
done
9292

93+
# Also regenerate the operator-facing `aztec start` reference. It is not
94+
# in cli_docs_config.json because it's a single flag-list dump rather than a
95+
# recursive command tree, and bypasses scan_cli.py. Only regenerate it for
96+
# the default/current flow — when OUTPUT_DIR is set or a specific historical
97+
# version is being targeted, the operator ref (which always reflects the
98+
# currently-installed CLI) isn't part of that flow.
99+
if [[ -z "$OUTPUT_DIR" ]] && [[ "$TARGET_VERSION" == "all" || "$TARGET_VERSION" == "current" ]]; then
100+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
101+
echo "Generating Operator (aztec start) CLI Reference"
102+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
103+
"$SCRIPT_DIR/generate_operator_cli_ref.sh"
104+
echo ""
105+
fi
106+
93107
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
94108
echo "✅ All CLI Documentation Generated"
95109
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@@ -103,6 +117,9 @@ for cli in "${VALID_CLIS[@]}"; do
103117
echo " - $CLI_OUTPUT_FILE"
104118
fi
105119
done
120+
if [[ -z "$OUTPUT_DIR" ]] && [[ "$TARGET_VERSION" == "all" || "$TARGET_VERSION" == "current" ]]; then
121+
echo " - operators/reference/cli-reference.md"
122+
fi
106123
echo ""
107124
if [[ -z "$OUTPUT_DIR" ]]; then
108125
echo "You can now commit these changes to the repository."
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
#!/usr/bin/env bash
2+
# Regenerate docs/docs-operate/operators/reference/cli-reference.md from the
3+
# `aztec start --help` output of the locally-installed aztec CLI.
4+
#
5+
# Unlike the developer-facing CLI references (aztec, aztec-wallet, aztec-up),
6+
# this file is a flag-list dump rather than a recursive command tree, so it
7+
# bypasses scan_cli.py. The hand-curated frontmatter + intro live in a
8+
# preamble file; this script concatenates the preamble with a fenced
9+
# `aztec start --help` capture.
10+
#
11+
# NOTE: `aztec start --help` runs through the dockerized aztec wrapper, which
12+
# occasionally drops trailing stdout (the container exits before the parent
13+
# drains the pipe) or exits non-zero. The retry loop below is the real
14+
# safeguard: it re-runs until the captured output contains the final help line.
15+
#
16+
# Usage:
17+
# ./generate_operator_cli_ref.sh # default target, no version check
18+
# ./generate_operator_cli_ref.sh /tmp/out.md # custom target
19+
# ./generate_operator_cli_ref.sh -v v4.3.0 # warn if installed CLI != v4.3.0
20+
# ./generate_operator_cli_ref.sh -v v4.3.0 -f # force past version mismatch
21+
#
22+
# Options:
23+
# -v, --version <ver> Warn if installed `aztec --version` does not match
24+
# this target. In non-interactive mode the mismatch is
25+
# fatal unless --force is passed.
26+
# -f, --force Skip the version-mismatch confirmation prompt.
27+
#
28+
# Run from any cwd — paths are resolved relative to the script location.
29+
30+
set -euo pipefail
31+
32+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
33+
DOCS_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
34+
PREAMBLE="$SCRIPT_DIR/operator_cli_preamble.md"
35+
DEFAULT_TARGET="$DOCS_ROOT/docs-operate/operators/reference/cli-reference.md"
36+
MAX_ATTEMPTS=3
37+
38+
TARGET=""
39+
TARGET_VERSION=""
40+
FORCE_MODE=false
41+
42+
while [[ $# -gt 0 ]]; do
43+
case "$1" in
44+
-v|--version)
45+
if [[ $# -lt 2 ]]; then
46+
echo "ERROR: $1 requires a value (e.g. -v v4.3.0)" >&2
47+
exit 1
48+
fi
49+
TARGET_VERSION="$2"
50+
shift 2
51+
;;
52+
-f|--force)
53+
FORCE_MODE=true
54+
shift
55+
;;
56+
-h|--help)
57+
sed -n '2,28p' "$0" | sed 's/^# \{0,1\}//'
58+
exit 0
59+
;;
60+
-*)
61+
echo "ERROR: unknown option: $1" >&2
62+
exit 1
63+
;;
64+
*)
65+
if [[ -z "$TARGET" ]]; then
66+
TARGET="$1"
67+
shift
68+
else
69+
echo "ERROR: unexpected extra positional argument: $1" >&2
70+
exit 1
71+
fi
72+
;;
73+
esac
74+
done
75+
TARGET="${TARGET:-$DEFAULT_TARGET}"
76+
77+
if [[ ! -f "$PREAMBLE" ]]; then
78+
echo "ERROR: preamble file not found at $PREAMBLE" >&2
79+
exit 1
80+
fi
81+
82+
if ! command -v aztec >/dev/null 2>&1; then
83+
echo "ERROR: 'aztec' CLI not found on PATH. Install with aztec-up first." >&2
84+
exit 1
85+
fi
86+
87+
# Optional version check — mirrors the pattern used by generate_cli_docs.sh.
88+
# Advisory: warns and either prompts or fails non-interactively. Bypassable
89+
# with --force, since CI flows build a wrapper around a freshly-built CLI
90+
# whose `--version` may not equal the target tag.
91+
if [[ -n "$TARGET_VERSION" ]]; then
92+
INSTALLED_VER="$(aztec --version 2>/dev/null | head -n1 \
93+
| grep -oE '[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?' | head -n1 || true)"
94+
TARGET_NORMALIZED="${TARGET_VERSION#v}"
95+
96+
if [[ "$INSTALLED_VER" != "$TARGET_NORMALIZED" ]]; then
97+
echo "" >&2
98+
echo "WARNING: aztec CLI version mismatch" >&2
99+
echo " Installed: ${INSTALLED_VER:-unknown}" >&2
100+
echo " Target: $TARGET_NORMALIZED" >&2
101+
echo " To fix: aztec-up v$TARGET_NORMALIZED" >&2
102+
echo "" >&2
103+
104+
if [[ "$FORCE_MODE" == true ]]; then
105+
echo "Force mode enabled, continuing with mismatched version..." >&2
106+
elif [[ -t 0 ]]; then
107+
read -p "Continue anyway? (y/N): " -n 1 -r
108+
echo ""
109+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
110+
echo "Aborted. Install the matching CLI version and retry." >&2
111+
exit 1
112+
fi
113+
else
114+
echo "ERROR: version mismatch in non-interactive mode. Use --force to bypass." >&2
115+
exit 1
116+
fi
117+
else
118+
echo "CLI version check passed: aztec v$INSTALLED_VER"
119+
fi
120+
fi
121+
122+
HELP_FILE="$(mktemp)"
123+
ERR_FILE="$(mktemp)"
124+
TMP="$(mktemp)"
125+
trap 'rm -f "$HELP_FILE" "$ERR_FILE" "$TMP"' EXIT INT TERM
126+
127+
# Capture into a file (not a shell variable) and validate completeness by the
128+
# presence of the final help line ("Starts Aztec TXE with options"), not just
129+
# the "TXE" section header — a dropped tail can omit the trailing flag and its
130+
# description while still emitting the header. This sentinel tracks the last
131+
# entry in yarn-project/aztec/src/cli/aztec_start_options.ts; update it if that
132+
# block is reworded or reordered.
133+
#
134+
# `|| true` keeps a non-zero exit (which the same flush race can produce) from
135+
# aborting the loop under `set -e`, so the retry actually covers that failure
136+
# mode; the sentinel check below is the real success signal. stderr is captured
137+
# rather than discarded so a genuine failure (missing image, daemon down) is
138+
# surfaced instead of masquerading as truncation.
139+
for attempt in $(seq 1 "$MAX_ATTEMPTS"); do
140+
COLUMNS=200 aztec start --help >"$HELP_FILE" 2>"$ERR_FILE" || true
141+
142+
if grep -qF 'Starts Aztec TXE with options' "$HELP_FILE"; then
143+
break
144+
fi
145+
146+
LINES="$(wc -l < "$HELP_FILE")"
147+
if [[ "$attempt" -lt "$MAX_ATTEMPTS" ]]; then
148+
echo "WARN: 'aztec start --help' output incomplete, trailing TXE description missing (attempt $attempt/$MAX_ATTEMPTS, $LINES lines), retrying..." >&2
149+
sleep 1
150+
else
151+
echo "ERROR: 'aztec start --help' kept producing incomplete output after $MAX_ATTEMPTS attempts ($LINES lines)." >&2
152+
echo " Last line: '$(tail -1 "$HELP_FILE" | cut -c1-80)...'" >&2
153+
if [[ -s "$ERR_FILE" ]]; then
154+
echo " stderr from the final attempt:" >&2
155+
sed 's/^/ /' "$ERR_FILE" >&2
156+
fi
157+
exit 1
158+
fi
159+
done
160+
161+
cat "$PREAMBLE" > "$TMP"
162+
echo '```bash' >> "$TMP"
163+
cat "$HELP_FILE" >> "$TMP"
164+
echo '```' >> "$TMP"
165+
166+
# mktemp creates the temp file 0600; normalize before moving so the generated
167+
# doc doesn't land owner-only (mv preserves the source mode).
168+
chmod 644 "$TMP"
169+
mv "$TMP" "$TARGET"
170+
171+
echo "Wrote $TARGET ($(wc -l < "$TARGET") lines)"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
displayed_sidebar: operatorsSidebar
3+
title: Cli Reference
4+
description: A reference of the --help output when running aztec start.
5+
references: ["yarn-project/aztec/src/cli/aztec_start_options.ts", "yarn-project/aztec/src/cli/cli.ts"]
6+
keywords:
7+
[
8+
aztec,
9+
prover,
10+
node,
11+
blockchain,
12+
L2,
13+
scaling,
14+
ethereum,
15+
zero-knowledge,
16+
ZK,
17+
setup,
18+
]
19+
tags:
20+
- prover
21+
- node
22+
- tutorial
23+
- infrastructure
24+
---
25+
26+
**Configuration notes:**
27+
28+
- The environment variable name corresponding to each flag is shown as $ENV_VAR on the right hand side.
29+
- If two subsystems can contain the same configuration option, only one needs to be provided. For example, `--archiver.blobSinkUrl` and `--sequencer.blobSinkUrl` point to the same value.
30+

0 commit comments

Comments
 (0)