33 * SPDX-License-Identifier: Apache-2.0
44 */
55
6- import AdmZip from 'adm-zip'
6+ // import AdmZip from 'adm-zip'
77import os from 'os'
88import fs from 'fs' // eslint-disable-line no-restricted-imports
99import { parsePatch , applyPatches , ParsedDiff } from 'diff'
1010import path from 'path'
1111import vscode from 'vscode'
12- import { ExportIntent } from '@amzn/codewhisperer-streaming'
12+ // import { ExportIntent } from '@amzn/codewhisperer-streaming'
1313import {
1414 TransformByQReviewStatus ,
1515 transformByQState ,
1616 PatchInfo ,
1717 DescriptionContent ,
1818 TransformationType ,
1919} from '../../models/model'
20- import { ExportResultArchiveStructure , downloadExportResultArchive } from '../../../shared/utilities/download'
20+ import { ExportResultArchiveStructure } from '../../../shared/utilities/download'
2121import { getLogger } from '../../../shared/logger'
2222import { telemetry } from '../../../shared/telemetry/telemetry'
2323import { CodeTransformTelemetryState } from '../../../amazonqGumby/telemetry/codeTransformTelemetryState'
2424import { MetadataResult } from '../../../shared/telemetry/telemetryClient'
2525import * as CodeWhispererConstants from '../../models/constants'
26- import { createCodeWhispererChatStreamingClient } from '../../../shared/clients/codewhispererChatClient'
26+ // import { createCodeWhispererChatStreamingClient } from '../../../shared/clients/codewhispererChatClient'
2727import { ChatSessionManager } from '../../../amazonqGumby/chat/storages/chatSession'
2828import { setContext } from '../../../shared/vscode/setContext'
2929import * as codeWhisperer from '../../client/codewhisperer'
@@ -364,28 +364,28 @@ export class ProposedTransformationExplorer {
364364 }
365365 } )
366366
367- vscode . commands . registerCommand ( 'aws.amazonq.transformationHub.summary.reveal' , async ( ) => {
368- if ( transformByQState . getSummaryFilePath ( ) !== '' ) {
369- await vscode . commands . executeCommand (
370- 'markdown.showPreview' ,
371- vscode . Uri . file ( transformByQState . getSummaryFilePath ( ) )
372- )
373- telemetry . ui_click . emit ( { elementId : 'transformationHub_viewSummary' } )
374- }
375- } )
367+ // vscode.commands.registerCommand('aws.amazonq.transformationHub.summary.reveal', async () => {
368+ // if (transformByQState.getSummaryFilePath() !== '') {
369+ // await vscode.commands.executeCommand(
370+ // 'markdown.showPreview',
371+ // vscode.Uri.file(transformByQState.getSummaryFilePath())
372+ // )
373+ // telemetry.ui_click.emit({ elementId: 'transformationHub_viewSummary' })
374+ // }
375+ // })
376376
377377 vscode . commands . registerCommand ( 'aws.amazonq.transformationHub.reviewChanges.startReview' , async ( ) => {
378378 await setContext ( 'gumby.reviewState' , TransformByQReviewStatus . PreparingReview )
379379
380- const pathToArchive = path . join (
381- ProposedTransformationExplorer . TmpDir ,
382- transformByQState . getJobId ( ) ,
383- 'ExportResultsArchive.zip'
384- )
385- let exportResultsArchiveSize = 0
380+ // const pathToArchive = path.join(
381+ // ProposedTransformationExplorer.TmpDir,
382+ // transformByQState.getJobId(),
383+ // 'ExportResultsArchive.zip'
384+ // )
385+ const exportResultsArchiveSize = 0
386386 let downloadErrorMessage = undefined
387387
388- const cwStreamingClient = await createCodeWhispererChatStreamingClient ( )
388+ // const cwStreamingClient = await createCodeWhispererChatStreamingClient()
389389 try {
390390 await telemetry . codeTransform_downloadArtifact . run ( async ( ) => {
391391 telemetry . record ( {
@@ -394,17 +394,17 @@ export class ProposedTransformationExplorer {
394394 codeTransformJobId : transformByQState . getJobId ( ) ,
395395 } )
396396
397- await downloadExportResultArchive (
398- cwStreamingClient ,
399- {
400- exportId : transformByQState . getJobId ( ) ,
401- exportIntent : ExportIntent . TRANSFORMATION ,
402- } ,
403- pathToArchive
404- )
397+ // await downloadExportResultArchive(
398+ // cwStreamingClient,
399+ // {
400+ // exportId: transformByQState.getJobId(),
401+ // exportIntent: ExportIntent.TRANSFORMATION,
402+ // },
403+ // pathToArchive
404+ // )
405405
406406 // Update downloaded artifact size
407- exportResultsArchiveSize = ( await fs . promises . stat ( pathToArchive ) ) . size
407+ // exportResultsArchiveSize = (await fs.promises.stat(pathToArchive)).size
408408
409409 telemetry . record ( { codeTransformTotalByteSize : exportResultsArchiveSize } )
410410 } )
@@ -425,17 +425,17 @@ export class ProposedTransformationExplorer {
425425 getLogger ( ) . error ( `CodeTransformation: ExportResultArchive error = ${ downloadErrorMessage } ` )
426426 throw new Error ( 'Error downloading diff' )
427427 } finally {
428- cwStreamingClient . destroy ( )
428+ // cwStreamingClient.destroy()
429429 }
430430
431431 let deserializeErrorMessage = undefined
432432 let pathContainingArchive = ''
433433 patchFiles = [ ] // reset patchFiles if there was a previous transformation
434434 try {
435435 // Download and deserialize the zip
436- pathContainingArchive = path . dirname ( pathToArchive )
437- const zip = new AdmZip ( pathToArchive )
438- zip . extractAllTo ( pathContainingArchive )
436+ // pathContainingArchive = path.dirname(pathToArchive)
437+ // const zip = new AdmZip(pathToArchive)
438+ // zip.extractAllTo(pathContainingArchive)
439439 const files = fs . readdirSync ( path . join ( pathContainingArchive , ExportResultArchiveStructure . PathToPatch ) )
440440 if ( files . length === 1 ) {
441441 singlePatchFile = path . join (
@@ -491,7 +491,7 @@ export class ProposedTransformationExplorer {
491491 message : CodeWhispererConstants . viewProposedChangesChatMessage ,
492492 tabID : ChatSessionManager . Instance . getSession ( ) . tabID ,
493493 } )
494- await vscode . commands . executeCommand ( 'aws.amazonq.transformationHub.summary.reveal' )
494+ // await vscode.commands.executeCommand('aws.amazonq.transformationHub.summary.reveal')
495495 } catch ( e : any ) {
496496 deserializeErrorMessage = ( e as Error ) . message
497497 getLogger ( ) . error ( `CodeTransformation: ParseDiff error = ${ deserializeErrorMessage } ` )
0 commit comments