Skip to content

Commit 166f61d

Browse files
authored
Merge master into feature/standalone
2 parents 6d05dc5 + 4404db7 commit 166f61d

35 files changed

+1341
-1135
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q Code Transform: Handle whitespaces in manually entered JAVA_HOME"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Support extended CodeWhisperer session durations when using CodeCatalyst on the same SSO connection"
4+
}

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
* @aws/aws-ides-team
22
packages/core/src/codewhisperer/ @aws/codewhisperer-team
33
packages/core/src/amazonqFeatureDev/ @aws/earlybird
4-
packages/core/src/codewhispererChat/ @aws/aws-mynah
5-
packages/core/src/amazonq/ @aws/aws-mynah
4+
packages/core/src/codewhispererChat/ @aws/dexp
5+
packages/core/src/amazonq/ @aws/dexp

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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@
204204
"remoteConnected": {
205205
"type": "boolean",
206206
"default": false
207+
},
208+
"codeCatalystConnectionExpired": {
209+
"type": "boolean",
210+
"default": false
207211
}
208212
},
209213
"additionalProperties": false
@@ -3929,7 +3933,7 @@
39293933
},
39303934
"devDependencies": {
39313935
"@aws-sdk/types": "^3.13.1",
3932-
"@aws-toolkits/telemetry": "^1.0.196",
3936+
"@aws-toolkits/telemetry": "^1.0.201",
39333937
"@aws/fully-qualified-names": "^2.1.4",
39343938
"@cspotcode/source-map-support": "^0.8.1",
39353939
"@sinonjs/fake-timers": "^10.0.2",

packages/core/src/amazonqGumby/activation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55

66
import * as vscode from 'vscode'
77
import { Commands } from '../shared/vscode/commands2'
8-
import { TransformationHubViewProvider } from '../codewhisperer/service/transformationHubViewProvider'
8+
import { TransformationHubViewProvider } from '../codewhisperer/service/transformByQ/transformationHubViewProvider'
99
import { ExtContext } from '../shared/extensions'
1010
import { stopTransformByQ } from '../codewhisperer/commands/startTransformByQ'
1111
import { transformByQState } from '../codewhisperer/models/model'
1212
import * as CodeWhispererConstants from '../codewhisperer/models/constants'
13-
import { ProposedTransformationExplorer } from '../codewhisperer/service/transformationResultsViewProvider'
13+
import { ProposedTransformationExplorer } from '../codewhisperer/service/transformByQ/transformationResultsViewProvider'
1414
import { codeTransformTelemetryState } from './telemetry/codeTransformTelemetryState'
1515
import { telemetry } from '../shared/telemetry/telemetry'
1616
import { CancelActionPositions } from './telemetry/codeTransformTelemetry'
1717
import { AuthUtil } from '../codewhisperer/util/authUtil'
18-
import { validateAndLogProjectDetails } from '../codewhisperer/service/transformByQHandler'
18+
import { validateAndLogProjectDetails } from '../codewhisperer/service/transformByQ/transformProjectValidationHandler'
1919

2020
export async function activate(context: ExtContext) {
2121
void vscode.commands.executeCommand('setContext', 'gumby.wasQCodeTransformationUsed', false)

packages/core/src/amazonqGumby/chat/controller/controller.ts

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
* This class is responsible for responding to UI events by calling
66
* the Gumby extension.
77
*/
8-
8+
import fs from 'fs'
9+
import path from 'path'
10+
import * as vscode from 'vscode'
911
import { GumbyNamedMessages, Messenger } from './messenger/messenger'
1012
import { AuthController } from '../../../amazonq/auth/controller'
1113
import { ChatSessionManager } from '../storages/chatSession'
12-
import * as vscode from 'vscode'
1314
import { ConversationState, Session } from '../session/session'
1415
import { getLogger } from '../../../shared/logger'
1516
import { featureName } from '../../models/constants'
@@ -22,14 +23,15 @@ import {
2223
stopTransformByQ,
2324
validateCanCompileProject,
2425
} from '../../../codewhisperer/commands/startTransformByQ'
25-
import { JDKVersion, transformByQState } from '../../../codewhisperer/models/model'
26+
import { JDKVersion, TransformationCandidateProject, transformByQState } from '../../../codewhisperer/models/model'
2627
import { JavaHomeNotSetError, NoJavaProjectsFoundError, NoMavenJavaProjectsFoundError } from '../../errors'
2728
import MessengerUtils, { ButtonActions, GumbyCommands } from './messenger/messengerUtils'
28-
import { TransformationCandidateProject } from '../../../codewhisperer/service/transformByQHandler'
2929
import { CancelActionPositions } from '../../telemetry/codeTransformTelemetry'
30-
import fs from 'fs'
31-
import path from 'path'
3230
import { openUrl } from '../../../shared/utilities/vsCodeUtils'
31+
import { telemetry } from '../../../shared/telemetry/telemetry'
32+
import { MetadataResult } from '../../../shared/telemetry/telemetryClient'
33+
import { codeTransformTelemetryState } from '../../telemetry/codeTransformTelemetryState'
34+
import { getAuthType } from '../../../codewhisperer/service/transformByQ/transformApiHandler'
3335

3436
// These events can be interactions within the chat,
3537
// or elsewhere in the IDE
@@ -227,9 +229,14 @@ export class GumbyController {
227229
}
228230
}
229231

230-
// Any given project could have multiple candidate projects to transform --
231-
// The user gets prompted to pick a specific one
232+
// prompt user to pick project and specify source JDK version
232233
private async initiateTransformationOnProject(message: any) {
234+
const authType = await getAuthType()
235+
telemetry.codeTransform_jobIsStartedFromChatPrompt.emit({
236+
codeTransformSessionId: codeTransformTelemetryState.getSessionId(),
237+
credentialSourceId: authType,
238+
result: MetadataResult.Pass,
239+
})
233240
const pathToProject: string = message.formSelectedValues['GumbyTransformProjectForm']
234241
const toJDKVersion: JDKVersion = message.formSelectedValues['GumbyTransformJdkToForm']
235242
const fromJDKVersion: JDKVersion = message.formSelectedValues['GumbyTransformJdkFromForm']
@@ -335,11 +342,18 @@ export class GumbyController {
335342
}
336343
}
337344

345+
/**
346+
* Examples:
347+
* ```
348+
* extractPath("./some/path/here") => "C:/some/root/some/path/here"
349+
* extractPath("C:/some/nonexistent/path/here") => undefined
350+
* extractPath("C:/some/filepath/.txt") => undefined
351+
* ```
352+
*
353+
* @param text
354+
* @returns the absolute path if path points to existing folder, otherwise undefined
355+
*/
338356
function extractPath(text: string): string | undefined {
339-
const words = text.split(/\s+/) // Split text into words by whitespace
340-
341-
// Filter words that are formatted like paths and do exist as local directories
342-
const paths = words.find(word => fs.existsSync(word) && fs.lstatSync(word).isDirectory())
343-
344-
return paths
357+
const resolvedPath = path.resolve(text)
358+
return fs.existsSync(resolvedPath) && fs.lstatSync(resolvedPath).isDirectory() ? resolvedPath : undefined
345359
}

packages/core/src/amazonqGumby/chat/controller/messenger/messenger.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import { AuthFollowUpType, expiredText, enableQText, reauthenticateText } from '../../../../amazonq/auth/model'
1212
import { ChatItemType } from '../../../../amazonqFeatureDev/models'
13-
import { JDKVersion } from '../../../../codewhisperer/models/model'
13+
import { JDKVersion, TransformationCandidateProject } from '../../../../codewhisperer/models/model'
1414
import { FeatureAuthState } from '../../../../codewhisperer/util/authUtil'
1515
import {
1616
AppToWebViewMessageDispatcher,
@@ -26,7 +26,6 @@ import {
2626
} from '../../views/connector/connector'
2727
import { ChatItemButton, ChatItemFormItem } from '@aws/mynah-ui/dist/static'
2828
import MessengerUtils, { ButtonActions } from './messengerUtils'
29-
import { TransformationCandidateProject } from '../../../../codewhisperer/service/transformByQHandler'
3029

3130
export type StaticTextResponseType =
3231
| 'transform'

packages/core/src/amazonqGumby/chat/controller/messenger/stringConstants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
export const enterJavaHomeMessage = 'Enter the path to JDK '
88

99
export const windowsJavaHomeHelpMessage =
10-
'To find the JAVA_HOME path, run the following command in a new IDE terminal: `cd C:ProgramFilesJava` and then `dir`. If you see your JDK version, run `cd JDK<version>` and then `cd` to show the path.'
10+
'To find the JAVA_HOME path, run the following command in a new IDE terminal: `cd "C:\\Program Files\\Java" && dir`. If you see your JDK version, run `cd <version>` and then `cd` to show the path.'
1111

1212
export const nonWindowsJava8HomeHelpMessage =
1313
'To find the JAVA_HOME path, run the following command in a new IDE terminal: `/usr/libexec/java_home -v 1.8`'

packages/core/src/amazonqGumby/chat/session/session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { TransformationCandidateProject } from '../../../codewhisperer/service/transformByQHandler'
6+
import { TransformationCandidateProject } from '../../../codewhisperer/models/model'
77

88
export enum ConversationState {
99
IDLE,

0 commit comments

Comments
 (0)