Skip to content

MTA-5378 Developer Lightspeed: Running an Analysis and Applying Fixes #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
:_newdoc-version: 2.18.3
:_template-generated: 2025-04-08

ifdef::context[:parent-context-of-run-dev-lightspeed-analysis: {context}]

:_mod-docs-content-type: ASSEMBLY

ifndef::context[]
[id="run-dev-lightspeed-analysis"]
endif::[]
ifdef::context[]
[id="run-dev-lightspeed-analysis_{context}"]
endif::[]
= Running an analysis and resolving issues

:context: run-dev-lightspeed-analysis

After you complete the configurations, the next step is running an analysis to identify the issues in the code and generate suggestions to address the issues. You can run an analysis by using {mta-dl-plugin} in the solution server mode or in the agent mode.

When you run an analysis using either mode, {mta-dl-plugin} automatically performs the following tasks:

* Displays issues in all the files in your project in the *Issues* pane.
* While generating suggestions to resolve issues, you can view the migration hints that explain the resolution and in which files the updates are applied.
* Generates new files in *Resolutions* pane. These files have the updates to the code that resolves the issues detected in the current analysis. You can review the changes, apply, or revert the updates.

If you apply all the resolutions, {mta-dl-plugin} applies the changes and triggers another analysis to check if there are more issues.

include::topics/developer-lightspeed/proc_running-rag-analysis.adoc[leveloffset=+1]

include::topics/developer-lightspeed/proc_apply-rag-resolution.adoc[leveloffset=+1]

include::topics/developer-lightspeed/proc_running-agent-analysis.adoc[leveloffset=+1]

ifdef::parent-context-of-run-dev-lightspeed-analysis[:context: {parent-context-of-run-dev-lightspeed-analysis}]
ifndef::parent-context-of-run-dev-lightspeed-analysis[:!context:]

1 change: 1 addition & 0 deletions assemblies/developer-lightspeed-guide/topics
1 change: 1 addition & 0 deletions docs/developer-lightspeed-guide/assemblies
11 changes: 11 additions & 0 deletions docs/developer-lightspeed-guide/master-docinfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<title>Developer Lightspeed Guide</title>
<productname>{DocInfoProductName}</productname>
<productnumber>{DocInfoProductNumber}</productnumber>
<subtitle>Using the {ProductName} Developer Lightspeed to modernize your applications</subtitle>
<abstract>
<para>you can use {ProductFullName} Developer Lightspeed for application modernization in your organization by running Artificial Intelligence-driven static code analysis for Java applications.</para>
</abstract>
<authorgroup>
<orgname>Red Hat Customer Content Services</orgname>
</authorgroup>
<xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
20 changes: 20 additions & 0 deletions docs/developer-lightspeed-guide/master.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
:mta:
include::topics/templates/document-attributes.adoc[]
:_mod-docs-content-type: ASSEMBLY
[id="mta-developer-lightspeed"]
= MTA Developer Lightspeed Guide

:toc:
:toclevels: 4
:numbered:
:imagesdir: topics/images
:context: mta-developer-lightspeed
:mta-developer-lightspeed:

//Inclusive language statement
include::topics/making-open-source-more-inclusive.adoc[]


include::assemblies/developer-lightspeed-guide/assembly_run-dev-lightspeed-analysis.adoc[leveloffset=+1]

:!mta-developer-lightspeed:
1 change: 1 addition & 0 deletions docs/developer-lightspeed-guide/topics
35 changes: 35 additions & 0 deletions docs/topics/developer-lightspeed/proc_apply-rag-resolution.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
:_newdoc-version: 2.15.0
:_template-generated: 2024-2-21
:_mod-docs-content-type: PROCEDURE

[id="apply-rag-resolution_{context}"]
= Applying resolutions after a solution server analysis

[role="_abstract"]

When you use {mta-dl-plugin} to find a solution for the issues in your code, you first get a migration hint about what needs to be fixed to resolve the issues and the corresponding updates to your code in newly generated files. You can review the changes to the code in the new files and apply the resolutions.

{mta-dl-plugin} then triggers another round of analysis to check if more issues must be fixed in the code.

.Prerequisites

* You installed the {ProductShortName} distribution version 8.0.0 in your system.
* You installed Jave 17+ and Maven 3.9.9+ in your system.
* You installed the {ProductFullName} extension version 8.0.0 in VS Code.
* You installed the latest version of Language Support for Java(TM) by Red Hat extension in Visual Studio (VS) Code.
* You opened a Java project in your VS Code workspace.
//check what's the alternative for Konveyor Analysis View in the d/s build.
* You configured a profile on the *Konveyor Analysis View* page and ran an analysis.

.Procedure

. Review the issues from the *Analysis results* space of the *Konveyor view analysis* page by the following tabs:
.. *All*: lists all incidents identified in your project.
.. *Files*: lists all the files in your project for which the analysis identified issues that must be resolved.
.. *Issues*: lists all issues across different files in your project.
. Use the *Category* drop down to filter issues based on the how crucial the fix is for the target migration. You can filter mandatory, potential, and optional issues.
. Click *Has Success Rate* to check how many times the same issue resolution was accepted in previous analysis.
. Click the solution tool to trigger automated updates to your code. If you applied any category filter, code updates are made for all incidents, specific files, or specific issues based on the filter.
{mta-dl-plugin} generates new files with the updated code.
. Review and (optionally) edit the code update in a *diff* or a *merge* view.
. Click *Apply all* in the *Resolutions* pane to permanently apply the changes to your code.
56 changes: 56 additions & 0 deletions docs/topics/developer-lightspeed/proc_running-agent-analysis.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:_newdoc-version: 2.15.0
:_template-generated: 2024-2-21
:_mod-docs-content-type: PROCEDURE

