Skip to content

Add AI-powered documentation generation (core)#3302

Open
mjwolf wants to merge 24 commits intoelastic:mainfrom
mjwolf:doc_update_1
Open

Add AI-powered documentation generation (core)#3302
mjwolf wants to merge 24 commits intoelastic:mainfrom
mjwolf:doc_update_1

Conversation

@mjwolf
Copy link
Copy Markdown
Contributor

@mjwolf mjwolf commented Feb 24, 2026

Add the elastic-package update documentation command that uses an LLM (Gemini) to generate package documentation via a section-based generate-validate workflow.

Core components:

  • docagent: orchestrates documentation generation with per-section validation loops, response analysis, and section normalization
  • executor: ADK-based LLM executor with tool support
  • workflow: multi-agent pipeline (generator, critic, validators)
  • validators: static and LLM-based validators for structure, completeness, accuracy, accessibility, style, placeholders, URLs
  • parsing: markdown section parser and combiner
  • prompts: embedded prompt templates and section-specific instructions
  • tools: package file tools (list_directory, read_file, write_file, get_example, get_service_info)
  • postprocessor: data stream template and agentless section enforcement

Co-authored-by: Jonathan Molinatto <jonathan.molinatto@gmail.com>
Co-authored-by: Quan Nguyen <quan.nguyen@elastic.co>
Co-authored-by: Cursor <cursoragent@cursor.com>
@mjwolf mjwolf self-assigned this Feb 24, 2026
@mjwolf mjwolf requested a review from a team as a code owner February 24, 2026 02:15
@mjwolf mjwolf added enhancement New feature or request Team:Ecosystem Label for the Packages Ecosystem team labels Feb 24, 2026
Comment thread internal/llmagent/docagent/agents/critic.go
Comment thread internal/llmagent/docagent/agents/critic.go
Comment thread internal/llmagent/docagent/agents/registry.go
Comment thread internal/llmagent/docagent/prompts/_static/agent_instructions.md Outdated
Comment thread internal/llmagent/docagent/docagent.go
Comment thread internal/llmagent/docagent/docagent.go Outdated
Comment thread internal/llmagent/docagent/docagent.go Outdated
Comment thread internal/packages/archetype/_static/package-docs-readme.md.tmpl Outdated
Comment thread cmd/update.go Outdated
Comment thread internal/llmagent/docagent/workflow/workflow.go Outdated
mjwolf added 4 commits March 6, 2026 10:39
Add broader inclusive-language checks (disability-defining terms, gendered
job titles, execute/abort variants), Git conflict marker detection, and
new static style checks (banned words, latinisms, exclamation points,
ellipses, version terms, article misuse). Extend style-rule prompts with
wordiness, negation, and device-agnostic language guidance. Remove unused
parallel generation helpers and trim the readme template.

Made-with: Cursor
Move stylerules/ into prompts/ (now a dependency-free leaf package),
relocate sectioninstructions.go to docagent/ (its only consumer),
drop the _static/ subdirectory, compose AgentInstructions from
FullFormattingRules to eliminate duplication, and extract shared
validator JSON output suffix into prompts.ValidatorOutputSuffix.

Made-with: Cursor
@mjwolf mjwolf requested review from jrmolin and vinit-chauhan March 6, 2026 21:42
Comment thread internal/llmagent/docagent/agents/validators/stylevalidator.go Outdated
Comment thread internal/llmagent/docagent/prompts/stylerules.go Outdated
Comment thread internal/llmagent/docagent/agents/validators/urlvalidator.go
Comment thread internal/llmagent/docagent/promptsbuilder.go Outdated
Comment thread internal/llmagent/docagent/promptsbuilder.go Outdated
@mjwolf mjwolf requested a review from vinit-chauhan March 12, 2026 00:06
Copy link
Copy Markdown
Contributor

@vinit-chauhan vinit-chauhan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

Thanks for the work here!

Reviewing by now only the code out of internal/llmagent. Regarding the parts under cmd, I would try to keep them minimal, moving LLM specific parts to internal packages. Also, try to reuse existing helpers for documentation, in consistency with other commands.

Comment thread .github/CODEOWNERS
Comment thread cmd/updatedocumentation.go Outdated
Comment thread cmd/updatedocumentation.go Outdated
Comment thread cmd/updatedocumentation.go Outdated
Comment thread cmd/updatedocumentation.go Outdated
Comment thread internal/configuration/locations/locations.go Outdated
Comment thread internal/configuration/locations/locations.go Outdated
Comment thread internal/configuration/locations/locations.go Outdated
Comment thread README.md
Comment thread .gitignore Outdated
@jsoriano
Copy link
Copy Markdown
Member

jsoriano commented Apr 9, 2026

CI failures are not related, we have skipped them by now, you can update your branch to get green build.

Comment thread internal/llmagent/config/config.go
Comment thread internal/llmagent/docagent/workflow/workflow.go Outdated
@vinit-chauhan vinit-chauhan requested a review from jsoriano April 24, 2026 17:14
@jsoriano
Copy link
Copy Markdown
Member

jsoriano commented May 7, 2026

Hey, I think there is a pending comment to be addressed #3302 (comment), for the rest I think it could be merged. Thanks!

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @mjwolf @vinit-chauhan

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

Labels

enhancement New feature or request Team:Ecosystem Label for the Packages Ecosystem team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants