Skip to content

feat(cli): support applies_to on cli: toc entries for generated pages#3663

Open
theletterf wants to merge 1 commit into
mainfrom
docs/cli-applies-to
Open

feat(cli): support applies_to on cli: toc entries for generated pages#3663
theletterf wants to merge 1 commit into
mainfrom
docs/cli-applies-to

Conversation

@theletterf

Copy link
Copy Markdown
Member

Summary

  • Adds a FallbackAppliesTo property to MarkdownFile used when a page has no YAML front matter
  • Extends CliReferenceRef with an AppliesTo field parsed from applies_to: in docset.yml
  • Threads the value through CliReferenceDocsBuilderExtensionCliCommandFile / CliNamespaceFile / CliRootFile constructors
  • Supplemental cmd-*.md / ns-*.md front matter is now prepended to generated markdown so per-command applies_to naturally overrides the fallback

Usage

In docset.yml (docset-level, all generated pages inherit):

- cli: cli/schema.json
  applies_to:
    stack: preview

In a supplemental cmd-version.md (per-command override):

---
applies_to:
  stack: ga
---

Test plan

  • All unit tests pass (./build.sh unit-test)
  • Assembler preview shows badges on generated CLI command pages once the consumer repo (elastic/cli) adds applies_to to its docset.yml — tracked in elastic/cli#TBD

🤖 Generated with Claude Code

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>
@theletterf

Copy link
Copy Markdown
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant