Skip to content

Commit 4aa521e

Browse files
authored
Merge branch 'aws:master' into code-review-tool
2 parents a46bcca + 9128f47 commit 4aa521e

File tree

5 files changed

+48
-6
lines changed

5 files changed

+48
-6
lines changed

packages/amazonq/package.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,11 @@
408408
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connected && !aws.isSageMakerUnifiedStudio",
409409
"group": "2_amazonQ@4"
410410
},
411+
{
412+
"command": "aws.amazonq.showLogs",
413+
"when": "view == aws.amazonq.AmazonQChatView",
414+
"group": "1_amazonQ@5"
415+
},
411416
{
412417
"command": "aws.amazonq.reconnect",
413418
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connectionExpired",
@@ -562,17 +567,17 @@
562567
"commands": [
563568
{
564569
"command": "aws.amazonq.stopCmdExecution",
565-
"title": "Stop Amazon Q Command Execution",
570+
"title": "Stop Amazon Q",
566571
"category": "%AWS.amazonq.title%"
567572
},
568573
{
569574
"command": "aws.amazonq.runCmdExecution",
570-
"title": "Run Amazon Q Command Execution",
575+
"title": "Run Amazon Q Tool",
571576
"category": "%AWS.amazonq.title%"
572577
},
573578
{
574579
"command": "aws.amazonq.rejectCmdExecution",
575-
"title": "Reject Amazon Q Command Execution",
580+
"title": "Reject Amazon Q Tool",
576581
"category": "%AWS.amazonq.title%"
577582
},
578583
{
@@ -636,6 +641,12 @@
636641
"category": "%AWS.amazonq.title%",
637642
"enablement": "aws.codewhisperer.connected"
638643
},
644+
{
645+
"command": "aws.amazonq.showLogs",
646+
"title": "%AWS.command.codewhisperer.showLogs%",
647+
"category": "%AWS.amazonq.title%",
648+
"enablement": "aws.codewhisperer.connected"
649+
},
639650
{
640651
"command": "aws.amazonq.selectRegionProfile",
641652
"title": "Change Profile",

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,13 +447,15 @@ export function registerMessageListeners(
447447
)
448448

449449
// Get the log directory path
450-
const logPath = globals.context.logUri?.fsPath
450+
const logFolderPath = globals.context.logUri?.fsPath
451451
const result = { ...message.params, success: false }
452452

453-
if (logPath) {
453+
if (logFolderPath) {
454454
// Open the log directory in the OS file explorer directly
455455
languageClient.info('[VSCode Client] Opening logs directory')
456-
await vscode.commands.executeCommand('revealFileInOS', vscode.Uri.file(logPath))
456+
const path = require('path')
457+
const logFilePath = path.join(logFolderPath, 'Amazon Q Logs.log')
458+
await vscode.commands.executeCommand('revealFileInOS', vscode.Uri.file(logFilePath))
457459
result.success = true
458460
} else {
459461
// Fallback: show error if log path is not available

packages/core/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
"AWS.command.codewhisperer.signout": "Sign Out",
276276
"AWS.command.codewhisperer.reconnect": "Reconnect",
277277
"AWS.command.codewhisperer.openReferencePanel": "Open Code Reference Log",
278+
"AWS.command.codewhisperer.showLogs": "Show Logs",
278279
"AWS.command.q.selectRegionProfile": "Select Profile",
279280
"AWS.command.q.transform.acceptChanges": "Accept",
280281
"AWS.command.q.transform.rejectChanges": "Reject",

packages/core/src/codewhisperer/activation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
enableCodeSuggestions,
2424
toggleCodeSuggestions,
2525
showReferenceLog,
26+
showLogs,
2627
showSecurityScan,
2728
showLearnMore,
2829
showSsoSignIn,
@@ -299,6 +300,7 @@ export async function activate(context: ExtContext): Promise<void> {
299300
),
300301
vscode.window.registerWebviewViewProvider(ReferenceLogViewProvider.viewType, ReferenceLogViewProvider.instance),
301302
showReferenceLog.register(),
303+
showLogs.register(),
302304
showExploreAgentsView.register(),
303305
vscode.languages.registerCodeLensProvider(
304306
[...CodeWhispererConstants.platformLanguageIds],

packages/core/src/codewhisperer/commands/basicCommands.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,32 @@ export const showReferenceLog = Commands.declare(
147147
}
148148
)
149149

150+
export const showLogs = Commands.declare(
151+
{ id: 'aws.amazonq.showLogs', compositeKey: { 1: 'source' } },
152+
() => async (_: VsCodeCommandArg, source: CodeWhispererSource) => {
153+
if (_ !== placeholder) {
154+
source = 'ellipsesMenu'
155+
}
156+
157+
// Show warning message without buttons - just informational
158+
void vscode.window.showWarningMessage(
159+
'Log files may contain sensitive information such as account IDs, resource names, and other data. Be careful when sharing these logs.'
160+
)
161+
162+
// Get the log directory path
163+
const logFolderPath = globals.context.logUri?.fsPath
164+
const path = require('path')
165+
const logFilePath = path.join(logFolderPath, 'Amazon Q Logs.log')
166+
if (logFilePath) {
167+
// Open the log directory in the OS file explorer directly
168+
await vscode.commands.executeCommand('revealFileInOS', vscode.Uri.file(logFilePath))
169+
} else {
170+
// Fallback: show error if log path is not available
171+
void vscode.window.showErrorMessage('Log location not available.')
172+
}
173+
}
174+
)
175+
150176
export const showExploreAgentsView = Commands.declare(
151177
{ id: 'aws.amazonq.exploreAgents', compositeKey: { 1: 'source' } },
152178
() => async (_: VsCodeCommandArg, source: CodeWhispererSource) => {

0 commit comments

Comments
 (0)