Skip to content

Fix: Auto create .aws folder if needed - #13

Open
sweep-ai-deprecated[bot] wants to merge 5 commits into
devfrom
sweep/fix-create-aws-folder
Open

Fix: Auto create .aws folder if needed#13
sweep-ai-deprecated[bot] wants to merge 5 commits into
devfrom
sweep/fix-create-aws-folder

Conversation

@sweep-ai-deprecated

Copy link
Copy Markdown
Contributor

Description

This PR fixes the issue where some commands fail if the .aws folder is not created. It introduces a new function ensureAwsFolderExists that checks if the .aws folder exists and creates it if it does not. This function is called in the necessary places in the code where the .aws folder is accessed.

Summary of Changes

  • Added a new function ensureAwsFolderExists at the end of the index.ts file to check if the .aws folder exists and create it if it does not.
  • Called the ensureAwsFolderExists function at the beginning of the action function for the add, change, rename, upsert, env, env-run, encrypt, and remove commands to ensure the .aws folder is created if it does not exist before executing these commands.

Fixes #12.


To checkout this PR branch, run the following command in your terminal:

git checkout sweep/fix-create-aws-folder

🎉 Latest improvements to Sweep:


💡 To get Sweep to edit this pull request, you can:

  • Leave a comment below to get Sweep to edit the entire PR
  • Leave a comment in the code will only modify the file
  • Edit the original issue to get Sweep to recreate the PR from scratch

@sweep-ai-deprecated sweep-ai-deprecated Bot added the sweep Assigns Sweep to an issue or pull request. label Sep 12, 2023
@jld-adriano

Copy link
Copy Markdown
Contributor

Can you add a test? Just a simple script. that tests the flow. Also make the aws folder path configurable and run the test using a local folder

@sweep-ai-deprecated

sweep-ai-deprecated Bot commented Sep 15, 2023

Copy link
Copy Markdown
Contributor Author

🚀 Wrote Changes

Can you add a test? Just a simple script. that tests the flow. Also make the aws folder path configurable and run the test using a local folder

Hi @jld-adriano,

I decided to make the following changes:

File Path Proposed Changes
test/test_flow.js Create test/test_flow.js with contents:
• Create a new test script in the test directory.
• In this script, import the necessary modules and define a test that checks the main flow of the application.
• The test should first check if the .aws folder exists, and if it doesn't, it should run the application with a command that would cause the folder to be created (such as the add command).
• Then, it should verify that the .aws folder has been created.
• It should also test the other commands to ensure they work as expected.
index.ts Modify index.ts with contents:
• Change the awsPath variable to be set from an environment variable or a command line argument. If neither is provided, it should default to the current value (join(homedir(), ".aws")).
• Update all usages of awsPath in the file to use the new variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sweep Assigns Sweep to an issue or pull request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant