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 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..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 @@ -3,7 +3,6 @@ @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 @@ -17,7 +16,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 @@ -28,25 +26,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/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< 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..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 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( 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 604a80e9215..8168645d829 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 imageContextEnabled: Boolean, val reroute: Boolean, val workspaceFilePath: String?, ) @@ -67,6 +68,7 @@ fun createExtendedClientMetadata(project: Project): ExtendedClientMetadata { developerProfiles = true, mcp = true, pinnedContextEnabled = true, + imageContextEnabled = true, reroute = true, workspaceFilePath = project.workspaceFile?.path, ),