From 2f72e8ade01e71a3fc274623f5c0fbcfccf7455c Mon Sep 17 00:00:00 2001 From: Ito Date: Thu, 26 Jun 2025 14:30:38 -0700 Subject: [PATCH 1/9] Activate Flare rerouting flag for agents, remove alternate entrypoint --- .../jetbrains-community/resources/META-INF/plugin-chat.xml | 5 ----- .../services/cwc/commands/GenerateUnitTestsAction.kt | 6 ------ .../mynah-ui/src/mynah-ui/ui/quickActions/handler.ts | 6 +++--- .../services/amazonq/lsp/model/ExtendedClientMetadata.kt | 2 ++ .../aws/toolkits/resources/MessagesBundle.properties | 2 -- 5 files changed, 5 insertions(+), 16 deletions(-) delete mode 100644 plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/GenerateUnitTestsAction.kt diff --git a/plugins/amazonq/chat/jetbrains-community/resources/META-INF/plugin-chat.xml b/plugins/amazonq/chat/jetbrains-community/resources/META-INF/plugin-chat.xml index 5d4e24f84be..a95078ca6bd 100644 --- a/plugins/amazonq/chat/jetbrains-community/resources/META-INF/plugin-chat.xml +++ b/plugins/amazonq/chat/jetbrains-community/resources/META-INF/plugin-chat.xml @@ -72,11 +72,6 @@ - - - - diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/GenerateUnitTestsAction.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/GenerateUnitTestsAction.kt deleted file mode 100644 index e48cbe4df3f..00000000000 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/GenerateUnitTestsAction.kt +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: Apache-2.0 - -package software.aws.toolkits.jetbrains.services.cwc.commands - -class GenerateUnitTestsAction : CustomAction(EditorContextCommand.GenerateUnitTests) diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/handler.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/handler.ts index b700b38ff6d..af67a9af06c 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/handler.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/handler.ts @@ -349,9 +349,9 @@ private handleDocCommand(chatPrompt: ChatPrompt, tabID: string, taskName: string * we have to manually create one if a testgen tab * wasn't previously created */ - if (!tabID) { - tabID = this.mynahUI?.updateStore('', {}) - } + // if (!tabID) { + // tabID = this.mynahUI?.updateStore('', {}) + // } const affectedTabId: string | undefined = this.addTab(tabID) // if there is no test tab, open a new one diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/ExtendedClientMetadata.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/ExtendedClientMetadata.kt index b304a3cff88..00ec1dd5baa 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/ExtendedClientMetadata.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/ExtendedClientMetadata.kt @@ -25,6 +25,7 @@ data class DeveloperProfiles( val developerProfiles: Boolean, val mcp: Boolean, val pinnedContextEnabled: Boolean, + val reroute: Boolean, ) data class WindowSettings( @@ -65,6 +66,7 @@ fun createExtendedClientMetadata(project: Project): ExtendedClientMetadata { developerProfiles = true, mcp = true, pinnedContextEnabled = true, + reroute = true, ), window = WindowSettings( showSaveFileDialog = true diff --git a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties index 7eaa9e89585..d2a76206db2 100644 --- a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties +++ b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties @@ -20,8 +20,6 @@ action.aws.toolkit.jetbrains.core.services.cwc.commands.ExplainCodeAction.descri action.aws.toolkit.jetbrains.core.services.cwc.commands.ExplainCodeAction.text=Explain Code action.aws.toolkit.jetbrains.core.services.cwc.commands.FixCodeAction.description=Fixes the selected code action.aws.toolkit.jetbrains.core.services.cwc.commands.FixCodeAction.text=Fix Code -action.aws.toolkit.jetbrains.core.services.cwc.commands.GenerateUnitTestsAction.description=Generates unit tests for the selected code -action.aws.toolkit.jetbrains.core.services.cwc.commands.GenerateUnitTestsAction.text=Generate Tests action.aws.toolkit.jetbrains.core.services.cwc.commands.OptimizeCodeAction.description=Optimizes the selected code action.aws.toolkit.jetbrains.core.services.cwc.commands.OptimizeCodeAction.text=Optimize Code action.aws.toolkit.jetbrains.core.services.cwc.commands.RefactorCodeAction.description=Refactors the selected code From 9b07e7d700024b291530f45ca223db22f3f0826b Mon Sep 17 00:00:00 2001 From: Ito Date: Fri, 27 Jun 2025 09:53:38 -0700 Subject: [PATCH 2/9] Remove headers --- .../src/mynah-ui/ui/quickActions/generator.ts | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts index 1033f29a8e1..35af48f8973 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts @@ -38,7 +38,6 @@ export class QuickActionGenerator { const quickActionCommands = [ { - groupName: `Q Developer Agent for Software Development`, commands: [ ...(this.isFeatureDevEnabled ? [ @@ -78,11 +77,6 @@ export class QuickActionGenerator { }, ] : []), - ], - }, - { - groupName: `Q Developer Agent for Code Transformation`, - commands:[ ...(this.isCodeTransformEnabled ? [ { @@ -93,22 +87,7 @@ export class QuickActionGenerator { ] : []), ], - }, - { - groupName: 'Quick Actions', - commands: [ - { - command: '/help', - icon: MynahIcons.HELP, - description: 'Learn more about Amazon Q', - }, - { - command: '/clear', - icon: MynahIcons.TRASH, - description: 'Clear this session', - }, - ], - }, + } ].filter((section) => section.commands.length > 0) const commandUnavailability: Record< From f166b751f6ad2464adda5ed4a4c6600736d9cad1 Mon Sep 17 00:00:00 2001 From: Ito Date: Mon, 30 Jun 2025 14:34:09 -0700 Subject: [PATCH 3/9] Add default chat option --- .../amazonq/lsp/flareChat/AwsServerCapabilitiesProvider.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/AwsServerCapabilitiesProvider.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/AwsServerCapabilitiesProvider.kt index 4055b8381a5..bae6b41c363 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/AwsServerCapabilitiesProvider.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/flareChat/AwsServerCapabilitiesProvider.kt @@ -34,7 +34,9 @@ class AwsServerCapabilitiesProvider { ), history = true, export = true, - mcpServers = true + mcpServers = true, + // Seems like this is the only way to bounce reroute back to the LSP? + reroute = true, ) } } @@ -48,6 +50,7 @@ data class ChatOptions( val history: Boolean, val export: Boolean, val mcpServers: Boolean, + val reroute: Boolean, ) data class QuickActions( From 4de41a648fc91a2e9bb6d6c49a2059c0b199a64e Mon Sep 17 00:00:00 2001 From: Ito Date: Mon, 30 Jun 2025 14:36:53 -0700 Subject: [PATCH 4/9] Fix manifest fetcher --- .../services/amazonq/lsp/artifacts/ManifestFetcher.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/artifacts/ManifestFetcher.kt b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/artifacts/ManifestFetcher.kt index aa6ca22538d..b6c3a6cf62c 100644 --- a/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/artifacts/ManifestFetcher.kt +++ b/plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/artifacts/ManifestFetcher.kt @@ -21,10 +21,7 @@ import software.aws.toolkits.jetbrains.core.getTextFromUrl import software.aws.toolkits.jetbrains.core.saveFileFromUrl import java.nio.file.Path -class ManifestFetcher( - private val lspManifestUrl: String = getManifestEndpoint(), - private val manifestPath: Path = DEFAULT_MANIFEST_PATH, -) { +class ManifestFetcher { companion object { private val mapper = jacksonObjectMapper().apply { configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) } private val logger = getLogger() @@ -41,6 +38,10 @@ class ManifestFetcher( .resolve("jetbrains-lsp-manifest.json") } + private val lspManifestUrl + get() = getManifestEndpoint() + private val manifestPath: Path = DEFAULT_MANIFEST_PATH + @get:VisibleForTesting internal val lspManifestFilePath: Path get() = manifestPath From 2378c2645e20de558d19e290cef7df524de2acaf Mon Sep 17 00:00:00 2001 From: Ito Date: Mon, 7 Jul 2025 20:30:12 -0700 Subject: [PATCH 5/9] changelog --- .../feature-c8e68d82-96e3-4043-9fd5-4fa97fc00fe6.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .changes/next-release/feature-c8e68d82-96e3-4043-9fd5-4fa97fc00fe6.json diff --git a/.changes/next-release/feature-c8e68d82-96e3-4043-9fd5-4fa97fc00fe6.json b/.changes/next-release/feature-c8e68d82-96e3-4043-9fd5-4fa97fc00fe6.json new file mode 100644 index 00000000000..b2ee7d735c9 --- /dev/null +++ b/.changes/next-release/feature-c8e68d82-96e3-4043-9fd5-4fa97fc00fe6.json @@ -0,0 +1,4 @@ +{ + "type" : "feature", + "description" : "Amazon Q /test, /doc, and /dev capabilities integrated into Agentic coding." +} \ No newline at end of file From 048f46489e4fcb9f50e0e28283cfd911c9eeb207 Mon Sep 17 00:00:00 2001 From: Ito Date: Tue, 8 Jul 2025 13:34:13 -0700 Subject: [PATCH 6/9] Restore generate test right click action --- .../jetbrains-community/resources/META-INF/plugin-chat.xml | 5 +++++ .../services/cwc/commands/GenerateUnitTestsAction.kt | 6 ++++++ .../aws/toolkits/resources/MessagesBundle.properties | 2 ++ 3 files changed, 13 insertions(+) create mode 100644 plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/GenerateUnitTestsAction.kt diff --git a/plugins/amazonq/chat/jetbrains-community/resources/META-INF/plugin-chat.xml b/plugins/amazonq/chat/jetbrains-community/resources/META-INF/plugin-chat.xml index a95078ca6bd..5d4e24f84be 100644 --- a/plugins/amazonq/chat/jetbrains-community/resources/META-INF/plugin-chat.xml +++ b/plugins/amazonq/chat/jetbrains-community/resources/META-INF/plugin-chat.xml @@ -72,6 +72,11 @@ + + + + diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/GenerateUnitTestsAction.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/GenerateUnitTestsAction.kt new file mode 100644 index 00000000000..e48cbe4df3f --- /dev/null +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/GenerateUnitTestsAction.kt @@ -0,0 +1,6 @@ +// Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 + +package software.aws.toolkits.jetbrains.services.cwc.commands + +class GenerateUnitTestsAction : CustomAction(EditorContextCommand.GenerateUnitTests) diff --git a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties index 61fbdf4a91a..46236427ae9 100644 --- a/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties +++ b/plugins/core/resources/resources/software/aws/toolkits/resources/MessagesBundle.properties @@ -20,6 +20,8 @@ action.aws.toolkit.jetbrains.core.services.cwc.commands.ExplainCodeAction.descri action.aws.toolkit.jetbrains.core.services.cwc.commands.ExplainCodeAction.text=Explain Code action.aws.toolkit.jetbrains.core.services.cwc.commands.FixCodeAction.description=Fixes the selected code action.aws.toolkit.jetbrains.core.services.cwc.commands.FixCodeAction.text=Fix Code +action.aws.toolkit.jetbrains.core.services.cwc.commands.GenerateUnitTestsAction.description=Generates unit tests for the selected code +action.aws.toolkit.jetbrains.core.services.cwc.commands.GenerateUnitTestsAction.text=Generate Tests action.aws.toolkit.jetbrains.core.services.cwc.commands.OptimizeCodeAction.description=Optimizes the selected code action.aws.toolkit.jetbrains.core.services.cwc.commands.OptimizeCodeAction.text=Optimize Code action.aws.toolkit.jetbrains.core.services.cwc.commands.RefactorCodeAction.description=Refactors the selected code From 4c57e65f230f28ad33ad6f62eee147455e387ba1 Mon Sep 17 00:00:00 2001 From: Ito Date: Tue, 8 Jul 2025 14:01:43 -0700 Subject: [PATCH 7/9] Fix right click --- .../services/cwc/commands/ActionRegistrar.kt | 32 ++++++++----------- .../src/mynah-ui/ui/quickActions/handler.ts | 9 +----- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt index e5e92f7544b..54b6202e8f3 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt @@ -28,25 +28,21 @@ class ActionRegistrar { val flow = _messages.asSharedFlow() fun reportMessageClick(command: EditorContextCommand, project: Project) { - if (command == EditorContextCommand.GenerateUnitTests) { - AsyncChatUiListener.notifyPartialMessageUpdate(project, Gson().toJson(TestCommandMessage())) - } else { - // new agentic chat route - ApplicationManager.getApplication().executeOnPooledThread { - runBlocking { - val contextExtractor = ActiveFileContextExtractor.create(fqnWebviewAdapter = null, project = project) - val fileContext = contextExtractor.extractContextForTrigger(ExtractionTriggerType.ContextMenu) - val codeSelection = "\n```\n${fileContext.focusAreaContext?.codeSelection?.trimIndent()?.trim()}\n```\n" - var uiMessage: FlareUiMessage? = null - if (command.verb != SEND_TO_PROMPT) { - val params = GenericCommandParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU, genericCommand = command.name) - uiMessage = FlareUiMessage(command = GENERIC_COMMAND, params = params) - } else { - val params = SendToPromptParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU) - uiMessage = FlareUiMessage(command = SEND_TO_PROMPT, params = params) - } - AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage) + // new agentic chat route + ApplicationManager.getApplication().executeOnPooledThread { + runBlocking { + val contextExtractor = ActiveFileContextExtractor.create(fqnWebviewAdapter = null, project = project) + val fileContext = contextExtractor.extractContextForTrigger(ExtractionTriggerType.ContextMenu) + val codeSelection = "\n```\n${fileContext.focusAreaContext?.codeSelection?.trimIndent()?.trim()}\n```\n" + var uiMessage: FlareUiMessage? = null + if (command.verb != SEND_TO_PROMPT) { + val params = GenericCommandParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU, genericCommand = command.name) + uiMessage = FlareUiMessage(command = GENERIC_COMMAND, params = params) + } else { + val params = SendToPromptParams(selection = codeSelection, triggerType = TriggerType.CONTEXT_MENU) + uiMessage = FlareUiMessage(command = SEND_TO_PROMPT, params = params) } + AsyncChatUiListener.notifyPartialMessageUpdate(project, uiMessage) } } } diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/handler.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/handler.ts index af67a9af06c..d8bb2048801 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/handler.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/handler.ts @@ -344,14 +344,7 @@ private handleDocCommand(chatPrompt: ChatPrompt, tabID: string, taskName: string this.connector.startTestGen(testTabId, realPromptText) return } - /** - * right click -> generate test has no tab id - * we have to manually create one if a testgen tab - * wasn't previously created - */ - // if (!tabID) { - // tabID = this.mynahUI?.updateStore('', {}) - // } + const affectedTabId: string | undefined = this.addTab(tabID) // if there is no test tab, open a new one From 7651f1004970e927fa8401bfa419b6eeb7d99e4e Mon Sep 17 00:00:00 2001 From: Ito Date: Tue, 8 Jul 2025 15:37:03 -0700 Subject: [PATCH 8/9] detekt --- .../jetbrains/services/cwc/commands/ActionRegistrar.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt index 54b6202e8f3..d8b80516410 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt @@ -3,13 +3,11 @@ @file:Suppress("BannedImports") package software.aws.toolkits.jetbrains.services.cwc.commands -import com.google.gson.Gson import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.Project import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.runBlocking -import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.AsyncChatUiListener import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.FlareUiMessage import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.GENERIC_COMMAND import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.GenericCommandParams @@ -17,7 +15,6 @@ import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SEND_ import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.SendToPromptParams import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.TriggerType import software.aws.toolkits.jetbrains.services.amazonq.messages.AmazonQMessage -import software.aws.toolkits.jetbrains.services.amazonqCodeTest.controller.TestCommandMessage import software.aws.toolkits.jetbrains.services.cwc.editor.context.ActiveFileContextExtractor import software.aws.toolkits.jetbrains.services.cwc.editor.context.ExtractionTriggerType From 1cbab40fe1cfea2b85cfd950be890e95b29e47d1 Mon Sep 17 00:00:00 2001 From: Ito Date: Tue, 8 Jul 2025 16:09:01 -0700 Subject: [PATCH 9/9] too much pruning --- .../toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt index d8b80516410..fe93c71f505 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/cwc/commands/ActionRegistrar.kt @@ -8,6 +8,7 @@ import com.intellij.openapi.project.Project import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.runBlocking +import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.AsyncChatUiListener import software.aws.toolkits.jetbrains.services.amazonq.lsp.flareChat.FlareUiMessage import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.GENERIC_COMMAND import software.aws.toolkits.jetbrains.services.amazonq.lsp.model.aws.chat.GenericCommandParams