[docs-utils] 3️⃣ New check docs CLI for improved DX#249305
[docs-utils] 3️⃣ New check docs CLI for improved DX#249305clintandrewhall merged 2 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/kibana-operations (Team:Operations) |
|
Pinging @elastic/appex-sharedux (Team:SharedUX) |
There was a problem hiding this comment.
Pull request overview
This PR introduces a new check_package_docs CLI that validates API documentation quality without generating output files, improving the developer experience by providing a clear separation between building and checking documentation.
Changes:
- Added new
check_package_docsCLI with--checkflag for validation-only runs - Refactored
findPluginsAPI to accept separatepluginFilterandpackageFilteroptions - Deprecated
--statsflag onbuild_api_docs, routing it to the newcheck_package_docsCLI
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/check_package_docs.js | Entry point for the new check CLI |
| packages/kbn-docs-utils/src/index.ts | Exports the new runCheckPackageDocsCli function |
| packages/kbn-docs-utils/src/check_package_docs_cli.ts | Core implementation of the validation-only CLI |
| packages/kbn-docs-utils/src/build_api_docs_cli.ts | Added deprecation handling to route --stats to check CLI |
| packages/kbn-docs-utils/src/find_plugins.ts | Refactored to accept separate plugin and package filter options |
| packages/kbn-docs-utils/src/cli/types.ts | Added check and package flag types |
| packages/kbn-docs-utils/src/cli/parse_cli_flags.ts | Enhanced flag parsing to support --check and --package |
| packages/kbn-docs-utils/src/cli/tasks/setup_project.ts | Updated to use new filter options structure |
| packages/kbn-docs-utils/src/utils.ts | Improved missing API items logging message |
| packages/kbn-docs-utils/src/README.md | Added documentation for the new check CLI |
| Test files | Comprehensive unit and integration tests for new functionality |
|
|
||
| const startApm = () => { | ||
| if (!apm.isStarted()) { | ||
| initApm(process.argv, rootDir, false, 'check_package_docs_cli'); |
There was a problem hiding this comment.
@jbudz I've split the build_package_docs_cli that included checking docs into two initApm calls. So we should see build_ fall and check_ rise, theoretically.
Is there anything I need to do to enable this change? Is this ok? Wanted a sanity check, given where my meta PR took APM logs last week.
kowalczyk-krzysztof
left a comment
There was a problem hiding this comment.
Approving SharedUX changes but I'm wondering if getPlugin really needs to exist? The only usage is in checkDependencies and aside from getting a plugin, all it does is adds logging which you do anyway in checkDependencies.
|
@kowalczyk-krzysztof I remember I split it out for a reason; it's likely for a later phase of the meta PR. I'm AFK, but I'll confirm. |
- created new CLI for checking package/plugin documentation - clarifies the DX of building docs vs checking docs - Added --check (any|comments|exports|all) support, plugin/package aliases, and kept --stats delegation with deprecation handling for build and check CLIs; guarded APM init to prevent double-start. - Expanded coverage with CLI flow tests for build and check paths, including stats delegation and validation exit codes.
@kbn/docs-utils: 298 tests passing (100%) Coverage: 93.82% lines, 93.11% statements, 91.95% functions, 88.81% branches
e320d45 to
afb287a
Compare
mistic
left a comment
There was a problem hiding this comment.
LGTM. We just need to update the CI jobs for build_api_docs where check was intended before in another PR but the OPS team can do that. Created https://github.com/elastic/kibana-operations/issues/417
|
Thanks @mistic ! Phase 4 PRs incoming tomorrow. |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Public APIs missing exports
History
|
Summary
This PR introduces a new
check_package_docsCLI that improves the developer experience for validating plugin and package documentation. The new CLI provides a clear separation between building API documentation and checking documentation quality without writing output files.Note
This PR is a subset of #247688 for ease of review.
This PR was written with Cursor and
claude-4.5-opus-high.Key Changes
New CLI:
node scripts/check_package_docs--check <any|comments|exports|all>flag to specify validation checks--checkflags to combine checks (e.g.,--check any --check comments)--pluginand--packageflags for filtering by IDImproved
findPluginsAPIpluginFilterandpackageFilteroptionsplugin.id(for plugins) and package ID (for packages like@kbn/core)Deprecation Handling
--statsflag onbuild_api_docsis now deprecated--statsis used, it automatically routes to the newcheck_package_docsCLI with a warningTechnical Improvements
buildandcheckCLI flowsUsage
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.Release Note
New
check_package_docsCLI for validating plugin and package API documentation. The--statsflag onbuild_api_docsis deprecated in favor of this new dedicated validation command.Identify risks
Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.
--statsflag now routes to a different CLI. Existing scripts using--statswill continue to work but with a deprecation warning. No functionality is removed.findPluginsfunction signature changed from accepting a single array to an options object. This is an internal API used only withinkbn-docs-utils.