Skip to content

fix(plugin-docs-cli): limit doc page nesting to 3 #2646

Open
sunker wants to merge 2 commits into
mainfrom
docs-cli/max-nesting-depth
Open

fix(plugin-docs-cli): limit doc page nesting to 3 #2646
sunker wants to merge 2 commits into
mainfrom
docs-cli/max-nesting-depth

Conversation

@sunker
Copy link
Copy Markdown
Contributor

@sunker sunker commented May 22, 2026

What this PR does / why we need it:

Adds the FS-7 max nesting depth rule to @grafana/plugin-docs-cli with a limit of 3 levels (so a/b/page.md is fine but a/b/c/page.md is too deep). Reports info during serve and error under validate --strict.

We need a hard cap because the SidebarNav component on the marketing website only looks sensible up to a handful of nesting levels - past that the nav gets cramped and pages become hard to discover. Better to stop authors before they ship a structure the rendered nav can't handle than to paper over it in the website.

Which issue(s) this PR fixes:

Part of the docs validation epic.

Special notes for your reviewer:

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install website@5.6.1-canary.2646.26441606068.0
npm install @grafana/create-plugin@7.6.1-canary.2646.26441606068.0
npm install @grafana/plugin-docs-cli@0.0.11-canary.2646.26441606068.0
npm install @grafana/plugin-meta-extractor@0.12.3-canary.2646.26441606068.0
# or 
yarn add website@5.6.1-canary.2646.26441606068.0
yarn add @grafana/create-plugin@7.6.1-canary.2646.26441606068.0
yarn add @grafana/plugin-docs-cli@0.0.11-canary.2646.26441606068.0
yarn add @grafana/plugin-meta-extractor@0.12.3-canary.2646.26441606068.0

@sunker sunker moved this from 📬 Triage to 🧑‍💻 In development in Grafana Catalog Team May 22, 2026
@sunker sunker moved this from 🧑‍💻 In development to 🔬 In review in Grafana Catalog Team May 22, 2026
@sunker sunker self-assigned this May 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 22, 2026

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

✨ This PR can be merged and will trigger a new patch release.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

@sunker sunker added patch Increment the patch version when merged release Create a release when this pr is merged labels May 22, 2026
@sunker sunker marked this pull request as ready for review May 22, 2026 13:51
@sunker sunker requested a review from a team as a code owner May 22, 2026 13:51
@sunker sunker requested review from academo, Copilot, leventebalogh, mckn, s4kh and wbrowne and removed request for a team May 22, 2026 13:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new filesystem validation rule to @grafana/plugin-docs-cli to cap documentation page nesting depth at 3 path segments from the docs root, surfacing as info during serve (non-strict) and error during validate --strict.

Changes:

  • Introduces Rule.MaxNestingDepth in the validation rule registry.
  • Implements max-nesting-depth checking in the filesystem rule runner (checkFilesystem).
  • Adds unit tests covering compliant depth, strict/non-strict severities, and per-file reporting.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/plugin-docs-cli/src/validation/types.ts Adds the new max-nesting-depth rule identifier to the central Rule list.
packages/plugin-docs-cli/src/validation/rules/filesystem.ts Implements the nesting depth calculation and emits diagnostics based on strict.
packages/plugin-docs-cli/src/validation/rules/filesystem.test.ts Adds test coverage for depth limits and severity behavior.

Comment thread packages/plugin-docs-cli/src/validation/rules/filesystem.ts
@jackw jackw changed the title Plugin Docs CLI: Limit doc page nesting to 3 fix(plugin-docs-cli): limit doc page nesting to 3 May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Increment the patch version when merged release Create a release when this pr is merged

Projects

Status: 🔬 In review

Development

Successfully merging this pull request may close these issues.

2 participants