Skip to content

Commit

Permalink
Merge branch 'aws:master' into feature/qca
Browse files Browse the repository at this point in the history
  • Loading branch information
laileni-aws authored Jul 23, 2024
2 parents 76ec8d8 + 5397c1b commit a43080c
Show file tree
Hide file tree
Showing 993 changed files with 21,226 additions and 12,925 deletions.
21 changes: 0 additions & 21 deletions .eslintignore

This file was deleted.

16 changes: 13 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ module.exports = {
mocha: true,
es2024: true,
},
plugins: ['@typescript-eslint', 'unicorn', 'header', 'aws-toolkits'],
plugins: ['@typescript-eslint', 'unicorn', 'header', 'security-node', 'aws-toolkits'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:@typescript-eslint/recommended',
'prettier',
// "Add this as the _last_ item in the extends array, so that eslint-config-prettier has the
// opportunity to override other configs." https://github.com/prettier/eslint-plugin-prettier
'plugin:prettier/recommended',
],
rules: {
curly: 2, // Enforce braces on "if"/"for"/etc.
Expand Down Expand Up @@ -94,6 +96,9 @@ module.exports = {
// This is off because prettier takes care of it
'no-extra-semi': 'off',
'@typescript-eslint/no-empty-function': 'off',
// Disallows returning e.g. Promise<…|never> which signals that an exception may be thrown.
// https://stackoverflow.com/q/64230626/152142
'@typescript-eslint/no-redundant-type-constituents': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-floating-promises': 'error', // Promises must catch errors or be awaited.
'@typescript-eslint/no-var-requires': 'off', // Should be able to remove with the full migration of SDK v3
Expand Down Expand Up @@ -139,6 +144,7 @@ module.exports = {
'unicorn/prefer-reflect-apply': 'error',
'unicorn/prefer-string-trim-start-end': 'error',
'unicorn/prefer-type-error': 'error',
'security-node/detect-child-process': 'error',

'header/header': [
'error',
Expand All @@ -152,6 +158,10 @@ module.exports = {

'aws-toolkits/no-only-in-tests': 'error',
'aws-toolkits/no-await-on-vscode-msg': 'error',
'aws-toolkits/no-banned-usages': 'error',
'aws-toolkits/no-incorrect-once-usage': 'error',
'aws-toolkits/no-string-exec-for-child-process': 'error',
'aws-toolkits/no-console-log': 'error',

'no-restricted-imports': [
'error',
Expand All @@ -168,7 +178,7 @@ module.exports = {
// {
// name: 'fs-extra',
// message:
// 'Avoid fs-extra, use FileSystemCommon. Notify the Toolkit team if your required functionality is not available.',
// 'Avoid fs-extra, use shared/fs/fs.ts. Notify the Toolkit team if your required functionality is not available.',
// },
],
},
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ packages/core/src/codewhisperer/ @aws/codewhisperer-team
packages/core/src/amazonqFeatureDev/ @aws/earlybird
packages/core/src/codewhispererChat/ @aws/dexp
packages/core/src/amazonq/ @aws/dexp
packages/core/src/accessanalyzer/ @aws/access-analyzer
packages/core/src/awsService/accessanalyzer/ @aws/access-analyzer
43 changes: 34 additions & 9 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,50 @@ jobs:
uses: coactions/setup-xvfb@v1
with:
run: npm test
- name: Code coverage
- name: Code coverage (Core)
env:
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
NODE_OPTIONS: ''
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && ( github.ref == 'master' || github.event_name == 'pull_request' ) }}
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
flags: macos-core-unittests
verbose: true
file: ./coverage/lcov.info
flags: macos-unittests
- name: Code coverage (CodeWhisperer)
file: ./coverage/core/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
- name: Code coverage (Toolkit)
env:
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
NODE_OPTIONS: ''
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && ( github.ref == 'master' || github.event_name == 'pull_request' ) }}
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
flags: macos-toolkit-unittests
verbose: true
file: ./coverage/lcov.info
file: ./coverage/toolkit/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
- name: Code coverage (Amazon Q)
env:
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
NODE_OPTIONS: ''
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && ( github.ref == 'master' || github.event_name == 'pull_request' ) }}
uses: codecov/codecov-action@v4
with:
flags: macos-amazonq-unittests
verbose: true
file: ./coverage/amazonq/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
- name: Code coverage (CodeWhisperer)
env:
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
NODE_OPTIONS: ''
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && ( github.ref == 'master' || github.event_name == 'pull_request' ) }}
uses: codecov/codecov-action@v4
with:
flags: codewhisperer
verbose: true
file: ./coverage/core/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}

