refactor: split architecture rules into domain-specific files
Split the monolithic .architecture-rules.yaml (1700+ lines) into focused domain-specific files in .architecture-rules/ directory: - _main.yaml: Core config, principles, ignore patterns, severity levels - api.yaml: API endpoint rules (API-001 to API-005) - service.yaml: Service layer rules (SVC-001 to SVC-007) - model.yaml: Model rules (MDL-001 to MDL-004) - exception.yaml: Exception handling rules (EXC-001 to EXC-005) - naming.yaml: Naming convention rules (NAM-001 to NAM-005) - auth.yaml: Auth and multi-tenancy rules (AUTH-*, MT-*) - middleware.yaml: Middleware rules (MDW-001 to MDW-002) - frontend.yaml: Frontend rules (JS-*, TPL-*, FE-*, CSS-*) - language.yaml: Language/i18n rules (LANG-001 to LANG-010) - quality.yaml: Code quality rules (QUAL-001 to QUAL-003) Also creates scripts/validators/ module with base classes for future modular validator extraction. The validate_architecture.py loader now auto-detects and merges split YAML files while maintaining backward compatibility with single file mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
102
.architecture-rules/_main.yaml
Normal file
102
.architecture-rules/_main.yaml
Normal file
@@ -0,0 +1,102 @@
|
||||
# Architecture Rules - Main Configuration
|
||||
# This file defines core settings and includes domain-specific rule files.
|
||||
|
||||
version: "2.0"
|
||||
project: "letzshop-product-import"
|
||||
description: "Comprehensive architectural rules for multi-tenant e-commerce platform"
|
||||
|
||||
# ============================================================================
|
||||
# CORE ARCHITECTURAL PRINCIPLES
|
||||
# ============================================================================
|
||||
|
||||
principles:
|
||||
- name: "Separation of Concerns"
|
||||
description: "API endpoints should only handle HTTP concerns. Business logic belongs in services."
|
||||
|
||||
- name: "Layered Architecture"
|
||||
description: "Routes → Services → Models. Each layer has specific responsibilities."
|
||||
|
||||
- name: "Type Safety"
|
||||
description: "Use Pydantic models for request/response validation. Use SQLAlchemy models for database."
|
||||
|
||||
- name: "Proper Exception Handling"
|
||||
description: "Services throw domain exceptions. Global handler converts to HTTP responses. Endpoints do NOT catch or raise HTTPException."
|
||||
|
||||
- name: "Multi-Tenancy"
|
||||
description: "All queries must be scoped to vendor_id. No cross-vendor data access."
|
||||
|
||||
- name: "Consistent Naming"
|
||||
description: "API files: plural, Services: singular+service, Models: singular"
|
||||
|
||||
# ============================================================================
|
||||
# RULE FILE INCLUDES
|
||||
# ============================================================================
|
||||
|
||||
includes:
|
||||
- api.yaml
|
||||
- service.yaml
|
||||
- model.yaml
|
||||
- exception.yaml
|
||||
- naming.yaml
|
||||
- auth.yaml
|
||||
- middleware.yaml
|
||||
- frontend.yaml
|
||||
- language.yaml
|
||||
- quality.yaml
|
||||
|
||||
# ============================================================================
|
||||
# VALIDATION SEVERITY LEVELS
|
||||
# ============================================================================
|
||||
|
||||
severity_levels:
|
||||
error:
|
||||
description: "Critical architectural violation - must be fixed"
|
||||
exit_code: 1
|
||||
|
||||
warning:
|
||||
description: "Pattern deviation - should be fixed"
|
||||
exit_code: 0
|
||||
|
||||
info:
|
||||
description: "Suggestion for improvement"
|
||||
exit_code: 0
|
||||
|
||||
# ============================================================================
|
||||
# IGNORED PATTERNS
|
||||
# ============================================================================
|
||||
|
||||
ignore:
|
||||
files:
|
||||
- "**/*_test.py"
|
||||
- "**/test_*.py"
|
||||
- "**/__pycache__/**"
|
||||
- "**/migrations/**"
|
||||
- "**/alembic/versions/**"
|
||||
- "**/node_modules/**"
|
||||
- "**/.venv/**"
|
||||
- "**/venv/**"
|
||||
- ".venv/**"
|
||||
- "venv/**"
|
||||
- "**/build/**"
|
||||
- "**/dist/**"
|
||||
|
||||
patterns:
|
||||
# Allow HTTPException in specific files
|
||||
- file: "app/core/exceptions.py"
|
||||
pattern: "HTTPException"
|
||||
reason: "Exception handling utilities"
|
||||
|
||||
- file: "app/exceptions/handler.py"
|
||||
pattern: "HTTPException"
|
||||
reason: "Exception handler converts to HTTP"
|
||||
|
||||
# ============================================================================
|
||||
# DOCUMENTATION
|
||||
# ============================================================================
|
||||
|
||||
documentation:
|
||||
architecture: "docs/architecture/overview.md"
|
||||
backend: "docs/backend/overview.md"
|
||||
frontend: "docs/frontend/overview.md"
|
||||
contributing: "docs/development/contributing.md"
|
||||
code_quality: "docs/development/code-quality.md"
|
||||
Reference in New Issue
Block a user