Skip to content

Commit

Permalink
pull from upstream (#18)
Browse files Browse the repository at this point in the history
* fix(appbuilder): pass in the negative version of --use-container when using build quickpick (#6603)

## Problem
When users use appbuilder to build their lambda functions, they choose
between using their samconfig file or manually selecting the build
parameters/flags. The problem is that when the user selects build flags
and intentionally doesn't select the ```--use-container``` flag, the
command will still be run with --use-container if the samconfig file has
```use_container``` is set to true.

## Solution
Whenever the user manually selects the build flags and doesn't select
```--use-container```, we add the negative version of
```--use-container```, which is ```--no-use-container```. This serves as
an override if the samconfig file has ```--use-container``` set to true.

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

* ci(jscpd): merge target branch in jscpd to avoid false negatives.  (#6572)

## Problem
- Follow up to
#6564 (review).

## Solution
- It appears that there is an undocumented "feature" that GHA don't run
when there is a merge conflict. See
[here](https://github.com/orgs/community/discussions/11265)
- This means we don't have to handle the failure case where a merge
fails.
- Add fake config identity to mitigate this error: 
<img width="913" alt="image"
src="https://github.com/user-attachments/assets/cd426ec7-e1ca-4d13-a3b1-3985b5593c07"
/>


## Notes
Going to let this sit and make sure it works as changes are merged into
master.


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Co-authored-by: Justin M. Keyes <[email protected]>

* ci: fix and enable post-release notification (#6613)

- Enable for prod runs
- Fix script slightly because the way codebuild runs bash and the way my
local runs bash seems to not be the same.
- Tested on dev release pipeline

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

* refactor: notify.txt typos (#6616)

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

* config(amazonq): update polling config for codefix (#6617)

## Problem

Increase in codefix timeouts


## Solution

Increase default timeout and lower the polling frequency


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

* fix(amazonq): auto-review removes existing issues (#6535)

## Problem

Auto-reviews often produce less code issues than manual reviews, but the
current behavior is to remove all the issues in the file when processing
the new ones. This means that issues discovered by manual reviews but
not auto-reviews will silently disappear if auto-reviews is enabled.


## Solution

- Auto-reviews should not clear the previous issues, but instead merge
in the new results to the existing group.
- Fixed a related issue with the `ignoreIssue` command being flaky


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

* feat(amazonq): /doc: add support for infrastructure diagrams (#6561)

Problem:
- Amazon Q does not have support for infrastructure diagrams

Solution:
- Add support for them



![infra_diagram](https://github.com/user-attachments/assets/79693ab0-d95d-415e-8daf-04d59fed8573)

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

Co-authored-by: Viktor Shesternyak <[email protected]>

* refactor(cleanup): remove dead code (#6619)

This does nothing anymore


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

Signed-off-by: nkomonen-amazon <[email protected]>

* telemetry(auth): Update metrics to better debug Auth dropoff (#6625)

## Problem

We noticed that there was an auth dropoff between `session_start` with a
brand new clientId, versus when the `auth_userState` metric indicated
`isFirstUse` meaning the user is net new. We went from 12.7k for
`session_start` to 9.8k for `auth_userState`, these should have been
basically the same.

## Solution

Add in certain metrics to help debug where the discrepancy is coming
from:

- When we determine the user is a first time user, we will also check if
the clientId is newly generated. If this is not the case we know there
is a discrepancy here
- The relevant metric will be `function_call` with a `functionName:
isFirstUse`, `result: Failed`, and a `reason: ClientIdAlreadyExisted`
- When we determine the user is a first time user, if we detected that
they had previous auth connections, this will indicate a likely cause
for the discrepancy
- The relevant metric will be `function_call` with `reason:
UnexpectedConnections`
- We will emit metrics when the Auth Login page loads since that also
had a discrepancy and the telemetry did not exist
- The relevant metric is `webview_load` and it will indicate when the
Auth Login/Reauth page has actually loaded
- Previously we were observing the telemetry for the command
`aws.amazonq.focusChat`, but all this did was emit when called and
didn't confirm the UI actually loaded.
- We will also add the `isFirstUse` metric source value in to some other
existing metrics

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Signed-off-by: nkomonen-amazon <[email protected]>

---------

Signed-off-by: nkomonen-amazon <[email protected]>
Co-authored-by: Frederic Mbea <[email protected]>
Co-authored-by: Hweinstock <[email protected]>
Co-authored-by: Justin M. Keyes <[email protected]>
Co-authored-by: Maxim Hayes <[email protected]>
Co-authored-by: Tai Lai <[email protected]>
Co-authored-by: Viktor Shesternyak <[email protected]>
Co-authored-by: Viktor Shesternyak <[email protected]>
Co-authored-by: Nikolas Komonen <[email protected]>
  • Loading branch information
9 people authored Feb 19, 2025
1 parent e2354da commit a0681aa
Show file tree
Hide file tree
Showing 39 changed files with 564 additions and 195 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/filterDuplicates.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ async function run() {
console.log('%s duplicates found', filteredDuplicates.length)
if (filteredDuplicates.length > 0) {
console.log(formatDuplicates(filteredDuplicates, commitHash, repoName))
console.log(
'* Hint: if these duplicates appear unrelated to the changes, rebase onto the latest target branch.'
)
process.exit(1)
}
}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ jobs:
git remote add forkUpstream https://github.com/$REPO_NAME # URL of the fork
git fetch forkUpstream # Fetch fork
- name: Merge in target branch to avoid false negatives.
env:
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
# Note: "git merge" should always succeed here, because GHA won't
# start the job if there are merge conflicts. https://github.com/orgs/community/discussions/11265
# Also, because `git merge` makes a commit, we need to establish an identity to avoid 'Committer identity unknown' error
run: |
git config --global user.name "aws-toolkit-automation"
git config --global user.email "<>"
git merge origin/$TARGET_BRANCH
- name: Compute git diff
env:
CURRENT_BRANCH: ${{ github.head_ref }}
Expand Down
16 changes: 7 additions & 9 deletions buildspec/release/80notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@ phases:
build:
commands:
- echo "TARGET_EXTENSION=${TARGET_EXTENSION}"
- EXTENSION_NAME=$([ "$TARGET_EXTENSION" = "amazonq" ] && echo "Amazon Q" || echo "AWS Toolkit")
- VERSION=$(node -e "console.log(require('./packages/${TARGET_EXTENSION}/package.json').version);")
- CHANGELOG=$(cat packages/${TARGET_EXTENSION}/CHANGELOG.md | perl -ne 'BEGIN{$/="\n\n"} print if $. == 2')
- MESSAGE=$(envsubst < "$GITHUB_WORKSPACE/buildspec/release/notify.txt")
- DATA="{'Content':'${MESSAGE}'}"
- export EXTENSION_NAME=$([ "$TARGET_EXTENSION" = "amazonq" ] && echo "Amazon Q" || echo "AWS Toolkit")
- export VERSION=$(node -e "console.log(require('./packages/${TARGET_EXTENSION}/package.json').version);")
- export CHANGELOG=$(cat packages/${TARGET_EXTENSION}/CHANGELOG.md | perl -ne 'BEGIN{$/="\n\n"} print if $. == 2')
- MESSAGE=$(envsubst < ./buildspec/release/notify.txt)
- |
# TODO: Enable for prod only after testing
if [ "$STAGE" = "prod" ]; then
echo "SKIPPED (stage=${STAGE}): 'curl -v POST \"[SLACK_URL]\" -H \"Content-Type:application/json\" --data $DATA'"
if [ "$STAGE" != "prod" ]; then
echo "SKIPPED (stage=${STAGE}): 'curl -v POST \"[NOTIFY_URL]\" -H \"Content-Type:application/json\" --data \"{\"Content\":\"${MESSAGE}\"}\"'"
exit 0
fi
curl -v POST "${NOTIFY_URL}" -H "Content-Type:application/json" --data $DATA
curl -v POST "${NOTIFY_URL}" -H "Content-Type:application/json" --data "{\"Content\":\"${MESSAGE}\"}"
4 changes: 2 additions & 2 deletions buildspec/release/notify.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Released ${EXTENSION_NAME} v${VERSION} for VSCode
Released ${EXTENSION_NAME} v${VERSION} for VS Code

${CHANGELOG}

Changelog: https://github.com/aws/aws-toolkit-vscode/blob/master/packages/${TARGET_EXTENSION}/CHANGELOG.md
Release Arifact: https://github.com/aws/aws-toolkit-vscode/releases/tag/${TARGET_EXTENSION}/v${VERSION}
Release Artifact: https://github.com/aws/aws-toolkit-vscode/releases/tag/${TARGET_EXTENSION}/v${VERSION}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "/review: Auto-review should not remove issues from manual reviews"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "Amazon Q /doc: Add support for infrastructure diagrams"
}
2 changes: 1 addition & 1 deletion packages/amazonq/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
// Give time for the extension to finish initializing.
globals.clock.setTimeout(async () => {
CommonAuthWebview.authSource = ExtStartUpSources.firstStartUp
void focusAmazonQPanel.execute(placeholder, 'firstStartUp')
void focusAmazonQPanel.execute(placeholder, ExtStartUpSources.firstStartUp)
}, 1000)
}
}
Expand Down
53 changes: 38 additions & 15 deletions packages/amazonq/test/unit/amazonqFeatureDev/util/files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as vscode from 'vscode'
import assert from 'assert'
import {
prepareRepoData,
PrepareRepoDataOptions,
TelemetryHelper,
ContentLengthError,
maxRepoSizeBytes,
Expand Down Expand Up @@ -46,23 +47,23 @@ const testDevfilePrepareRepo = async (devfileEnabled: boolean) => {
.stub(CodeWhispererSettings.instance, 'getAutoBuildSetting')
.returns(devfileEnabled ? { [workspace.uri.fsPath]: true } : {})

await testPrepareRepoData([workspace], expectedFiles)
await testPrepareRepoData([workspace], expectedFiles, { telemetry: new TelemetryHelper() })
}

const testPrepareRepoData = async (
workspaces: vscode.WorkspaceFolder[],
expectedFiles: string[],
prepareRepoDataOptions: PrepareRepoDataOptions,
expectedTelemetryMetrics?: Array<{ metricName: MetricName; value: any }>
) => {
expectedFiles.sort((a, b) => a.localeCompare(b))
const telemetry = new TelemetryHelper()
const result = await prepareRepoData(
workspaces.map((ws) => ws.uri.fsPath),
workspaces as CurrentWsFolders,
telemetry,
{
record: () => {},
} as unknown as Span<AmazonqCreateUpload>
} as unknown as Span<AmazonqCreateUpload>,
prepareRepoDataOptions
)

assert.strictEqual(Buffer.isBuffer(result.zipFileBuffer), true)
Expand All @@ -84,6 +85,8 @@ const testPrepareRepoData = async (

describe('file utils', () => {
describe('prepareRepoData', function () {
const defaultPrepareRepoDataOptions: PrepareRepoDataOptions = { telemetry: new TelemetryHelper() }

afterEach(() => {
sinon.restore()
})
Expand All @@ -92,21 +95,33 @@ describe('file utils', () => {
const folder = await TestFolder.create()
await folder.write('file1.md', 'test content')
await folder.write('file2.md', 'test content')
await folder.write('docs/infra.svg', 'test content')
const workspace = getWorkspaceFolder(folder.path)

await testPrepareRepoData([workspace], ['file1.md', 'file2.md'])
await testPrepareRepoData([workspace], ['file1.md', 'file2.md'], defaultPrepareRepoDataOptions)
})

it('infrastructure diagram is included', async function () {
const folder = await TestFolder.create()
await folder.write('file1.md', 'test content')
await folder.write('file2.svg', 'test content')
await folder.write('docs/infra.svg', 'test content')
const workspace = getWorkspaceFolder(folder.path)

await testPrepareRepoData([workspace], ['file1.md', 'docs/infra.svg'], {
telemetry: new TelemetryHelper(),
isIncludeInfraDiagram: true,
})
})

it('prepareRepoData ignores denied file extensions', async function () {
const folder = await TestFolder.create()
await folder.write('file.mp4', 'test content')
const workspace = getWorkspaceFolder(folder.path)

await testPrepareRepoData(
[workspace],
[],
[{ metricName: 'amazonq_bundleExtensionIgnored', value: { filenameExt: 'mp4', count: 1 } }]
)
await testPrepareRepoData([workspace], [], defaultPrepareRepoDataOptions, [
{ metricName: 'amazonq_bundleExtensionIgnored', value: { filenameExt: 'mp4', count: 1 } },
])
})

it('should ignore devfile.yaml when setting is disabled', async function () {
Expand All @@ -122,14 +137,18 @@ describe('file utils', () => {
const folder = await TestFolder.create()
await folder.write('file.md', 'test content')
const workspace = getWorkspaceFolder(folder.path)
const telemetry = new TelemetryHelper()

sinon.stub(fs, 'stat').resolves({ size: 2 * maxRepoSizeBytes } as vscode.FileStat)
await assert.rejects(
() =>
prepareRepoData([workspace.uri.fsPath], [workspace], telemetry, {
record: () => {},
} as unknown as Span<AmazonqCreateUpload>),
prepareRepoData(
[workspace.uri.fsPath],
[workspace],
{
record: () => {},
} as unknown as Span<AmazonqCreateUpload>,
defaultPrepareRepoDataOptions
),
ContentLengthError
)
})
Expand All @@ -144,7 +163,11 @@ describe('file utils', () => {
const workspace2 = getWorkspaceFolder(folder.path + '/innerFolder')
const folderName = path.basename(folder.path)

await testPrepareRepoData([workspace1, workspace2], [`${folderName}_${workspace1.name}/${testFilePath}`])
await testPrepareRepoData(
[workspace1, workspace2],
[`${folderName}_${workspace1.name}/${testFilePath}`],
defaultPrepareRepoDataOptions
)
})
})
})
19 changes: 14 additions & 5 deletions packages/core/src/amazonq/session/sessionState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as vscode from 'vscode'
import { ToolkitError } from '../../shared/errors'
import globals from '../../shared/extensionGlobals'
import { getLogger } from '../../shared/logger/logger'
import { telemetry } from '../../shared/telemetry/telemetry'
import { AmazonqCreateUpload, Span, telemetry } from '../../shared/telemetry/telemetry'
import { VirtualFileSystem } from '../../shared/virtualFilesystem'
import { CodeReference, UploadHistory } from '../webview/ui/connector'
import { AuthUtil } from '../../codewhisperer/util/authUtil'
Expand All @@ -25,7 +25,7 @@ import {
SessionStateInteraction,
SessionStatePhase,
} from '../commons/types'
import { prepareRepoData, getDeletedFileInfos, registerNewFiles } from '../util/files'
import { prepareRepoData, getDeletedFileInfos, registerNewFiles, PrepareRepoDataOptions } from '../util/files'
import { uploadCode } from '../util/upload'

export const EmptyCodeGenID = 'EMPTY_CURRENT_CODE_GENERATION_ID'
Expand Down Expand Up @@ -227,11 +227,11 @@ export abstract class BasePrepareCodeGenState implements SessionState {
amazonqConversationId: this.config.conversationId,
credentialStartUrl: AuthUtil.instance.startUrl,
})
const { zipFileBuffer, zipFileChecksum } = await prepareRepoData(
const { zipFileBuffer, zipFileChecksum } = await this.prepareProjectZip(
this.config.workspaceRoots,
this.config.workspaceFolders,
action.telemetry,
span
span,
{ telemetry: action.telemetry }
)
const uploadId = randomUUID()
const { uploadUrl, kmsKeyArn } = await this.config.proxyClient.createUploadUrl(
Expand All @@ -251,6 +251,15 @@ export abstract class BasePrepareCodeGenState implements SessionState {
const nextState = this.createNextState({ ...this.config, uploadId })
return nextState.interact(action)
}

protected async prepareProjectZip(
workspaceRoots: string[],
workspaceFolders: CurrentWsFolders,
span: Span<AmazonqCreateUpload>,
options: PrepareRepoDataOptions
) {
return await prepareRepoData(workspaceRoots, workspaceFolders, span, options)
}
}

export interface CodeGenerationParams {
Expand Down
73 changes: 65 additions & 8 deletions packages/core/src/amazonq/util/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

import * as vscode from 'vscode'
import * as path from 'path'
import { collectFiles, getWorkspaceFoldersByPrefixes } from '../../shared/utilities/workspaceUtils'
import {
collectFiles,
CollectFilesFilter,
defaultExcludePatterns,
getWorkspaceFoldersByPrefixes,
} from '../../shared/utilities/workspaceUtils'

import { ContentLengthError, PrepareRepoFailedError } from '../../amazonqFeatureDev/errors'
import { getLogger } from '../../shared/logger/logger'
Expand All @@ -24,27 +29,69 @@ import { isPresent } from '../../shared/utilities/collectionUtils'
import { AuthUtil } from '../../codewhisperer/util/authUtil'
import { TelemetryHelper } from '../util/telemetryHelper'

export const SvgFileExtension = '.svg'

export async function checkForDevFile(root: string) {
const devFilePath = root + '/devfile.yaml'
const hasDevFile = await fs.existsFile(devFilePath)
return hasDevFile
}

function isInfraDiagramFile(relativePath: string) {
return (
relativePath.toLowerCase().endsWith(path.join('docs', 'infra.dot')) ||
relativePath.toLowerCase().endsWith(path.join('docs', 'infra.svg'))
)
}

export type PrepareRepoDataOptions = {
telemetry?: TelemetryHelper
zip?: ZipStream
isIncludeInfraDiagram?: boolean
}

/**
* given the root path of the repo it zips its files in memory and generates a checksum for it.
*/
export async function prepareRepoData(
repoRootPaths: string[],
workspaceFolders: CurrentWsFolders,
telemetry: TelemetryHelper,
span: Span<AmazonqCreateUpload>,
zip: ZipStream = new ZipStream()
options?: PrepareRepoDataOptions
) {
try {
const telemetry = options?.telemetry
const isIncludeInfraDiagram = options?.isIncludeInfraDiagram ?? false
const zip = options?.zip ?? new ZipStream()

const autoBuildSetting = CodeWhispererSettings.instance.getAutoBuildSetting()
const useAutoBuildFeature = autoBuildSetting[repoRootPaths[0]] ?? false
const excludePatterns: string[] = []
let filterFn: CollectFilesFilter | undefined = undefined

// We only respect gitignore file rules if useAutoBuildFeature is on, this is to avoid dropping necessary files for building the code (e.g. png files imported in js code)
const files = await collectFiles(repoRootPaths, workspaceFolders, true, maxRepoSizeBytes, !useAutoBuildFeature)
if (!useAutoBuildFeature) {
if (isIncludeInfraDiagram) {
// ensure svg is not filtered out by files search
excludePatterns.push(...defaultExcludePatterns.filter((p) => !p.endsWith(SvgFileExtension)))
// ensure only infra diagram is included from all svg files
filterFn = (relativePath: string) => {
if (!relativePath.toLowerCase().endsWith(SvgFileExtension)) {
return false
}
return !isInfraDiagramFile(relativePath)
}
} else {
excludePatterns.push(...defaultExcludePatterns)
}
}

const files = await collectFiles(repoRootPaths, workspaceFolders, {
maxSizeBytes: maxRepoSizeBytes,
excludeByGitIgnore: true,
excludePatterns: excludePatterns,
filterFn: filterFn,
})

let totalBytes = 0
const ignoredExtensionMap = new Map<string, number>()
Expand All @@ -68,9 +115,15 @@ export async function prepareRepoData(
}
const isCodeFile_ = isCodeFile(file.relativeFilePath)
const isDevFile = file.relativeFilePath === 'devfile.yaml'
// When useAutoBuildFeature is on, only respect the gitignore rules filtered earlier and apply the size limit, otherwise, exclude all non code files and gitignore files
const isNonCodeFileAndIgnored = useAutoBuildFeature ? false : !isCodeFile_ || isDevFile
if (fileSize >= maxFileSizeBytes || isNonCodeFileAndIgnored) {
const isInfraDiagramFileExt = isInfraDiagramFile(file.relativeFilePath)

let isExcludeFile = fileSize >= maxFileSizeBytes
// When useAutoBuildFeature is on, only respect the gitignore rules filtered earlier and apply the size limit
if (!isExcludeFile && !useAutoBuildFeature) {
isExcludeFile = isDevFile || (!isCodeFile_ && (!isIncludeInfraDiagram || !isInfraDiagramFileExt))
}

if (isExcludeFile) {
if (!isCodeFile_) {
const re = /(?:\.([^.]+))?$/
const extensionArray = re.exec(file.relativeFilePath)
Expand All @@ -83,6 +136,7 @@ export async function prepareRepoData(
}
continue
}

totalBytes += fileSize
// Paths in zip should be POSIX compliant regardless of OS
// Reference: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
Expand Down Expand Up @@ -117,7 +171,10 @@ export async function prepareRepoData(
}
}

telemetry.setRepositorySize(totalBytes)
if (telemetry) {
telemetry.setRepositorySize(totalBytes)
}

span.record({ amazonqRepositorySize: totalBytes })
const zipResult = await zip.finalize()

Expand Down
Loading

0 comments on commit a0681aa

Please sign in to comment.