mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
97 lines
4.9 KiB
JSON
97 lines
4.9 KiB
JSON
{
|
|
"package_name": "codeflash-internal-rules",
|
|
"total_capabilities": 13,
|
|
"capabilities": [
|
|
{
|
|
"id": 0,
|
|
"name": "python-async-endpoints",
|
|
"description": "All Django-Ninja endpoints must be async def, using asyncio.TaskGroup for concurrent operations and ninja.Schema or Pydantic BaseModel for request/response types",
|
|
"complexity": "basic",
|
|
"api_elements": ["async def", "asyncio.TaskGroup", "ninja.Schema", "BaseModel"]
|
|
},
|
|
{
|
|
"id": 1,
|
|
"name": "libcst-for-transforms",
|
|
"description": "Use libcst for all code transformations that modify source code (preserves formatting); ast is only acceptable for read-only analysis",
|
|
"complexity": "intermediate",
|
|
"api_elements": ["libcst", "ast.parse", "ast.dump"]
|
|
},
|
|
{
|
|
"id": 2,
|
|
"name": "llm-calls-via-llm-py",
|
|
"description": "All LLM provider calls must go through aiservice/llm.py, never calling provider APIs directly, with prompts stored as .md files rendered via Jinja2",
|
|
"complexity": "intermediate",
|
|
"api_elements": ["aiservice/llm.py", "Jinja2", ".md prompts"]
|
|
},
|
|
{
|
|
"id": 3,
|
|
"name": "lazy-imports-in-routers",
|
|
"description": "Router endpoints must use lazy imports inside function bodies to avoid circular dependencies, with noqa: PLC0415 suppression comments",
|
|
"complexity": "basic",
|
|
"api_elements": ["noqa: PLC0415", "lazy import", "router dispatch"]
|
|
},
|
|
{
|
|
"id": 4,
|
|
"name": "monorepo-directory-placement",
|
|
"description": "New code must be placed in the correct monorepo directory: language handlers in core/languages/<lang>/, shared routers in core/shared/, tests in tests/ by feature",
|
|
"complexity": "basic",
|
|
"api_elements": ["core/languages/", "core/shared/", "tests/"]
|
|
},
|
|
{
|
|
"id": 5,
|
|
"name": "registry-handler-pattern",
|
|
"description": "New language handlers must use @register_handler decorator, set supports_* flags, implement protocol methods, and be imported in core/languages/__init__.py",
|
|
"complexity": "advanced",
|
|
"api_elements": ["@register_handler", "LanguageRegistry", "supports_*", "core/languages/__init__.py"]
|
|
},
|
|
{
|
|
"id": 6,
|
|
"name": "feature-dispatcher-protocol",
|
|
"description": "Handlers must implement runtime-checkable protocols (OptimizerProtocol, TestGenProtocol, CodeRepairProtocol) and integrate with get_handler_for_feature() dispatcher",
|
|
"complexity": "advanced",
|
|
"api_elements": ["Feature enum", "get_handler_for_feature", "OptimizerProtocol", "TestGenProtocol", "CodeRepairProtocol"]
|
|
},
|
|
{
|
|
"id": 7,
|
|
"name": "conventional-commits-and-branching",
|
|
"description": "Commits must use conventional format (fix:, feat:, refactor:, etc.), branches must be created from main with cf-#-title naming, and commits must be atomic",
|
|
"complexity": "basic",
|
|
"api_elements": ["fix:", "feat:", "refactor:", "cf-#-title", "main"]
|
|
},
|
|
{
|
|
"id": 8,
|
|
"name": "pre-commit-and-tooling",
|
|
"description": "Run prek pre-commit hooks via uv run prek run --all-files, use Ruff for linting/formatting, and uv for all Python package operations",
|
|
"complexity": "basic",
|
|
"api_elements": ["uv run prek run --all-files", "ruff check", "ruff format", "uv run"]
|
|
},
|
|
{
|
|
"id": 9,
|
|
"name": "python-test-conventions",
|
|
"description": "Tests organized by feature in tests/, use @pytest.mark.asyncio for async tests, leverage test factories like create_optimizer_context(), and run via uv run pytest",
|
|
"complexity": "intermediate",
|
|
"api_elements": ["@pytest.mark.asyncio", "DJANGO_SETTINGS_MODULE", "create_optimizer_context", "uv run pytest"]
|
|
},
|
|
{
|
|
"id": 10,
|
|
"name": "pr-review-guidelines",
|
|
"description": "PR reviews must focus on logic errors, security vulnerabilities, test name typos, and breaking changes; must skip style/formatting comments and limit to 5-7 high-signal comments",
|
|
"complexity": "intermediate",
|
|
"api_elements": ["logic errors", "security vulnerabilities", "5-7 comments"]
|
|
},
|
|
{
|
|
"id": 11,
|
|
"name": "cfapi-webhook-and-di-patterns",
|
|
"description": "cf-api webhook routes must be registered before body parser for signature verification, and tests must use setXxxDependencies()/resetXxxDependencies() DI pattern",
|
|
"complexity": "intermediate",
|
|
"api_elements": ["webhook before body parser", "setXxxDependencies", "resetXxxDependencies", "instrument.ts"]
|
|
},
|
|
{
|
|
"id": 12,
|
|
"name": "optimization-postprocessing",
|
|
"description": "Optimization candidates must be deduplicated via ast.parse()+ast.dump(), checked for no-op equality against original code, and use model distribution formula claude_calls=(total-1)//2",
|
|
"complexity": "advanced",
|
|
"api_elements": ["ast.parse", "ast.dump", "postprocess.py", "get_model_distribution", "claude_calls = (total - 1) // 2"]
|
|
}
|
|
]
|
|
}
|