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 = [
# 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
)