feat: add ability to explain terminal output with Duo Chat

Description

Adds the ability to explain selected terminal output in the VSCode integrated terminal.

A new context menu item will open Duo Chat, attach the selected terminal output as a context item, and submit an Explain this terminal output prompt.

Related Issues

Resolves #1907 (closed)

How has this been tested?

The implementation is only for the new Language Server based Duo Chat v2. So to test this feature you will need to enable this VSCode setting:

"gitlab.featureFlags.languageServerWebviews": true,

The feature also relies on updated Language Server (see blocking MRs) - these will need to be merged, with the LS updated in VSCode, before this feature will be available.

Finally, the feature is gated behind a new unit primitive / feature flag. Ensure your test user has a GitLab Duo Enterprise seat allocated, and enable the feature flag:

Feature.enable(:duo_include_context_terminal)

With all of the above done, the feature can be tested by:

  • opening the VSCode integrated terminal
  • running some terminal command so there is some output
  • selecting some output
  • right click in the terminal
  • select Explain with Duo
  • Duo Chat should now open, with the terminal selection attached, and submit an "Explain this output" message
  • clicking the attached context item should show the full terminal selection in the details modal
  • If src/browser or src/common has been modified, please consider interoperability with the Web IDE. See Running the Extension in WebIDE.
  • Consider an end-to-end test for significant new features that aren't covered by integration tests.

Screenshots (if appropriate)

(note the incorrect theme styles from duo-ui are not from this MR) gitlab-org/editor-extensions/gitlab-lsp!1578 (merged)

(note there is a bug when running Duo commands from IDE you may run into testing this MR) gitlab-org/editor-extensions/gitlab-lsp#953 (closed)

(note UI copy updated since these recordings/screenshots were taken)

explain-terminal-output

Additional screenshots
screenshot note
image When the FF is disabled or user does not have access
image When the feature is available
image Viewing attached terminal output in the UI
image /include menu not changed - new featur eonly available via IDE context menu

What CHANGELOG entry will this MR create?

  • fix: Bug fix fixes - a user-facing issue in production - included in changelog
  • feature: New feature - a user-facing change which adds functionality - included in changelog
  • BREAKING CHANGE: (fix or feature that would cause existing functionality to change) - should bump major version, mentioned in the changelog
  • None - other non-user-facing changes

Closes #1907 (closed)

Edited by Elwyn Benson

Merge request reports

Loading