diff --git a/.changes/next-release/bugfix-0150eb94-2d05-40f5-8473-b2ee1fd6bf09.json b/.changes/next-release/bugfix-0150eb94-2d05-40f5-8473-b2ee1fd6bf09.json new file mode 100644 index 00000000000..115fff1572c --- /dev/null +++ b/.changes/next-release/bugfix-0150eb94-2d05-40f5-8473-b2ee1fd6bf09.json @@ -0,0 +1,4 @@ +{ + "type" : "bugfix", + "description" : "Amazon Q chat: `@workspace` command shown in all tab types" +} \ No newline at end of file diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/commands.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/commands.ts index 20ad900e1e8..0503e044b7b 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/commands.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/commands.ts @@ -2,6 +2,7 @@ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ +import { QuickActionCommandGroup } from "@aws/mynah-ui-chat" type MessageCommand = | 'chat-prompt' @@ -47,3 +48,13 @@ type MessageCommand = | 'store-code-result-message-id' export type ExtensionMessage = Record & { command: MessageCommand } + +export const workspaceCommand: QuickActionCommandGroup = { + groupName: 'Mention code', + commands: [ + { + command: '@workspace', + description: '(BETA) Reference all code in workspace.', + }, + ], +} \ No newline at end of file diff --git a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts index 3f93322b918..ea6e1e6d307 100644 --- a/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts +++ b/plugins/amazonq/mynah-ui/src/mynah-ui/ui/tabs/generator.ts @@ -3,10 +3,11 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { ChatItemType, MynahUIDataModel } from '@aws/mynah-ui-chat' +import { ChatItemType, MynahUIDataModel, QuickActionCommandGroup } from '@aws/mynah-ui-chat' import { TabType } from '../storages/tabsStorage' import { FollowUpGenerator } from '../followUps/generator' import { QuickActionGenerator } from '../quickActions/generator' +import { workspaceCommand } from '../commands' export interface TabDataGeneratorProps { isFeatureDevEnabled: boolean @@ -60,6 +61,10 @@ I can help you upgrade your Java 8 and 11 codebases to Java 17. ], ]) + private tabContextCommand: Map = new Map([ + ['cwc', [workspaceCommand]], + ]) + constructor(props: TabDataGeneratorProps) { this.followUpsGenerator = new FollowUpGenerator() this.quickActionsGenerator = new QuickActionGenerator({ @@ -75,17 +80,7 @@ I can help you upgrade your Java 8 and 11 codebases to Java 17. 'Amazon Q Developer uses generative AI. You may need to verify responses. See the [AWS Responsible AI Policy](https://aws.amazon.com/machine-learning/responsible-ai/policy/).', quickActionCommands: this.quickActionsGenerator.generateForTab(tabType), promptInputPlaceholder: this.tabInputPlaceholder.get(tabType), - contextCommands: [ - { - groupName: 'Mention code', - commands: [ - { - command: '@workspace', - description: '(BETA) Reference all code in workspace.', - }, - ], - }, - ], + contextCommands: this.tabContextCommand.get(tabType), chatItems: needWelcomeMessages ? [ {