docs: generate env and CLI reference tables from source - #5726
Merged
Conversation
README carried a hand-written environment-variable table (12 rows, including AGENTDESK_SERVER_PORT which the binary never reads) and a CLI Reference block that had drifted from src/cli/args.rs (19 subcommands missing, a `--flavor dev` value that does not exist). Both are now generated from the source tree: - scripts/generate_env_reference.py -> docs/generated/env-reference.md Collects env::var / env::var_os / std::env::var literal reads, const-defined AGENTDESK_*/ADK_* names (including indirect env::var(CONST) reads), *env* helper calls, and tracing EnvFilter::from_default_env (RUST_LOG). Excludes tests.rs, src/**/tests/, and #[cfg(test)] modules. Sorted by name; one-sentence description from the nearest comment naming the variable. - scripts/generate_cli_reference.py -> docs/generated/cli-reference.md Parses the clap derive items (Parser/Subcommand/Args/ValueEnum) without a cargo build and renders every command, nested subcommand, flag, positional, value-enum choices, defaults, after_help and cfg/hide notes. The unit test asserts the derived top-level list equals the clap snapshot test in args.rs. - README links to both documents and keeps only a short "commonly used" list. - scripts/ci-script-checks.sh regenerates both docs, runs their unit tests, and reuses the existing `git diff --exit-code` tracked-doc gate so drift fails the PR. docs/generated/README.md records the exception to the warning-only drift policy. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
itismyfield
enabled auto-merge (squash)
September 5, 2026 06:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
README carried a hand-written environment-variable table (12 rows) and a
## CLI Referenceblock that had drifted from the code. Both are now generated fromsrc/and linked from README; CI regenerates them and fails on drift.What is generated
scripts/generate_env_reference.pydocs/generated/env-reference.md— 87AGENTDESK_*/ADK_*variables + 27 platform/third-party variables (114 rows), sorted by name, columnsVariable | Defined at (file:line) | Descriptionenv::var/env::var_os/std::env::varliteral reads,const X_ENV: &str = "AGENTDESK_…"name constants (plus indirectenv::var(CONST)reads),*env*("AGENTDESK_…")helper calls,EnvFilter::from_default_env()(RUST_LOG).tests.rs,src/**/tests/,#[cfg(test)] modblocks andtarget/are excluded.scripts/generate_cli_reference.pydocs/generated/cli-reference.md— 53 top-level commands, 93 including nested subcommands; global options, command index, per-command usage line and argument table (value-enum choices, defaults, required, aliases,after_help,#[cfg(unix)]/hidden notes)Parser/Subcommand/Args/ValueEnum) insrc/cli/args.rs,src/cli/provider_cli/mod.rs,src/cli/migrate.rs— no cargo build.tests/test_generate_cli_reference.pyasserts the derived top-level command list equals the clap snapshot testtop_level_command_name_snapshot_preserves_public_cli_surfaceinargs.rs, so the Python name derivation cannot silently diverge from clap.README changes
### Environment Variables: table removed, replaced by a link todocs/generated/env-reference.mdand a 5-item "commonly used" list (AGENTDESK_ROOT_DIR,AGENTDESK_CONFIG,AGENTDESK_API_URL,AGENTDESK_TOKEN,RUST_LOG).AGENTDESK_SERVER_PORT(onlyscripts/deploy.shreads it as a health-check port),AGENTDESK_CODEX_PATH,AGENTDESK_GEMINI_PATH(read nowhere),AGENTDESK_INSTALL_PORT(installer shell variable; still documented in Quick Start).AGENTDESK_REPO_DIR,AGENTDESK_DCSERVER_LABEL,AGENTDESK_STATUS_INTERVAL_SECS,AGENTDESK_TURN_TIMEOUT_SECS,AGENTDESK_GH_PATH,AGENTDESK_HEADLESS_DISCORD_NONCE) are in the generated document.## CLI Reference: the 60-line hand-written block removed, replaced by a link todocs/generated/cli-reference.mdplus an 8-line "frequently used entry points" snippet.emit-launchd-plist --flavor release|devis gone:LaunchdPlistFlavorArghas a singleReleasevariant, and the generated doc now shows--flavor <FLAVOR>with choicesrelease. The retiredmigrate postgres-cutovernote is kept as one sentence.CI drift gate
scripts/ci-script-checks.shgained one section after the inventory-docs step: run both generators, runtests.test_generate_env_reference+tests.test_generate_cli_reference, then the existinggit diff --exit-codetracked-doc gate now also listsdocs/generated/env-reference.mdanddocs/generated/cli-reference.md(one gate, no duplicate check).docs/generated/README.mdrecords these two as the explicit exception to the warning-only drift policy (cheap source parsers, only change when an env read site or clap definition changes).deny_unknown_fieldsis untouched.Verification
Coverage checks: env table 114 rows (≥100); CLI table contains
send-to-agent,query,health,machine-compare.Not run locally: the full
scripts/ci-script-checks.sh(its--verify-lib-inventorystep needs a cargo build).tests.test_portable_docs_examplesfails onmainas well (agentdesk.example.yamlcontainsmac-book-release) and is unrelated to this PR.Known gaps
env::var(key)(e.g.["AGENTDESK_TEST_GIT", "AGENTDESK_GIT"]insrc/services/platform/binary_resolver.rs) and theAGENTDESK_*profile-name arrays insrc/services/routines/migrated.rsare not captured (5 names). Adding a dedicated pattern is a follow-up.🤖 Generated with Claude Code