You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce a new `elastic-package update documentation` command that leverages
LLM providers to automatically generate and update package documentation.
Key features:
- Two operation modes:
* Rewrite mode: Full documentation regeneration from package structure
* Modify mode: Targeted changes to existing documentation
- Multi-file support: Update any markdown file in _dev/build/docs/
- Interactive and non-interactive workflows
- Provider flexibility: Support for Gemini API and local LLM servers
Implementation details:
- Add new LLM framework in internal/llmagent/ with:
* Provider abstraction for different LLM backends
* Documentation agent with package analysis tools
* MCP (Model Context Protocol) tools integration
* Interactive UI with browser-based markdown preview
- Configuration via environment variables or profile config
- Graceful degradation: Show manual update instructions when no provider configured
Command flags:
- --non-interactive: Skip prompts and auto-accept first result
- --modify-prompt: Specify targeted modification instructions
- --doc-file: Select specific markdown file to update
This enables maintainers to quickly generate comprehensive, template-compliant
documentation by analyzing package structure, data streams, and configuration.
Co-Authored-By: Jonathan Molinatto <[email protected]>
Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
@@ -690,6 +737,101 @@ The following settings are available per profile:
690
737
Currently, it is supported "basic" and "[trial](https://www.elastic.co/guide/en/elasticsearch/reference/current/start-trial.html)",
691
738
which enables all subscription features for 30 days. Defaults to "trial".
692
739
740
+
### AI-powered Documentation Configuration
741
+
742
+
The `elastic-package update documentation` command supports AI-powered documentation generation using various LLM providers.
743
+
744
+
**⚠️ IMPORTANT PRIVACY NOTICE:**
745
+
When using AI-powered documentation generation, **file content from your local file system within the package directory may be sent to the configured LLM provider**. This includes manifest files, configuration files, field definitions, and other package content. The generated documentation **must be reviewed for accuracy and correctness** before being finalized, as LLMs may occasionally produce incorrect or hallucinated information.
746
+
747
+
#### Operation Modes
748
+
749
+
The command supports two modes of operation:
750
+
751
+
1.**Rewrite Mode** (default): Full documentation regeneration
752
+
- Analyzes your package structure, data streams, and configuration
753
+
- Generates comprehensive documentation following Elastic's templates
754
+
- Creates or updates the README.md file in `/_dev/build/docs/`
755
+
756
+
2.**Modify Mode**: Targeted documentation changes
757
+
- Makes specific changes to existing documentation
758
+
- Requires existing README.md file at `/_dev/build/docs/README.md`
759
+
- Use `--modify-prompt` flag for non-interactive modifications
760
+
761
+
#### Workflow Options
762
+
763
+
**Interactive Mode** (default):
764
+
The command will guide you through the process, allowing you to:
765
+
- Choose between rewrite or modify mode
766
+
- Review generated documentation
767
+
- Request iterative changes
768
+
- Accept or cancel the update
769
+
770
+
**Non-Interactive Mode**:
771
+
Use `--non-interactive` to skip all prompts and automatically accept the first result.
772
+
Combine with `--modify-prompt "instructions"` for targeted non-interactive changes.
773
+
774
+
If no LLM provider is configured, the command will print manual instructions for updating documentation.
775
+
776
+
#### LLM Provider Configuration
777
+
778
+
You can configure LLM providers through **profile settings** (in `~/.elastic-package/profiles/<profile>/config.yml`) as an alternative to environment variables:
779
+
780
+
*`llm.gemini.api_key`: API key for Google Gemini LLM services
781
+
*`llm.gemini.model`: Gemini model ID (defaults to `gemini-2.5-pro`)
782
+
*`llm.local.endpoint`: Endpoint URL for local OpenAI-compatible LLM servers
783
+
*`llm.local.model`: Model name for local LLM servers (defaults to `llama2`)
784
+
*`llm.local.api_key`: API key for local LLM servers (optional, if authentication is required)
785
+
*`llm.external_prompts`: Enable loading custom prompt files from profile or data directory (defaults to `false`)
786
+
787
+
Environment variables (e.g., `GEMINI_API_KEY`, `LOCAL_LLM_ENDPOINT`) take precedence over profile configuration.
elastic-package update documentation --modify-prompt "Add more details about authentication configuration"
804
+
805
+
# Use specific profile with LLM configuration
806
+
elastic-package update documentation --profile production
807
+
```
808
+
809
+
#### Advanced Features
810
+
811
+
**Preserving Human-Edited Content:**
812
+
813
+
Manually edited sections can be preserved by wrapping them with HTML comment markers:
814
+
815
+
```html
816
+
<!-- PRESERVE START -->
817
+
Important manual content to preserve
818
+
<!-- PRESERVE END -->
819
+
```
820
+
821
+
Any content between these markers will be preserved exactly as-is during AI-generated documentation updates. The system will automatically validate preservation after generation and warn if marked content was modified or removed.
822
+
823
+
**Service Knowledge Base:**
824
+
825
+
Place a `docs/knowledge_base/service_info.md` file in your package to provide authoritative service information. This file is treated as the source of truth and takes precedence over web search results during documentation generation.
826
+
827
+
**Custom Prompts:**
828
+
829
+
Enable `llm.external_prompts` in your profile config to use custom prompt files. Place them in:
0 commit comments