Skip to content

feat(kb): Add Kibana API support with generated command definitions#195

Merged
margaretjgu merged 5 commits into
mainfrom
poc
Apr 22, 2026
Merged

feat(kb): Add Kibana API support with generated command definitions#195
margaretjgu merged 5 commits into
mainfrom
poc

Conversation

@margaretjgu
Copy link
Copy Markdown
Contributor

@margaretjgu margaretjgu commented Apr 17, 2026

closes #72
autogenerated code from https://github.com/elastic/elastic-client-generator-js/pull/165

Summary

Adds the elastic kb command group for interacting with Kibana APIs. API definitions are auto-generated from the Kibana OpenAPI spec via the codegen in elastic-client-generator-js, following the same pattern as the existing ES and Cloud API commands.

  • KibanaClient (src/lib/kibana-client.ts): fetch-based HTTP client with API key and basic auth support, automatic kbn-xsrf header for mutating requests
  • Registration pipeline (src/kb/register.ts): dynamically builds Zod schemas and commander commands from declarative KbApiDefinition arrays (path/query/body params)
  • Request builder (src/kb/request-builder.ts): path interpolation, querystring assembly, body collection with cliFlag awareness
  • 48 generated API namespace files covering the full Kibana API surface (alerting, data views, fleet, security, spaces, SLO, etc.)
  • 20 unit tests for the KibanaClient (auth, headers, URL construction, body serialization, error handling, factory)

@margaretjgu margaretjgu marked this pull request as draft April 17, 2026 15:24
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 4.39s
✅ REPOSITORY gitleaks yes no no 58.05s
✅ REPOSITORY git_diff yes no no 0.09s
✅ REPOSITORY secretlint yes no no 2.65s
✅ REPOSITORY trivy yes no no 18.41s
✅ TYPESCRIPT eslint 57 0 0 4.98s

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

Made-with: Cursor

# Conflicts:
#	codegen/functional/generator.ts
@margaretjgu margaretjgu changed the title kibana api poc feat: kibana api poc Apr 21, 2026
@margaretjgu margaretjgu changed the title feat: kibana api poc feat(kb): Add Kibana API support with generated command definitions Apr 22, 2026
@margaretjgu margaretjgu marked this pull request as ready for review April 22, 2026 15:46
@margaretjgu margaretjgu merged commit adf5b45 into main Apr 22, 2026
16 of 17 checks passed
@margaretjgu margaretjgu deleted the poc branch April 22, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Kibana APIs

1 participant