[id="running-agent-analysis_{context}"]
= Running an analysis in agent mode

[role="_abstract"]
In the agent mode, {mta-dl-plugin} planning agent creates the context about an issue and picks a sub agent that is most suited to resolve the issue. The sub agent runs an automated analysis to detect issues and generate files with the updated resolutions in one stream.

You can review the updated files and approve or reject the changes to the code. The agent runs another automated analysis to detect new issues in the code or diagnostic issues that your tool may generate following a previous analysis. If you allow the process to continue, {mta-dl-plugin} runs the stream again and generates a new files with the latest updates.

When using the agent mode, you can reject the changes or discontinue the stream but cannot edit the updated files during the stream.

.Prerequisites

* You installed the {ProductShortName} distribution version 8.0.0 in your system.
* You installed Jave 17+ and Maven 3.9.9+ in your system.
* You installed the {ProductFullName} extension version 8.0.0 in VS Code.
* You installed the latest version of Language Support for Java(TM) by Red Hat extension in Visual Studio (VS) Code.
* You opened a Java project in your VS Code workspace.
//check what's the alternative for Konveyor references in the d/s build.
* You configured an analysis profile on the *Konveyor Analysis View* page.

.Procedure

. Verify that agent mode is enabled in one of the following ways:
+
.. Type `Ctrl + Shift + P` in VS Code search (Linux/Windows system) and `Cmd + Shift + P` for Mac to go to the command palette.
.. Enter `Preferences: Open User Settings (JSON)` to open the `settings.json` file.
//check later to see how Konveyor and kai references are changed
.. Ensure that `konveyor.kai.agentMode` is set to `true`.
+
OR
+
.. Go to *Extensions > {mta-dl-plugin} > settings*
//check the settings to see how Kai:Agent Mode is changed
.. Click the *Agent Mode* option to enable the server.
+
. Click the {mta-dl-plugin} extension and click *Open Konveyor Analysis View*.
+
. Select a profile for the analysis.
+
. Click *Start* to start the {ProductShortName} RPC server.
+
. Click *Run Analysis* on the *Konveyor Analysis View* page.
The *Resolution Details* tab opens where you can view the automated analysis that makes changes in applicable files.
+
. Click *Review Changes* option to open the editor that shows the diff view of the modified file.
+
. Review the changes and click *Apply* to update the file with all the changes or *Reject* to reject all changes. If you applied the changes, then {mta-dl-plugin} creates the updated file with code changes.
+
. Open *Source Control* to access the updated file.
+
. In the *Resolution Details* view, accept the proposal from {mta-dl-plugin} to make further changes.
The stream of analysis repeats after which you can review and accept change. {mta-dl-plugin} creates the file with the code changes and the stream continues until you reject the proposal for further analysis.
44 changes: 44 additions & 0 deletions docs/topics/developer-lightspeed/proc_running-rag-analysis.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
:_newdoc-version: 2.15.0
:_template-generated: 2024-2-21
:_mod-docs-content-type: PROCEDURE

[id="running-rag-analysis_{context}"]
= Running an analysis by using solution server

[role="_abstract"]
Solution server uses Retrieval Augmented Generation (RAG) to generate a resolution based on a context. Solution server derives the context from rules and past changes to similar issues in the codebase of your organization and generates a prompt for your large language model (LLM). The LLM generates migration hints for the issues that it detects based on the contextual prompt.

An analysis completed by the solution server identifies the issues in the code. It displays the success metrics for incidents and issues. Success metrics indicate the confidence level in applying the code fix based on how many times the update was applied in past analysis.

.Prerequisites

* You installed the {ProductShortName} distribution version 8.0.0 in your system.
* You installed Jave 17+ and Maven 3.9.9+ in your system.
* You installed the {ProductFullName} extension version 8.0.0 in VS Code.
* You installed the latest version of Language Support for Java(TM) by Red Hat extension in Visual Studio (VS) Code.
* You opened a Java project in your VS Code workspace.
//check what's the alternative for Konveyor references in the d/s build.
* You configured an analysis profile on the *Konveyor Analysis View* page.

.Procedure

. Verify that solution server is enabled in one of the following ways:
+
.. Type `Ctrl + Shift + P` in VS Code search (Linux/Windows system) and `Cmd + Shift + P` for Mac to go to the command palette.
.. Enter `Preferences: Open User Settings (JSON)` to open the `settings.json` file.
.. Ensure that `konveyor.solutionServer.enabled` is set to `true`.
+
OR
+
.. Go to *Extensions > {mta-dl-plugin} > settings*
.. Click the *Solution Server:Enabled* option to enable the server.
+
. Click the {mta-dl-plugin} extension and click *Open Konveyor Analysis View*.
+
. Select a profile for the analysis.
+
. Click *Start* to start the {ProductShortName} RPC server.
+
. Click *Run Analysis* on the *Konveyor Analysis View* page.

To resolve the identified issues, see Applying resolutions after a solution server analysis.
1 change: 1 addition & 0 deletions docs/topics/templates/document-attributes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ifdef::mta[]
:WebConsoleBookName: {WebNameTitle} Guide
:ProductVersion: 7.3.1
:PluginName: MTA plugin
:mta-dl-plugin: MTA with Developer Lightspeed
// :MavenProductVersion: 7.0.0.GA-redhat-00001
:ProductDistributionVersion: 7.3.1.GA-redhat
:ProductDistribution: mta-7.3.1.GA-cli-offline.zip
Expand Down