web:
name: test Web
Expand Down Expand Up @@ -101,11 +125,12 @@ jobs:
# Unset NODE_OPTIONS because of https://github.com/codecov/uploader/issues/475
NODE_OPTIONS: ''
if: ${{ github.repository == 'aws/aws-toolkit-vscode' && ( github.ref == 'master' || github.event_name == 'pull_request' ) }}
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
flags: windows-unittests
verbose: true
file: ./coverage/lcov.info
flags: windows-unittests
token: ${{ secrets.CODECOV_TOKEN }}

lint:
name: Lint
Expand Down
19 changes: 9 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Note: also used for `eslint --ignore-path`.

out
dist
node_modules
Expand All @@ -20,22 +22,19 @@ __pycache__
packages/*/src/**/*.gen.ts
src.gen/*

# Telemetry definition for testing adding telemetry
packages/core/src/shared/telemetry/vscodeTelemetry.json

# Test reports
.test-reports

# Auto generated type definitions
packages/core/src/shared/telemetry/clienttelemetry.d.ts
packages/core/src/codewhisperer/client/codewhispererclient.d.ts
packages/core/src/codewhisperer/client/codewhispereruserclient.d.ts
packages/core/src/amazonqFeatureDev/client/featuredevproxyclient.d.ts
packages/core/src/auth/sso/oidcclientpkce.d.ts
**/src/shared/telemetry/clienttelemetry.d.ts
**/src/codewhisperer/client/codewhispererclient.d.ts
**/src/codewhisperer/client/codewhispereruserclient.d.ts
**/src/amazonqFeatureDev/client/featuredevproxyclient.d.ts
**/src/auth/sso/oidcclientpkce.d.ts

# Generated by tests
packages/core/src/testFixtures/**/bin
packages/core/src/testFixtures/**/obj
**/src/testFixtures/**/bin
**/src/testFixtures/**/obj

