Skip to content

Commit f49baf2

Browse files
committed
code changes for 4/16 bugbash
1 parent 68275cb commit f49baf2

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@
525525
"@aws-sdk/s3-request-presigner": "<3.731.0",
526526
"@aws-sdk/smithy-client": "<3.731.0",
527527
"@aws-sdk/util-arn-parser": "<3.731.0",
528-
"@aws/mynah-ui": "^4.31.0-beta.3",
528+
"@aws/mynah-ui": "^4.31.0-beta.5",
529529
"@gerhobbelt/gitignore-parser": "^0.2.0-9",
530530
"@iarna/toml": "^2.2.5",
531531
"@smithy/fetch-http-handler": "^5.0.1",

packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ export class Messenger {
816816
{
817817
id: 'reject-code-diff',
818818
status: 'clear',
819-
icon: 'revert' as MynahIconsType,
819+
icon: 'undo' as MynahIconsType,
820820
text: 'Undo',
821821
},
822822
]
@@ -860,7 +860,7 @@ export class Messenger {
860860
new ChatMessage(
861861
{
862862
message: message,
863-
messageType: 'answer-part',
863+
messageType: 'answer',
864864
followUps: undefined,
865865
followUpsHeader: undefined,
866866
relatedSuggestions: undefined,

packages/core/src/codewhispererChat/tools/executeBash.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,30 @@ export class ExecuteBash {
431431
return output
432432
}
433433

434+
private getDisplayCommand(): string {
435+
const workspaceFolder = vscode.workspace.workspaceFolders?.[0]
436+
if (!workspaceFolder || !this.workingDirectory) {
437+
return this.command
438+
}
439+
const workspacePath = path.normalize(workspaceFolder.uri.fsPath)
440+
const cwd = path.normalize(this.workingDirectory)
441+
442+
const cleanedCommand = this.command.replace(/^cd\s+[^\n]+?&&\s*/, '').trim()
443+
444+
if (!cwd.startsWith(workspacePath)) {
445+
return this.command
446+
}
447+
448+
const relativePath = path.relative(workspacePath, cwd)
449+
if (!relativePath || relativePath === '.') {
450+
return cleanedCommand
451+
}
452+
453+
return `cd "/${relativePath.replace(/\\/g, '/')}" && ${cleanedCommand}`
454+
}
455+
434456
public queueDescription(updates: Writable): void {
435-
updates.write('```shell\n' + this.command + '\n```')
457+
updates.write('```shell\n' + this.getDisplayCommand() + '\n```')
436458
updates.end()
437459
}
438460

0 commit comments

Comments
 (0)