Skip to content

feat(create-plugin): add docs codemod - #2834

Draft
sunker wants to merge 16 commits into
mainfrom
eriksundell/panel-docs-codemod
Draft

sunker wants to merge 16 commits into
mainfrom
eriksundell/panel-docs-codemod

Conversation

@sunker

@sunker sunker commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds create-plugin add docs, which scaffolds multi-page documentation for a plugin and wires it up for publishing.

It reads the plugin type from plugin.json and copies the matching templates from templates/docs/<type>/ plus the shared templates/docs/common/. Only panel is supported so far - app and datasource get a clear "not supported yet" error rather than a broken scaffold.

What lands in the plugin:

  • five stub pages under docs/, each section carrying a note saying what belongs there, plus a README explaining the four catalog tabs and what sources each
  • docsPath in plugin.json, docs:serve and docs:validate scripts, a validate-docs.yml workflow and a build-plugin version bump
  • AI authoring assistance, on by default: an always-loaded guide at .config/AGENTS/plugin-docs.md and a bootstrap-plugin-docs skill written to .claude/, .agents/ and .codex/

A freshly scaffolded folder validates clean. Unfilled stubs are reported as notes rather than errors, so CI is green from the first commit while still checking links, frontmatter and images. They do block publishing, which matters because the <!-- section-brief --> marker is stripped when the page renders but the "📝 Fill this in" text is not - a forgotten stub would ship to the catalog verbatim.

Re-running is additive: existing files are never overwritten, so a plugin can pick up updated agent files after a create-plugin bump.

Which issue(s) this PR fixes:

N/A

Special notes for your reviewer:

The docs:validate script passes --allow-unfilled-stubs, added in #2864. Older CLIs ignore the unknown flag and report stubs as errors, so nothing breaks before it releases - but the @grafana/plugin-docs-cli pin needs bumping once it does.

Supersedes #2843, now closed. AI assistance is part of this PR rather than a separate opt-in layer.

@grafana-catalog-project-bot grafana-catalog-project-bot Bot moved this from 📬 Triage to 🧑‍💻 In development in Grafana Catalog Team Aug 19, 2026
Base automatically changed from eriksundell/plugin-docs-cli-meta-files to main August 20, 2026 10:09
@sunker
sunker force-pushed the eriksundell/panel-docs-codemod branch from b985289 to bdd44bc Compare August 20, 2026 10:31
@sunker sunker added the preview Opts the PR into pkg.pr.new preview publishing label Aug 20, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

@grafana/create-plugin

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/create-plugin@ce6b3d7 -D

@grafana/eslint-config

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/eslint-config@ce6b3d7 -D

@grafana/eslint-plugin-plugins

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/eslint-plugin-plugins@ce6b3d7 -D

@grafana/plugin-docs-cli

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/plugin-docs-cli@ce6b3d7 -D

@grafana/plugin-docs-parser

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/plugin-docs-parser@ce6b3d7 -D

@grafana/plugin-e2e

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/plugin-e2e@ce6b3d7 -D

@grafana/plugin-meta-extractor

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/plugin-meta-extractor@ce6b3d7 -D

@grafana/plugin-types-bundler

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/plugin-types-bundler@ce6b3d7 -D

@grafana/react-detect

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/react-detect@ce6b3d7 -D

@grafana/sign-plugin

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/sign-plugin@ce6b3d7 -D

@grafana/tsconfig

npm i https://pkg.pr.new/grafana/plugin-tools/@grafana/tsconfig@ce6b3d7 -D

commit: ce6b3d7

…odemod

0.2.1 is now published and includes the repo-meta-file exclusion and
inline-code-masking fixes that 0.2.0 predates.
index.md scaffolded an Overview page with Introduction/Features/Requirements,
duplicating what the plugin's real README already covers on the Overview tab.
It's now a curated router for the Documentation tab instead: orientation,
recommended reading path, task-oriented links. Also makes clear Installation
and Changelog are catalog-generated, not authored under docs/.
@sunker
sunker force-pushed the eriksundell/panel-docs-codemod branch from e4d428c to 4610f1d Compare September 9, 2026 12:17
@sunker sunker changed the title feat(create-plugin): add panel-docs codemod feat(create-plugin): add docs codemod Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Opts the PR into pkg.pr.new preview publishing

Projects

Status: 🧑‍💻 In development

Development

Successfully merging this pull request may close these issues.

1 participant