# Generated by copyFiles.ts
packages/*/LICENSE
Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

git secrets --register-aws || (echo 'Please install git-secrets https://github.com/awslabs/git-secrets to check for accidentally commited secrets!' && exit 1)
git secrets --pre_commit_hook -- ""
node_modules/.bin/pretty-quick --staged
38 changes: 25 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,7 @@ To run tests against a specific folder in VSCode, do any one of:
### Coverage report
You can find the coverage report at `./coverage/index.html` after running the tests. Tests ran from the workspace launch config won't generate a coverage report automatically because it can break file watching. A few manual steps are needed instead:
- Run the command `Tasks: Run Build Task` if not already active
- Instrument built code with `npm run instrument`
- Exercise the code (`Extension Tests`, `Integration Tests`, etc.)
- Generate a report with `npm run report`
You can find the coverage report at `./coverage/amazonq/lcov-report/index.html` and `./coverage/core/lcov-report/index.html` after running the tests. Tests ran from the workspace launch config won't generate a coverage report automatically because it can break file watching.
### CodeCatalyst Blueprints
Expand All @@ -249,20 +244,35 @@ To send a pull request:
### Changelog
Pull requests that change **customer-impacting behavior** must include a changelog item(s). Run this command:
Pull requests that change **customer-impacting behavior** must include a changelog item(s). Run one
or both of the following commands:
- For changes relevant to Amazon Q:
```
npm run newChange -w packages/amazonq
```
- For changes relevant to AWS Toolkit:
```
npm run newChange -w packages/toolkit
```
The audience for the changelog is _the user_. The changelog is presented to users by VSCode and the
marketplace. It is a "micro-blog" for advertising improvements to users. It is the _primary_ way of
communicating changes to customers. Please consider this when writing changelog entries.
npm run newChange
Mentioning low-level details like "function x now takes argument y", will not be useful, because it
doesn't say what that means in terms of the user experience. Instead, describe the effect from the
user's point of view.
> [!TIP]
>
> - Describe the change in a way that is _meaningful to the customer_. If you can't describe the _customer impact_ then it probably shouldn't be in the changelog.
> - ❌ `Update telemetry definitions` (not customer-impacting)
> - ✅ `Connection wizard sometimes shows the old (stale) connection`
> - ✅ `Faster startup after VSCode restarts`
> - ❌ `Remove the cache when the connection wizard is re-launched` (code internals are not relevant to customers)
> - ✅ `Connection wizard sometimes shows the old (stale) connection`
> - "Bug Fix" changes should describe the _problem being fixed_. This tends to produce simpler,
> more-intuitive descriptions. It's redundant to say "Fixed" in the description, because the
> generated changelog will say that. Example:
> - ❌ `Update telemetry definitions` (not customer-impacting)
> - "Bug Fix" changes should describe the _problem being fixed_. Don't say "Fixed" in the
> description, it's redundant. Example:
> - ❌ `Fixed S3 bug which caused filenames to be uppercase`
> - ✅ `S3 filenames are always uppercase`
> - To update an _existing_ changelog item, just edit its `.changes/next-release/….json` file, you don't need to re-run `npm run newChange`.
Expand Down Expand Up @@ -462,6 +472,8 @@ The package.json 'devDependencies' includes `eslint-plugin-aws-toolkits`. This i
3. Register your rule in `plugins/eslint-plugin-aws-toolkits/index.ts`.
4. Enable your rule in `.eslintrc`.

Writing lint rules can be tricky if you are unfamiliar with the process. Use an AST viewer such as https://astexplorer.net/

### AWS SDK generator

When the AWS SDK does not (yet) support a service but you have an API
Expand Down
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
# AWS Toolkit for Visual Studio Code
# AWS Extensions for Visual Studio Code

[![Coverage](https://img.shields.io/codecov/c/github/aws/aws-toolkit-vscode/master.svg)](https://codecov.io/gh/aws/aws-toolkit-vscode/branch/master) [![Marketplace Version](https://img.shields.io/vscode-marketplace/v/AmazonWebServices.aws-toolkit-vscode.svg) ![Marketplace Downloads](https://img.shields.io/vscode-marketplace/d/AmazonWebServices.aws-toolkit-vscode.svg)](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.aws-toolkit-vscode)
[![Coverage](https://img.shields.io/codecov/c/github/aws/aws-toolkit-vscode/master.svg)](https://codecov.io/gh/aws/aws-toolkit-vscode/branch/master)

This project is open source. We encourage issues, feature requests, code reviews, pull requests or
any positive contribution. See [CONTRIBUTING.md](CONTRIBUTING.md) to get started.

### Amazon Q

[![Marketplace Version](https://img.shields.io/vscode-marketplace/v/AmazonWebServices.amazon-q-vscode.svg) ![Marketplace Downloads](https://img.shields.io/vscode-marketplace/d/AmazonWebServices.amazon-q-vscode.svg)](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode)

Amazon Q for VS Code is a [VS Code extension](https://marketplace.visualstudio.com/itemdetails?itemName=AmazonWebServices.aws-toolkit-vscode) for connecting your IDE to [Amazon Q](https://aws.amazon.com/q/developer/) and leveraging generative AI to accelerate your software development.

- Code faster with inline code suggestions as you type
- Chat with [Amazon Q](https://aws.amazon.com/q/developer/) to generate code, explain code, and get answers to questions about software development
- Analyze and fix security vulnerabilities in your project
- Upgrade your Java applications

[Project Directory](https://github.com/aws/aws-toolkit-vscode/tree/master/packages/amazonq)

### AWS Toolkit

[![Marketplace Version](https://img.shields.io/vscode-marketplace/v/AmazonWebServices.aws-toolkit-vscode.svg) ![Marketplace Downloads](https://img.shields.io/vscode-marketplace/d/AmazonWebServices.aws-toolkit-vscode.svg)](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.aws-toolkit-vscode)

AWS Toolkit is a [VS Code extension](https://marketplace.visualstudio.com/itemdetails?itemName=AmazonWebServices.aws-toolkit-vscode) for connecting your IDE to your AWS resources:

- Connect with [IAM credentials](https://docs.aws.amazon.com/sdkref/latest/guide/access-users.html),
[IAM Identity Center (SSO)](https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html),
or [AWS Builder ID](https://docs.aws.amazon.com/signin/latest/userguide/differences-aws_builder_id.html)
- Use [Amazon Q](https://aws.amazon.com/q/developer/) to write code
- Connect to your [CodeCatalyst](https://codecatalyst.aws/) Dev Environments
- Debug your Lambda functions using [SAM CLI](https://github.com/aws/aws-sam-cli)
- Check and autocomplete code in SAM/CFN (CloudFormation) `template.yaml` files
- `Open Terminal` on your ECS tasks
- `Search Log Group` on your CloudWatch logs
- Browse your AWS resources

This project is open source. We love issues, feature requests, code reviews, pull requests or any
positive contribution. See [CONTRIBUTING.md](CONTRIBUTING.md) to get started.
[Project Directory](https://github.com/aws/aws-toolkit-vscode/tree/master/packages/toolkit)

## Documentation

- [Quick Start Guide](https://marketplace.visualstudio.com/itemdetails?itemName=AmazonWebServices.aws-toolkit-vscode)
- Quick Start Guides for...
- [Amazon Q](https://marketplace.visualstudio.com/itemdetails?itemName=AmazonWebServices.amazon-q-vscode)
- [AWS Toolkit](https://marketplace.visualstudio.com/itemdetails?itemName=AmazonWebServices.aws-toolkit-vscode)
- [FAQ / Troubleshooting](./docs/faq-credentials.md)
- [User Guide](https://docs.aws.amazon.com/console/toolkit-for-vscode/welcome)
- General info about [AWS SDKs and Tools](https://docs.aws.amazon.com/sdkref/latest/guide/overview.html)
Expand All @@ -37,4 +57,4 @@ We want your feedback!

## License

The **AWS Toolkit for Visual Studio Code** is distributed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
This project and the subprojects within **(AWS Toolkit for Visual Studio Code, Amazon Q for Visual Studio Code)** is distributed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
1 change: 1 addition & 0 deletions buildspec/linuxE2ETests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ phases:
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g')
- CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
- test -n "${CODECOV_TOKEN}" && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/core/lcov.info --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
finally:
- rm -rf ~/.aws/sso/cache || true
reports:
Expand Down
1 change: 1 addition & 0 deletions buildspec/linuxIntegrationTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ phases:
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g')
- CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
- test -n "${CODECOV_TOKEN}" && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/core/lcov.info --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info
post_build:
commands:
# Destroy .netrc to avoid leaking $GITHUB_READONLY_TOKEN.
Expand Down
1 change: 1 addition & 0 deletions buildspec/linuxTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ phases:
- VCS_COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
- CI_BUILD_URL=$(echo $CODEBUILD_BUILD_URL | sed 's/#/%23/g') # Encode `#` in the URL because otherwise the url is clipped in the Codecov.io site
- CI_BUILD_ID="${CODEBUILD_BUILD_ID}"
- test -n "${CODECOV_TOKEN}" && ./codecov --token=${CODECOV_TOKEN} --branch=${CODEBUILD_RESOLVED_SOURCE_VERSION} --repository=${CODEBUILD_SOURCE_REPO_URL} --file=./coverage/core/lcov.info --file=./coverage/amazonq/lcov.info --file=./coverage/toolkit/lcov.info

reports:
unit-test:
Expand Down
5 changes: 3 additions & 2 deletions buildspec/release/10changeversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ phases:
VERSION=$(node -e "console.log(require('./packages/${TARGET_EXTENSION}/package.json').version);" | (IFS="-"; read -r version unused && echo "$version"))
DATE=$(date)
npm version --no-git-tag-version "$VERSION" -w packages/${TARGET_EXTENSION}
# Call npm ci because 'createRelease' uses ts-node
npm ci
# 'createRelease' uses ts-node.
# Ignore broken "postinstall" script in "src.gen/@amzn/codewhisperer-streaming/package.json".
npm install --ignore-scripts ts-node
- |
npm run createRelease -w packages/${TARGET_EXTENSION}
- |
Expand Down
4 changes: 3 additions & 1 deletion buildspec/release/40pushtogithub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ phases:
git commit -m "Update version to snapshot version: ${VERSION}-SNAPSHOT"
- |
if [ "$STAGE" != "prod" ]; then
echo "Stage is not production, skipping github push step"
echo "SKIPPED (stage=${STAGE}): 'git push originWithCreds ${TARGET_BRANCH}'"
exit 0
fi
echo "pushing to github"
git fetch originWithCreds ${TARGET_BRANCH}
git merge --no-edit -m "Merge release into ${TARGET_BRANCH}" FETCH_HEAD
git push originWithCreds --tags
git push originWithCreds ${TARGET_BRANCH}
Loading

0 comments on commit a43080c

Please sign in to comment.