From d875e9fff4f1c551437a7730f4880a9828117ee3 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 30 Aug 2024 14:27:47 -0700 Subject: [PATCH] feat: expand list of important files and improve detection --- aider/special.py | 87 +++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 52 deletions(-) diff --git a/aider/special.py b/aider/special.py index c91493053..f776337d7 100644 --- a/aider/special.py +++ b/aider/special.py @@ -10,70 +10,41 @@ def filter_important_files(file_paths): """ important_files = [ # Version Control - ".gitignore", - ".gitattributes", + ".gitignore", ".gitattributes", # Package Management and Dependencies - "requirements.txt", - "Pipfile", - "pyproject.toml", - "package.json", - "package-lock.json", - "yarn.lock", - "Gemfile", - "Gemfile.lock", - "composer.json", - "composer.lock", - "pom.xml", - "build.gradle", - "go.mod", - "go.sum", + "requirements.txt", "Pipfile", "pyproject.toml", "package.json", "package-lock.json", + "yarn.lock", "Gemfile", "Gemfile.lock", "composer.json", "composer.lock", "pom.xml", + "build.gradle", "go.mod", "go.sum", # Project Configuration - ".editorconfig", - ".eslintrc", - ".pylintrc", - "tsconfig.json", + ".editorconfig", ".eslintrc", ".pylintrc", "tsconfig.json", # Build and Compilation - "Makefile", - "webpack.config.js", - "gulpfile.js", + "Makefile", "webpack.config.js", "gulpfile.js", # CI/CD - ".travis.yml", - ".gitlab-ci.yml", - "Jenkinsfile", + ".travis.yml", ".gitlab-ci.yml", "Jenkinsfile", # Docker - "Dockerfile", - "docker-compose.yml", + "Dockerfile", "docker-compose.yml", # Environment Variables - ".env", - ".env.example", + ".env", ".env.example", # Deployment - "Procfile", - "vercel.json", - "netlify.toml", - "app.yaml", + "Procfile", "vercel.json", "netlify.toml", "app.yaml", # Documentation - "README.md", - "CONTRIBUTING.md", - "LICENSE", - "CHANGELOG.md", + "README.md", "CONTRIBUTING.md", "LICENSE", "CHANGELOG.md", # Language-specific - "setup.py", - "__init__.py", - "Rakefile", - ".babelrc", - ".npmrc", - ".htaccess", + "setup.py", "__init__.py", "Rakefile", ".babelrc", ".npmrc", ".htaccess", # Framework-specific - "manage.py", - "settings.py", - "routes.rb", + "manage.py", "settings.py", "routes.rb", # Testing - "pytest.ini", - "phpunit.xml", - "karma.conf.js", + "pytest.ini", "phpunit.xml", "karma.conf.js", # Security - ".npmrc", - ".pypirc", + ".npmrc", ".pypirc", + # New entries + "Cargo.toml", "Cargo.lock", "build.sbt", "stack.yaml", "package.yaml", + "mix.exs", "project.clj", ".prettierrc", ".stylelintrc", "tslint.json", + "babel.config.js", "jest.config.js", "cypress.json", "serverless.yml", + "firebase.json", "now.json", "docker-compose.override.yml", "schema.sql", + "next.config.js", "nuxt.config.js", "vue.config.js", "angular.json", + "swagger.yaml", "swagger.json", "openapi.yaml", "openapi.json", + ".flake8", ".rubocop.yml", ".scalafmt.conf", "SECURITY.md", "CODEOWNERS", ] def is_important(file_path): @@ -84,6 +55,18 @@ def filter_important_files(file_paths): if dir_name.endswith(".github/workflows") and file_name.endswith(".yml"): return True + # Check for IDE-specific directories + if file_name in [".idea", ".vscode"]: + return True + + # Check for Kubernetes config files + if "kubernetes" in dir_name.split(os.path.sep) and file_name.endswith(".yaml"): + return True + + # Check for migration directories + if file_name == "migrations" and os.path.isdir(file_path): + return True + return file_name in important_files or any( file_path.endswith(f"/{name}") for name in important_files )