Add interactive mode to AI documentation generation#3554
Open
vinit-chauhan wants to merge 3 commits into
Open
Conversation
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>
Propagate errors from restoreOriginalReadme through ActionResult so cancellation paths surface failures instead of silently dropping them. Resolves errcheck lint findings introduced when adapting the interactive mode to the new core docagent structure that landed in main. Co-authored-by: Cursor <cursoragent@cursor.com>
Collaborator
💛 Build succeeded, but was flaky
Failed CI Steps
History |
jsoriano
reviewed
May 15, 2026
Member
jsoriano
left a comment
There was a problem hiding this comment.
Reviewed changes in cmd and internal/tui.
| model := newTextComponentModel(component) | ||
| program := tea.NewProgram(model) | ||
|
|
||
| finalModel, err := program.Run() |
Member
There was a problem hiding this comment.
Nit. Methods that run TUI programs should be in runner.go, this file should only contain the new component.
| } | ||
|
|
||
| // AskTextArea runs a text area dialog for multi-line input | ||
| func AskTextArea(message string) (string, error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extend the
elastic-package update documentationcommand with an interactive review mode, a browser-based preview of the generated docs, and a multi-file selection prompt. Also drop the AI-assisted disclaimer from the generated README.By default, the command now runs in interactive mode; pass
--non-interactiveto keep the previous fire-and-forget behavior (used in CI and scripted runs).Core changes:
cmd/update: add--non-interactiveflag and thread it throughhandleStandardModeandselectDocumentationFile. Default is interactive.docagent: after generation, runrunInteractiveSectionReviewwhich renders the README, prompts the user to Accept or Cancel, and on cancel restores the original README. If the model never produced a README, prompt to Try again (with a revision prompt) or Exit.docagent/interactive.go+interactive_test.go: new file containing the interactive action loop (getUserAction,displayReadme,handleReadmeUpdate,handleUserAction,handleAcceptAction) with unit tests for the README-update detection logic.cmd/updatedocumentation: when multiple.mdfiles exist under_dev/build/docs, prompt the user to pick one in interactive mode instead of silently defaulting toREADME.md.llmagent/ui(new package):TryBrowserPreviewconverts the rendered markdown to HTML usinggomarkdown, writes it to a temp file, and opens it in the system browser (open/xdg-open/start). Includes an embedded_static/preview_template.htmlGitHub-style stylesheet with light and dark mode support.internal/tui/textcomponent.go(new): unified Bubble TeaTextComponentsupporting both a scrollableViewMode(used as the terminal fallback when no browser is available, viaShowContent) and anEditModetext area (AskTextArea) for future multi-line input. Mouse and alternate-screen support enabled.parsing/combiner.go+validators/structurevalidator_test.go: drop the disclaimer fromCombineSectionsWithTitleandEnsureDocumentTitle, and update the structure-validator test fixture to match.README.md: update theupdate documentationcommand docs to describe the interactive file-selection behavior alongside--doc-file.