Skip to content

Commit 5712b2a

Browse files
Mpdreamzclaude
andauthored
feat(cli-docs): supplemental content system for generated CLI reference pages (#3271)
* feat(cli-docs): structured supplemental docs, cli-modifiers directive, and assembler/changelog content Adds four generator improvements and restores hand-authored content for the assembler and changelog namespaces. Generator changes: - New `:::{cli-modifiers}` directive renders a pill row (destructive, requires-confirmation, auth required, idempotent, scope, streaming, long-running) between the usage block and description on generated pages - `CliSupplementalDoc` parser splits supplemental files into typed sections: `## Description` overrides the intro; `## Options` / `## Arguments` override per-parameter text (unknown keys are a build error); any other `##` heading appends as post-content after the generated parameter table - `__argh_root` and other `ReservedMetaCommands` tokens are stripped from generated usage lines - Schema `notes` field is no longer rendered (use supplemental post-content instead) - Behaviour-flag params (dryRun, confirmationSkip, output) get a quick-reference block above Arguments/Options - Stack-overflow fix: expose `Collector` as `protected` on `MarkdownFile` so CLI file subclasses can emit diagnostics without storing `BuildContext` as a record field Supplemental content: - Assembler namespace and all sub-commands (assemble, build, clone, serve, index, bloom-filter create/lookup, config init, content-source match/validate, deploy apply/plan/update-redirects, navigation validate/validate-link-reference) - Changelog commands: add, bundle-amend, evaluate-pr, gh-release, init, remove, render Docs: - cli-reference-how-to step 3 replaced with a link to the new supplemental-docs page - New `cli-supplemental-docs.md` documents file naming, heading rules, and `## Options` / `## Arguments` override syntax Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix: import ordering and broken relative links in supplemental docs Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix: namespace option overrides and fenced code block languages - Thread OptionOverrides and emitError through NamespacePage so namespace supplemental ## Options are applied and typos are caught at build time - Add text language to directory tree fenced blocks in cli-supplemental-docs.md Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix: output formats always rendered and role-scoped override validation - Output formats block no longer skipped when command has no modifier pills - Option/argument override validation now checks against the correct parameter role subset so a flag name in ## Arguments (or vice-versa) is caught Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent c570a83 commit 5712b2a

36 files changed

Lines changed: 1166 additions & 155 deletions

docs/_docset.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ toc:
167167
- file: installation.md
168168
- file: shell-autocompletion.md
169169
- file: cli-reference-how-to.md
170+
children:
171+
- file: cli-supplemental-docs.md
170172
- folder: mcp
171173
children:
172174
- file: index.md
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Generates a bloom filter that gets embedded into the `docs-builder` binary.
2+
3+
This bloom filter is used to determine whether a document's `mapped_page` frontmatter field exists in the [legacy-url-mappings](../../../configure/site/legacy-url-mappings.md) project. The result controls how the document history selector is populated.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test command to assert whether an old V2 URL matches the bloom filter embedded in the `docs-builder` binary.

docs/cli/assembler/cmd-build.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Description
2+
3+
:::{note}
4+
This command requires that you've previously run `docs-builder assembler clone` to clone the documentation sets.
5+
If you cloned using a certain `--environment` you must also use that same `--environment` when building.
6+
:::
7+
8+
Builds all the documentation sets and assembles them into a complete documentation site ready to be deployed.
9+
10+
It uses [the site configuration files](../../configure/site/index.md) to direct how the documentation sets should be assembled.

docs/cli/assembler/cmd-clone.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Clones all repositories listed in the assembler configuration. Defaults to `$(pwd)/.artifacts/checkouts/{content_source}`.
2+
3+
The `content_source` is taken from the `--environment` option as configured in `assembly.yaml`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Sources the configuration from [the `config` folder on the `main` branch of `docs-builder`](https://github.com/elastic/docs-builder/tree/main/config).
2+
3+
By default, the configuration is placed in a platform-specific application support folder, which is the primary location for CI environments:
4+
5+
* **macOS:** `~/Library/Application Support/docs-builder`
6+
* **Linux:** `~/.config/docs-builder`
7+
* **Windows:** `%APPDATA%\docs-builder`
8+
9+
Use the `--local` flag to save the configuration in the current working directory instead. This is the recommended approach when building a local workspace for testing.
10+
11+
See [using a local workspace for assembler builds](../../assemble.md#using-a-local-workspace) for more information.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Description
2+
3+
Checks whether a repository at a specific branch or tag should be included in the next build. Emits the following `$GITHUB_OUTPUT` variables:
4+
5+
* `content-source-match` — whether the branch is a configured content source.
6+
* `content-source-next` — whether the branch is the next content source.
7+
* `content-source-current` — whether the branch is the current content source.
8+
* `content-source-speculative` — whether the branch is a speculative content source.
9+
10+
## Speculative builds
11+
12+
If branches follow semantic versioning and a branch is cut that is greater than the current version, it is considered a speculative build.
13+
`docs-builder`'s shared workflow triggers even if the branch is not yet specified as a content source in `assembler.yml`.
14+
15+
This allows a branch's `links.json` to be published to the Links Service ahead of time, before the branch is officially configured as a content source.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Applies an incremental synchronization plan created by [`docs-builder assembler deploy plan`](./plan.md).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Creates an incremental synchronization plan by comparing the remote `--s3-bucket-name` with the local output of the build.

docs/cli/assembler/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Assembler builds bring together all isolated documentation set builds and turn them into the overall documentation that gets published.
2+
3+
The quickest way to run an assembler build locally is:
4+
5+
```bash
6+
docs-builder assembler config init --local
7+
docs-builder assemble --serve
8+
```
9+
10+
This fetches the current configuration from the `main` branch of `docs-builder`, clones all content repositories, builds the unified site, and serves it at `http://localhost:4000`.

0 commit comments

Comments
 (0)