Skip to content

Commit a626d44

Browse files
authored
[DOCS] Add details about regenerating CLI schema (#3516)
1 parent bb33ae7 commit a626d44

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ dotnet format # auto-fix C# formatting
3030
dotnet test tests/Elastic.Markdown.Tests/ # single test project
3131
```
3232

33+
**CLI changes:** after editing `src/tooling/docs-builder/Commands/`, regenerate `docs/cli-schema.json`:
34+
35+
```bash
36+
dotnet run --project src/tooling/docs-builder -- __schema > docs/cli-schema.json
37+
```
38+
39+
See [CONTRIBUTING.md](CONTRIBUTING.md#cli-reference-maintenance) for supplemental CLI docs under `docs/cli/`.
40+
3341
### TypeScript frontend
3442

3543
```bash

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ Markdown files are refreshed automatically through livereload
4444

4545
Code or layout changes will relaunch the server automatically
4646

47+
## CLI reference maintenance
48+
49+
When you add or change CLI options in `src/tooling/docs-builder/Commands/`, regenerate the checked-in schema so CI and the published CLI reference stay in sync:
50+
51+
```bash
52+
dotnet run --project src/tooling/docs-builder -- __schema > docs/cli-schema.json
53+
```
54+
55+
Commit the updated `docs/cli-schema.json` with your code changes. CI compares the schema (ignoring the `version` field) and fails if it has drifted.
56+
57+
The schema drives auto-generated parameter tables and usage synopses on CLI reference pages. For behavior, workflows, and examples that the schema cannot express, also update supplemental files under `docs/cli/` (see [Writing supplemental content](docs/cli/cli-supplemental-docs.md)).
58+
4759
# Release Process
4860

4961
This section outlines the process for releasing a new version of this project.

docs/cli/cli-reference-how-to.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ my-tool export-schema > docs/cli-schema.json
2828

2929
Commit that file. It is the source of truth for the generated reference section.
3030

31+
:::{note}
32+
**Maintaining docs-builder itself:** after changing CLI options in `src/tooling/docs-builder/Commands/`, regenerate this repository's schema with:
33+
34+
```bash
35+
dotnet run --project src/tooling/docs-builder -- __schema > docs/cli-schema.json
36+
```
37+
38+
Commit the updated file with your code changes. See [CONTRIBUTING.md](https://github.com/elastic/docs-builder/blob/main/CONTRIBUTING.md#cli-reference-maintenance) for the full workflow, including when to update supplemental files under `docs/cli/`.
39+
:::
40+
3141
:::{tip}
3242
Add a CI step that regenerates the schema and fails if the checked-in copy has drifted:
3343

0 commit comments

Comments
 (0)