Commit Graph

3 Commits

Author SHA1 Message Date
63ad3f2441 feat: comprehensive architecture rules v2.0 with all enforcement patterns
Massively expanded architecture rules based on documentation analysis:

New Rule Categories Added:
- Naming Convention Rules (NAM-001 to NAM-005)
- JavaScript Rules (JS-001 to JS-007)
- Template Rules (TPL-001 to TPL-007)
- Styling Rules (CSS-001 to CSS-004)
- Middleware Rules (MDW-001 to MDW-002)
- Multi-Tenancy Rules (MT-001 to MT-002)
- Auth Rules (AUTH-001 to AUTH-003)
- Code Quality Rules (QUAL-001 to QUAL-003)

Enhanced Existing Rules:
- API rules now include multi-tenant scoping (API-005)
- Service rules include vendor scoping check (SVC-005)
- Model rules include from_attributes check (MDL-003)
- Exception rules include logging guidance (EXC-003)

Total Rules: 50+ comprehensive architectural patterns
- Backend: 20 rules
- Frontend JS: 7 rules
- Frontend Templates: 7 rules
- Frontend Styling: 4 rules
- Naming: 5 rules
- Quality: 3 rules
- Security: 5 rules

All rules documented with:
- File patterns
- Severity levels
- Good/bad examples
- Enforcement mechanisms

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 19:58:38 +01:00
c0794295e2 fix: exclude venv and .venv from architecture validation
- Update .architecture-rules.yaml to ignore venv/.venv directories
- Improve _should_ignore_file() method to handle venv path exclusions
- Add explicit checks for .venv/ and venv/ in file paths

This prevents the architecture validator from scanning thousands of
files in virtual environment directories, reducing validation time
from scanning all dependency files to just project files.

Before: Scanned venv files (thousands of violations in dependencies)
After: Only scans project files (123 files checked)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 19:47:57 +01:00
1e720ae0e5 feat: add architecture validation system with comprehensive pattern enforcement
Implemented automated architecture validation to enforce design decisions:

Architecture Validation System:
- Created .architecture-rules.yaml with comprehensive rule definitions
- Implemented validate_architecture.py script with AST-based validation
- Added pre-commit hook configuration for automatic validation
- Comprehensive documentation in docs/architecture/architecture-patterns.md

Key Design Rules Enforced:
- API-001 to API-004: API endpoint patterns (Pydantic models, no business logic, exception handling, auth)
- SVC-001 to SVC-004: Service layer patterns (domain exceptions, db session params, no HTTP concerns)
- MDL-001 to MDL-002: Model separation (SQLAlchemy vs Pydantic)
- EXC-001 to EXC-002: Exception handling (custom exceptions, no bare except)
- JS-001 to JS-003: JavaScript patterns (apiClient, logger, Alpine components)
- TPL-001: Template patterns (extend base.html)

Features:
- Validates separation of concerns (routes vs services vs models)
- Enforces proper exception handling (domain exceptions in services, HTTP in routes)
- Checks database session patterns and Pydantic model usage
- JavaScript and template validation
- Detailed error reporting with suggestions
- Integration with pre-commit hooks and CI/CD

UI Fix:
- Fixed icon names in content-pages.html (pencil→edit, trash→delete)

Documentation:
- Added architecture patterns guide with examples
- Created scripts/README.md for validator usage
- Updated mkdocs.yml with architecture documentation
- Built and verified documentation successfully

Usage:
  python scripts/validate_architecture.py              # Validate all
  python scripts/validate_architecture.py --verbose    # With details
  python scripts/validate_architecture.py --errors-only # Errors only

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 07:44:51 +01:00