feat(cli): support applies_to on cli: toc entries for generated pages#3663
Open
theletterf wants to merge 1 commit into
Open
feat(cli): support applies_to on cli: toc entries for generated pages#3663theletterf wants to merge 1 commit into
theletterf wants to merge 1 commit into
Conversation
Generated CLI pages (CliCommandFile, CliNamespaceFile, CliRootFile) have no YAML front matter, so they never rendered applies_to badges. Two mechanisms now fix this: 1. Docset-level fallback: the cli: entry in docset.yml can declare applies_to (stack/serverless/deployment). The value is parsed in TocItemYamlConverter and stored on CliReferenceRef.AppliesTo, then threaded through CliReferenceDocsBuilderExtension into every generated file via a new MarkdownFile.FallbackAppliesTo property that ProcessYamlFrontMatter uses when the page has no front matter. 2. Per-command override: supplemental cmd-*.md / ns-*.md files can include their own applies_to front matter. BuildMarkdown() in each generated file type now prepends the supplemental front matter so ProcessYamlFrontMatter sees it and naturally overrides the fallback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
Author
2 tasks
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
FallbackAppliesToproperty toMarkdownFileused when a page has no YAML front matterCliReferenceRefwith anAppliesTofield parsed fromapplies_to:indocset.ymlCliReferenceDocsBuilderExtension→CliCommandFile/CliNamespaceFile/CliRootFileconstructorscmd-*.md/ns-*.mdfront matter is now prepended to generated markdown so per-commandapplies_tonaturally overrides the fallbackUsage
In
docset.yml(docset-level, all generated pages inherit):In a supplemental
cmd-version.md(per-command override):Test plan
./build.sh unit-test)elastic/cli) addsapplies_toto itsdocset.yml— tracked in elastic/cli#TBD🤖 Generated with Claude Code