Skip to content
Closed
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,4 @@
{
"type" : "bugfix",
"description" : "Amazon Q: Fixed quick action command list inconsistency between Q tabs"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type" : "bugfix",
"description" : "Amazon Q: Fixed cursor not focuses to prompt input when code is sent to Q Chat"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type" : "feature",
"description" : "Amazon Q: Added description and a new tab button when there is no tab open"
}
8 changes: 4 additions & 4 deletions plugins/amazonq/mynah-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/amazonq/mynah-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lintfix": "eslint -c .eslintrc.js --fix --ext .ts ."
},
"dependencies": {
"@aws/mynah-ui-chat": "npm:@aws/mynah-ui@4.4.2",
"@aws/mynah-ui-chat": "npm:@aws/mynah-ui@4.5.5",
"@types/node": "^14.18.5",
"fs-extra": "^10.0.1",
"ts-node": "^10.7.0",
Expand Down
112 changes: 75 additions & 37 deletions plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { QuickActionCommandGroup } from '@aws/mynah-ui-chat/dist/static'
import { QuickActionCommand, QuickActionCommandGroup } from '@aws/mynah-ui-chat/dist/static'
import { TabType } from '../storages/tabsStorage'

export interface QuickActionGeneratorProps {
Expand All @@ -21,51 +21,89 @@ export class QuickActionGenerator {
}

public generateForTab(tabType: TabType): QuickActionCommandGroup[] {
switch (tabType) {
case 'featuredev':
return []
default:
return [
...(this.isFeatureDevEnabled
? [
{
groupName: 'Application Development',
commands: [
{
command: '/dev',
placeholder: 'Briefly describe a task or issue',
description:
'Use all project files as context for code suggestions (increases latency).',
},
],
},
]
: []),
...(this.isCodeTransformEnabled
? [
{
commands: [
{
command: '/transform',
description: 'Transform your Java 8 or 11 Maven project to Java 17',
},
],
},
]
: []),
const quickActionCommands = [
...(this.isFeatureDevEnabled
? [
{
groupName: 'Application Development',
commands: [
{
command: '/help',
description: 'Learn more about Amazon Q',
command: '/dev',
placeholder: 'Briefly describe a task or issue',
description:
'Use all project files as context for code suggestions (increases latency).',
},
],
},
]
: []),
...(this.isCodeTransformEnabled
? [
{
commands: [
{
command: '/clear',
description: 'Clear this session',
command: '/transform',
description: 'Transform your Java 8 or 11 Maven project to Java 17',
},
],
},
]
: []),
{
commands: [
{
command: '/help',
description: 'Learn more about Amazon Q',
},
{
command: '/clear',
description: 'Clear this session',
},
],
},
]

const commandUnavailability: Record<
TabType,
{
description: string
unavailableItems: string[]
}
> = {
cwc: {
description: '',
unavailableItems: [],
},
featuredev: {
description: "This command isn't available in /dev",
unavailableItems: ['/dev', '/transform', '/help', '/clear'],
},
codetransform: {
description: "This command isn't available in /transform",
unavailableItems: ['/dev', '/transform'],
},
unknown: {
description: "",
unavailableItems: [],
},
}

return structuredClone(quickActionCommands).map(commandGroup => {
return {
groupName: commandGroup.groupName,
commands: commandGroup.commands.map((commandItem: QuickActionCommand) => {
const commandNotAvailable = commandUnavailability[tabType].unavailableItems.includes(
commandItem.command
)
return {
...commandItem,
disabled: commandNotAvailable,
description: commandNotAvailable
? commandUnavailability[tabType].description
: commandItem.description,
}
}) as QuickActionCommand[],
}
}) as QuickActionCommandGroup[]
}
}