Skip to content
Merged
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
26 changes: 1 addition & 25 deletions packages/amazonq/src/app/amazonqScan/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,14 @@
*/

import * as vscode from 'vscode'
import {
AmazonQAppInitContext,
MessagePublisher,
MessageListener,
focusAmazonQPanel,
DefaultAmazonQAppInitContext,
} from 'aws-core-vscode/amazonq'
import { AmazonQAppInitContext, MessageListener } from 'aws-core-vscode/amazonq'
import { AuthUtil, codeScanState, onDemandFileScanState } from 'aws-core-vscode/codewhisperer'
import { ScanChatControllerEventEmitters, ChatSessionManager } from 'aws-core-vscode/amazonqScan'
import { ScanController } from './chat/controller/controller'
import { AppToWebViewMessageDispatcher } from './chat/views/connector/connector'
import { Messenger } from './chat/controller/messenger/messenger'
import { UIMessageListener } from './chat/views/actions/uiMessageListener'
import { debounce } from 'lodash'
import { Commands, placeholder } from 'aws-core-vscode/shared'
import { codeReviewInChat } from './models/constants'

export function init(appContext: AmazonQAppInitContext) {
const scanChatControllerEventEmitters: ScanChatControllerEventEmitters = {
Expand Down Expand Up @@ -50,8 +42,6 @@ export function init(appContext: AmazonQAppInitContext) {
webViewMessageListener: new MessageListener<any>(scanChatUIInputEventEmitter),
})

appContext.registerWebViewToAppMessagePublisher(new MessagePublisher<any>(scanChatUIInputEventEmitter), 'review')

const debouncedEvent = debounce(async () => {
const authenticated = (await AuthUtil.instance.getChatAuthState()).amazonQ === 'connected'
let authenticatingSessionID = ''
Expand All @@ -75,20 +65,6 @@ export function init(appContext: AmazonQAppInitContext) {
return debouncedEvent()
})

if (!codeReviewInChat) {
Commands.register('aws.amazonq.security.scan-statusbar', async () => {
if (AuthUtil.instance.isConnectionExpired()) {
await AuthUtil.instance.notifyReauthenticate()
}
return focusAmazonQPanel.execute(placeholder, 'amazonq.security.scan').then(() => {
DefaultAmazonQAppInitContext.instance.getAppsToWebViewMessagePublisher().publish({
sender: 'amazonqCore',
command: 'review',
})
})
})
}

codeScanState.setChatControllers(scanChatControllerEventEmitters)
onDemandFileScanState.setChatControllers(scanChatControllerEventEmitters)
}
1 change: 0 additions & 1 deletion packages/amazonq/src/app/chat/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export async function activate(context: ExtensionContext) {
context.subscriptions.push(
amazonq.focusAmazonQChatWalkthrough.register(),
amazonq.walkthroughInlineSuggestionsExample.register(),
amazonq.walkthroughSecurityScanExample.register(),
amazonq.openAmazonQWalkthrough.register(),
amazonq.listCodeWhispererCommandsWalkthrough.register(),
amazonq.focusAmazonQPanel.register(),
Expand Down
6 changes: 0 additions & 6 deletions packages/amazonq/src/lsp/chat/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { CodeScanIssue, AuthUtil } from 'aws-core-vscode/codewhisperer'
import { getLogger } from 'aws-core-vscode/shared'
import * as vscode from 'vscode'
import * as path from 'path'
import { codeReviewInChat } from '../../app/amazonqScan/models/constants'
import { telemetry, AmazonqCodeReviewTool } from 'aws-core-vscode/telemetry'

/**
Expand Down Expand Up @@ -68,11 +67,6 @@ export function registerCommands(provider: AmazonQChatViewProvider) {
registerShellCommandShortCut('aws.amazonq.rejectCmdExecution', 'reject-shell-command', provider),
registerShellCommandShortCut('aws.amazonq.stopCmdExecution', 'stop-shell-command', provider)
)
if (codeReviewInChat) {
globals.context.subscriptions.push(
registerGenericCommand('aws.amazonq.security.scan-statusbar', 'Review', provider)
)
}
}

async function handleIssueCommand(
Expand Down
2 changes: 0 additions & 2 deletions packages/core/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@
"AWS.command.amazonq.optimizeCode": "Optimize",
"AWS.command.amazonq.sendToPrompt": "Send to prompt",
"AWS.command.amazonq.generateUnitTests": "Generate Tests",
"AWS.command.amazonq.security.scan": "Run Project Review",
"AWS.command.amazonq.security.fileScan": "Run File Review",
"AWS.command.amazonq.generateFix": "Fix",
"AWS.command.amazonq.viewDetails": "View Details",
"AWS.command.amazonq.explainIssue": "Explain",
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/amazonq/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export {
focusAmazonQChatWalkthrough,
openAmazonQWalkthrough,
walkthroughInlineSuggestionsExample,
walkthroughSecurityScanExample,
} from './onboardingPage/walkthrough'
export { api } from './extApi'
export { AmazonQChatViewProvider } from './webview/webView'
Expand Down
9 changes: 0 additions & 9 deletions packages/core/src/amazonq/onboardingPage/walkthrough.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { focusAmazonQPanel } from '../../codewhispererChat/commands/registerComm
import globals, { isWeb } from '../../shared/extensionGlobals'
import { VSCODE_EXTENSION_ID } from '../../shared/extensions'
import { getLogger } from '../../shared/logger/logger'
import { localize } from '../../shared/utilities/vsCodeUtils'
import { Commands, placeholder } from '../../shared/vscode/commands2'
import vscode from 'vscode'

Expand Down Expand Up @@ -66,11 +65,3 @@ fake_users = [
})
}
)

export const walkthroughSecurityScanExample = Commands.declare(
`_aws.amazonq.walkthrough.securityScanExample`,
() => async () => {
const filterText = localize('AWS.command.amazonq.security.scan', 'Run Project Review')
void vscode.commands.executeCommand('workbench.action.quickOpen', `> ${filterText}`)
}
)
41 changes: 0 additions & 41 deletions packages/core/src/amazonq/webview/ui/quickActions/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,17 @@ export interface QuickActionGeneratorProps {

export class QuickActionGenerator {
private isGumbyEnabled: boolean
private isScanEnabled: boolean
private disabledCommands: string[]

constructor(props: QuickActionGeneratorProps) {
this.isGumbyEnabled = props.isGumbyEnabled
this.isScanEnabled = props.isScanEnabled
this.disabledCommands = props.disableCommands ?? []
}

public generateForTab(tabType: TabType): QuickActionCommandGroup[] {
// TODO: Update acc to UX
const quickActionCommands = [
{
commands: [
...(!this.disabledCommands.includes('/dev')
? [
{
command: '/dev',
icon: MynahIcons.CODE_BLOCK,
placeholder: 'Describe your task or issue in as much detail as possible',
description: 'Generate code to make a change in your project',
},
]
: []),
...(!this.disabledCommands.includes('/test')
? [
{
command: '/test',
icon: MynahIcons.CHECK_LIST,
placeholder: 'Specify a function(s) in the current file (optional)',
description: 'Generate unit tests for selected code',
},
]
: []),
...(this.isScanEnabled && !this.disabledCommands.includes('/review')
? [
{
command: '/review',
icon: MynahIcons.BUG,
description: 'Identify and fix code issues before committing',
},
]
: []),
...(!this.disabledCommands.includes('/doc')
? [
{
command: '/doc',
icon: MynahIcons.FILE,
description: 'Generate documentation',
},
]
: []),
...(this.isGumbyEnabled && !this.disabledCommands.includes('/transform')
? [
{
Expand Down
21 changes: 1 addition & 20 deletions packages/core/src/codewhisperer/ui/codeWhispererNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
selectRegionProfileCommand,
} from '../commands/basicCommands'
import { CodeWhispererCommandDeclarations } from '../commands/gettingStartedPageCommands'
import { CodeScansState, codeScanState, RegionProfile } from '../models/model'
import { CodeScansState, RegionProfile } from '../models/model'
import { getNewCustomizationsAvailable, getSelectedCustomization } from '../util/customizationUtil'
import { cwQuickPickSource } from '../commands/types'
import { AuthUtil } from '../util/authUtil'
Expand Down Expand Up @@ -70,25 +70,6 @@ export function createOpenReferenceLog(): DataQuickPickItem<'openReferenceLog'>
} as DataQuickPickItem<'openReferenceLog'>
}

export function createSecurityScan(): DataQuickPickItem<'securityScan'> {
const label = `Full project scan is now /review!`
const icon = codeScanState.getIconForButton()
const description = 'Open in Chat Panel'

return {
data: 'securityScan',
label: codicon`${icon} ${label}`,
description: description,
onClick: () =>
vscode.commands.executeCommand(
'aws.amazonq.security.scan-statusbar',
placeholder,
'cwQuickPickSource',
true
),
} as DataQuickPickItem<'securityScan'>
}

export function createReconnect(): DataQuickPickItem<'reconnect'> {
const label = localize('aws.amazonq.reconnectNode.label', 'Re-authenticate to connect')
const icon = addColor(getIcon('vscode-debug-disconnect'), 'notificationsErrorIcon.foreground')
Expand Down
9 changes: 1 addition & 8 deletions packages/core/src/codewhisperer/ui/statusBarMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
createAutoScans,
createSignIn,
switchToAmazonQNode,
createSecurityScan,
createSelectRegionProfileNode,
} from './codeWhispererNodes'
import { hasVendedIamCredentials, hasVendedCredentialsFromMetadata } from '../../auth/auth'
Expand Down Expand Up @@ -52,12 +51,7 @@ function getAmazonQCodeWhispererNodes() {
if (hasVendedIamCredentials()) {
return [createFreeTierLimitMet(), createOpenReferenceLog()]
}
return [
createFreeTierLimitMet(),
createOpenReferenceLog(),
createSeparator('Other Features'),
createSecurityScan(),
]
return [createFreeTierLimitMet(), createOpenReferenceLog(), createSeparator('Other Features')]
}

if (hasVendedIamCredentials()) {
Expand All @@ -74,7 +68,6 @@ function getAmazonQCodeWhispererNodes() {
// Security scans
createSeparator('Code Reviews'),
...(AuthUtil.instance.isBuilderIdInUse() ? [] : [createAutoScans(autoScansEnabled)]),
createSecurityScan(),

// Amazon Q + others
createSeparator('Other Features'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import {
createManageSubscription,
createOpenReferenceLog,
createReconnect,
createSecurityScan,
createSelectCustomization,
createSeparator,
createSettingsNode,
Expand Down Expand Up @@ -506,7 +505,6 @@ describe('CodeWhisperer-basicCommands', function () {
createOpenReferenceLog(),
createGettingStarted(),
createSeparator('Code Reviews'),
createSecurityScan(),
createSeparator('Other Features'),
switchToAmazonQNode(),
createSeparator('Connect / Help'),
Expand Down
Loading