aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.52k stars 447 forks source link

Implement `.q-ignore` functionality for Amazon Q uploads #5664

Open selenehyun opened 2 months ago

selenehyun commented 2 months ago

Problem

The current implementation of the Amazon Q feature in the AWS Toolkit for VS Code does not provide a way to exclude certain files or directories when uploading a project. This becomes problematic for users working with monorepo structures or projects that exceed the 200MB upload limit.

Specifically:

  1. The 200MB upload limit can be quickly reached, especially in monorepo setups.
  2. Files unrelated to the actual code (e.g., build artifacts, large data files) are unnecessarily included in the upload.
  3. There's no built-in mechanism to selectively ignore files or directories during the upload process.

This situation leads to inefficient use of the upload capacity and potentially prevents users from utilizing Amazon Q for larger projects.

Expected behavior

We propose implementing a .q-ignore file functionality, similar to how .gitignore works for Git. This feature would allow users to:

  1. Create a .q-ignore file in their project root.
  2. Specify files, directories, or patterns to be excluded from the Amazon Q upload.
  3. Reduce the upload size by excluding unnecessary files, thus staying within the 200MB limit.
  4. Customize the upload content to focus on relevant code and documentation.

Example of a potential .q-ignore file:

# Ignore node modules
node_modules/

# Ignore build artifacts
build/
dist/

# Ignore large data files
*.csv
*.json

# Ignore specific directories
legacy-code/
test-data/

This feature would greatly enhance the usability of Amazon Q for larger projects and monorepos, allowing developers to efficiently utilize the service within the given constraints.

justinmk3 commented 1 month ago

We propose implementing a .q-ignore file functionality, similar to how .gitignore works for Git.

Any reason Q should not just use .gitignore if it is found?

selenehyun commented 1 month ago

We propose implementing a .q-ignore file functionality, similar to how .gitignore works for Git.

Any reason Q should not just use .gitignore if it is found?

Thank you for your response.

While .gitignore lists files that should not be tracked by version control, it doesn’t necessarily align with the files that Amazon Q needs to analyze or upload.

My project is a monorepo and quite large in size. Even when I explicitly specify files or paths in the prompt, the upload often fails due to the size limit, primarily because of files related to Storybook and other environment configurations.

I proposed the .q-ignore file to exclude code or development environment-related files that are not necessary for analysis, hoping to avoid reaching the upload size limit.

Do you have any suggestions for a better solution?

justinmk3 commented 1 month ago

I don't have a better solution. Ideally there would be a quasi-standard pattern to use here, but I didn't find anything. Github copilot has a yaml format but it appears to be part of their UI, not a file that is committed to a project.

selenehyun commented 1 month ago

I don't have a better solution. Ideally there would be a quasi-standard pattern to use here, but I didn't find anything. Github copilot has a yaml format but it appears to be part of their UI, not a file that is committed to a project.

I also couldn't think of a better solution than using a dedicated ignore file similar to .eslintignore or .npmignore. This approach would allow us to exclude specific types of files from being uploaded to Amazon Q, regardless of the language or development environment.

If you believe this idea has merit, I'd be interested to know if it could be included in the development roadmap or if there's any timeline associated with it. Alternatively, I'd be happy to contribute my time to help implement this feature if that's acceptable.

Thank you again for your attention!