feat: expand list of important files and improve detection

This commit is contained in:
Paul Gauthier (aider) 2024-08-30 14:27:47 -07:00
parent 893afcb9ab
commit d875e9fff4

View file

@ -10,70 +10,41 @@ def filter_important_files(file_paths):
""" """
important_files = [ important_files = [
# Version Control # Version Control
".gitignore", ".gitignore", ".gitattributes",
".gitattributes",
# Package Management and Dependencies # Package Management and Dependencies
"requirements.txt", "requirements.txt", "Pipfile", "pyproject.toml", "package.json", "package-lock.json",
"Pipfile", "yarn.lock", "Gemfile", "Gemfile.lock", "composer.json", "composer.lock", "pom.xml",
"pyproject.toml", "build.gradle", "go.mod", "go.sum",
"package.json",
"package-lock.json",
"yarn.lock",
"Gemfile",
"Gemfile.lock",
"composer.json",
"composer.lock",
"pom.xml",
"build.gradle",
"go.mod",
"go.sum",
# Project Configuration # Project Configuration
".editorconfig", ".editorconfig", ".eslintrc", ".pylintrc", "tsconfig.json",
".eslintrc",
".pylintrc",
"tsconfig.json",
# Build and Compilation # Build and Compilation
"Makefile", "Makefile", "webpack.config.js", "gulpfile.js",
"webpack.config.js",
"gulpfile.js",
# CI/CD # CI/CD
".travis.yml", ".travis.yml", ".gitlab-ci.yml", "Jenkinsfile",
".gitlab-ci.yml",
"Jenkinsfile",
# Docker # Docker
"Dockerfile", "Dockerfile", "docker-compose.yml",
"docker-compose.yml",
# Environment Variables # Environment Variables
".env", ".env", ".env.example",
".env.example",
# Deployment # Deployment
"Procfile", "Procfile", "vercel.json", "netlify.toml", "app.yaml",
"vercel.json",
"netlify.toml",
"app.yaml",
# Documentation # Documentation
"README.md", "README.md", "CONTRIBUTING.md", "LICENSE", "CHANGELOG.md",
"CONTRIBUTING.md",
"LICENSE",
"CHANGELOG.md",
# Language-specific # Language-specific
"setup.py", "setup.py", "__init__.py", "Rakefile", ".babelrc", ".npmrc", ".htaccess",
"__init__.py",
"Rakefile",
".babelrc",
".npmrc",
".htaccess",
# Framework-specific # Framework-specific
"manage.py", "manage.py", "settings.py", "routes.rb",
"settings.py",
"routes.rb",
# Testing # Testing
"pytest.ini", "pytest.ini", "phpunit.xml", "karma.conf.js",
"phpunit.xml",
"karma.conf.js",
# Security # Security
".npmrc", ".npmrc", ".pypirc",
".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): 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"): if dir_name.endswith(".github/workflows") and file_name.endswith(".yml"):
return True 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( return file_name in important_files or any(
file_path.endswith(f"/{name}") for name in important_files file_path.endswith(f"/{name}") for name in important_files
) )