refactor(scripts): reorganize scripts/ into seed/ and validate/ subfolders

Move 9 init/seed scripts into scripts/seed/ and 7 validation scripts
(+ validators/ subfolder) into scripts/validate/ to reduce clutter in
the root scripts/ directory. Update all references across Makefile,
CI/CD configs, pre-commit hooks, docs (~40 files), and Python imports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 21:35:53 +01:00
parent d201221fb1
commit 7a9dda282d
63 changed files with 173 additions and 174 deletions

View File

@@ -409,7 +409,7 @@ language: '{{ request.state.language|default("fr") }}'
### 6.1 LANG-001 False Positive
**File:** `scripts/validate_architecture.py`
**File:** `scripts/validate/validate_architecture.py`
**Problem:** Validator flagged "English" as invalid language code in `SUPPORTED_LANGUAGES` dict (where it's a display name, not a code).
@@ -456,7 +456,7 @@ if in_language_names_block and stripped in ("}", "]"):
After these changes:
```bash
$ python scripts/validate_architecture.py
$ python scripts/validate/validate_architecture.py
Files checked: 439
Findings: 0 errors, 141 warnings, 2 info

View File

@@ -1,6 +1,6 @@
# Architecture Rules Reference
This document provides a comprehensive reference for all architectural rules enforced by the `scripts/validate_architecture.py` validator.
This document provides a comprehensive reference for all architectural rules enforced by the `scripts/validate/validate_architecture.py` validator.
## Overview
@@ -33,23 +33,23 @@ make qa
```bash
# Check all files
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
# Check specific directory
python scripts/validate_architecture.py -d app/api/
python scripts/validate/validate_architecture.py -d app/api/
# Check a single file
python scripts/validate_architecture.py -f app/api/v1/admin/stores.py
python scripts/validate/validate_architecture.py -f app/api/v1/admin/stores.py
# Check all files for an entity
python scripts/validate_architecture.py -o merchant
python scripts/validate_architecture.py -o store
python scripts/validate/validate_architecture.py -o merchant
python scripts/validate/validate_architecture.py -o store
# Verbose output
python scripts/validate_architecture.py --verbose
python scripts/validate/validate_architecture.py --verbose
# JSON output (for CI/CD)
python scripts/validate_architecture.py --json
python scripts/validate/validate_architecture.py --json
```
### Output Format
@@ -1072,7 +1072,7 @@ Before committing code:
- [ ] Run `make format` (Ruff formatting)
- [ ] Run `make lint` (Ruff + mypy)
- [ ] Run `python scripts/validate_architecture.py`
- [ ] Run `python scripts/validate/validate_architecture.py`
- [ ] Fix all **Error** level violations
- [ ] Review **Warning** level violations
- [ ] Run relevant tests
@@ -1099,7 +1099,7 @@ Before committing code:
All rules are defined in `.architecture-rules.yaml`. To modify rules:
1. Edit `.architecture-rules.yaml`
2. Update `scripts/validate_architecture.py` if implementing new checks
2. Update `scripts/validate/validate_architecture.py` if implementing new checks
3. Run validator to test changes
4. Update this documentation

View File

@@ -8,7 +8,7 @@ This document tracks the implementation of the Code Quality Dashboard for tracki
## Overview
The Code Quality Dashboard provides a UI for viewing, managing, and tracking architecture violations detected by `scripts/validate_architecture.py`. This allows teams to:
The Code Quality Dashboard provides a UI for viewing, managing, and tracking architecture violations detected by `scripts/validate/validate_architecture.py`. This allows teams to:
- View violations in a user-friendly interface
- Track technical debt over time
@@ -90,7 +90,7 @@ class CodeQualityService:
Run architecture validator and store results
Steps:
1. Execute scripts/validate_architecture.py
1. Execute scripts/validate/validate_architecture.py
2. Parse JSON output
3. Create ArchitectureScan record
4. Create ArchitectureViolation records
@@ -216,7 +216,7 @@ def run_scan(db: Session, triggered_by: str = 'manual') -> ArchitectureScan:
# Run validator
start_time = datetime.now()
result = subprocess.run(
['python', 'scripts/validate_architecture.py', '--json'],
['python', 'scripts/validate/validate_architecture.py', '--json'],
capture_output=True,
text=True
)
@@ -563,7 +563,7 @@ function codeQualityDashboard() {
## Validator Output Format
**Update:** `scripts/validate_architecture.py`
**Update:** `scripts/validate/validate_architecture.py`
Add JSON output support:

View File

@@ -501,7 +501,7 @@ Existing modules (CMS, billing, marketplace, etc.) currently have their migratio
Run the architecture validator to check your module:
```bash
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
```
### Validation Rules
@@ -538,7 +538,7 @@ python scripts/validate_architecture.py
- [ ] Create locales (en, de, fr, lu)
- [ ] Create `config.py` if module needs environment settings (optional)
- [ ] Create `migrations/versions/` with `__init__.py` files if module has database tables
- [ ] Run `python scripts/validate_architecture.py`
- [ ] Run `python scripts/validate/validate_architecture.py`
- [ ] Test routes are accessible
### No Framework Changes Needed

View File

@@ -368,7 +368,7 @@ make help-db
### Adding New Admin Settings
Edit `scripts/init_production.py` to add new platform settings:
Edit `scripts/seed/init_production.py` to add new platform settings:
```python
def create_admin_settings(db: Session) -> int:
@@ -391,7 +391,7 @@ def create_admin_settings(db: Session) -> int:
### Adding New Demo Data
Edit `scripts/seed_demo.py` to extend demo data creation:
Edit `scripts/seed/seed_demo.py` to extend demo data creation:
```python
def seed_demo_data(db: Session, auth_manager: AuthManager):
@@ -468,7 +468,7 @@ if settings.your_boolean_setting:
### Adding New Demo Store Configurations
Edit the `DEMO_STORES` list in `scripts/seed_demo.py`:
Edit the `DEMO_STORES` list in `scripts/seed/seed_demo.py`:
```python
DEMO_STORES = [
@@ -507,7 +507,7 @@ Add corresponding Makefile command:
```makefile
seed-demo-custom:
@echo 🎪 Seeding custom demo data...
@set SEED_MODE=custom&& $(PYTHON) scripts/seed_demo.py
@set SEED_MODE=custom&& $(PYTHON) scripts/seed/seed_demo.py
@echo ✅ Custom demo seeding completed
```

View File

@@ -364,7 +364,7 @@ To create platform-level default content pages (About, Contact, FAQ, Shipping, R
```bash
make create-cms-defaults
# or
python scripts/create_default_content_pages.py
python scripts/seed/create_default_content_pages.py
```
This creates 7 platform default pages that all stores inherit:

View File

@@ -171,7 +171,7 @@ migrate-status:
backup-db:
@echo Creating database backup...
@$(PYTHON) scripts/backup_database.py
@$(PYTHON) scripts/seed/backup_database.py
seed:
@echo Seeding database with comprehensive test data...

View File

@@ -34,7 +34,7 @@ Successfully refactored the Makefile to establish clear separation between **pro
**Before:**
```makefile
init-prod:
$(PYTHON) scripts/init_production.py
$(PYTHON) scripts/seed/init_production.py
```
**After:**
@@ -42,13 +42,13 @@ init-prod:
init-prod:
@echo "🔧 Initializing production database..."
@echo "Step 1/4: Creating admin user and platform alerts..."
$(PYTHON) scripts/init_production.py
$(PYTHON) scripts/seed/init_production.py
@echo "Step 2/4: Initializing log settings..."
$(PYTHON) scripts/init_log_settings.py
$(PYTHON) scripts/seed/init_log_settings.py
@echo "Step 3/4: Creating default CMS content pages..."
$(PYTHON) scripts/create_default_content_pages.py
$(PYTHON) scripts/seed/create_default_content_pages.py
@echo "Step 4/4: Creating platform pages and landing..."
$(PYTHON) scripts/create_platform_pages.py
$(PYTHON) scripts/seed/create_platform_pages.py
@echo "✅ Production initialization completed"
```
@@ -85,13 +85,13 @@ Now properly re-initializes the platform after reset!
```makefile
# Utility commands (usually not needed - init-prod handles these)
create-cms-defaults:
$(PYTHON) scripts/create_default_content_pages.py
$(PYTHON) scripts/seed/create_default_content_pages.py
create-platform-pages:
$(PYTHON) scripts/create_platform_pages.py
$(PYTHON) scripts/seed/create_platform_pages.py
init-logging:
$(PYTHON) scripts/init_log_settings.py
$(PYTHON) scripts/seed/init_log_settings.py
```
These are now available for advanced use cases or re-running specific steps.

View File

@@ -242,14 +242,14 @@ store_router.include_router(store_feature1_router, tags=["store-feature1"])
Run architecture validation to check compliance:
```bash
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
```
Check for legacy location violations:
```bash
python scripts/validate_architecture.py -d app/api/v1/store
python scripts/validate_architecture.py -d app/services
python scripts/validate/validate_architecture.py -d app/api/v1/store
python scripts/validate/validate_architecture.py -d app/services
```
Verify route count:

View File

@@ -177,7 +177,7 @@ return SomeResponse(...)
grep -n "db.commit()" app/services/<service_name>.py
# Run architecture validator
python scripts/validate_architecture.py -o <entity_name>
python scripts/validate/validate_architecture.py -o <entity_name>
# Run tests
pytest tests/test_<service_name>.py -v
@@ -230,7 +230,7 @@ If issues are found after migration:
Run this command to check remaining violations:
```bash
python scripts/validate_architecture.py 2>&1 | grep "SVC-006" | wc -l
python scripts/validate/validate_architecture.py 2>&1 | grep "SVC-006" | wc -l
```
Current status: **60 remaining** (down from 66)
@@ -253,14 +253,14 @@ The SVC-006 rule is set to **warning** (not error), so CI won't fail. This allow
```bash
# Count remaining violations
python scripts/validate_architecture.py 2>&1 | grep "SVC-006" | wc -l
python scripts/validate/validate_architecture.py 2>&1 | grep "SVC-006" | wc -l
# List services with commits (sorted by count)
grep -c "db.commit()" app/services/*.py | grep -v ":0$" | sort -t: -k2 -n
# Validate specific entity
python scripts/validate_architecture.py -o store
python scripts/validate/validate_architecture.py -o store
# Validate specific file
python scripts/validate_architecture.py -f app/services/admin_service.py
python scripts/validate/validate_architecture.py -f app/services/admin_service.py
```

View File

@@ -1,6 +1,6 @@
# Performance Rules Reference
This document provides a comprehensive reference for all performance rules enforced by the `scripts/validate_performance.py` validator.
This document provides a comprehensive reference for all performance rules enforced by the `scripts/validate/validate_performance.py` validator.
## Overview
@@ -16,26 +16,26 @@ The performance validator identifies potential performance issues and enforces b
```bash
# Check all files
python scripts/validate_performance.py
python scripts/validate/validate_performance.py
# Verbose output
python scripts/validate_performance.py -v
python scripts/validate/validate_performance.py -v
# Errors only
python scripts/validate_performance.py --errors-only
python scripts/validate/validate_performance.py --errors-only
# JSON output (for CI/CD)
python scripts/validate_performance.py --json
python scripts/validate/validate_performance.py --json
```
### Using the Unified Validator
```bash
# Run performance checks only
python scripts/validate_all.py --performance
python scripts/validate/validate_all.py --performance
# Run all validators
python scripts/validate_all.py
python scripts/validate/validate_all.py
```
## Severity Levels

View File

@@ -1,6 +1,6 @@
# Security Rules Reference
This document provides a comprehensive reference for all security rules enforced by the `scripts/validate_security.py` validator.
This document provides a comprehensive reference for all security rules enforced by the `scripts/validate/validate_security.py` validator.
## Overview
@@ -16,26 +16,26 @@ The security validator identifies potential security vulnerabilities and enforce
```bash
# Check all files
python scripts/validate_security.py
python scripts/validate/validate_security.py
# Verbose output
python scripts/validate_security.py -v
python scripts/validate/validate_security.py -v
# Errors only
python scripts/validate_security.py --errors-only
python scripts/validate/validate_security.py --errors-only
# JSON output (for CI/CD)
python scripts/validate_security.py --json
python scripts/validate/validate_security.py --json
```
### Using the Unified Validator
```bash
# Run security checks only
python scripts/validate_all.py --security
python scripts/validate/validate_all.py --security
# Run all validators
python scripts/validate_all.py
python scripts/validate/validate_all.py
```
## Severity Levels

View File

@@ -113,14 +113,14 @@ python scripts/utils/create_landing_page.py [store_subdomain]
```makefile
# Full setup with inventory
seed-demo-full:
$(PYTHON) scripts/seed_demo.py --include-inventory --include-landing
$(PYTHON) scripts/seed/seed_demo.py --include-inventory --include-landing
# Utility commands (if keeping separate)
create-inventory:
$(PYTHON) scripts/create_inventory.py
init-logging:
$(PYTHON) scripts/init_log_settings.py
$(PYTHON) scripts/seed/init_log_settings.py
```
## 📋 Recommended File Structure
@@ -185,9 +185,9 @@ scripts/
7. 📝 **Add --options to seed_demo.py**
```bash
python scripts/seed_demo.py --skip-inventory
python scripts/seed_demo.py --minimal
python scripts/seed_demo.py --help
python scripts/seed/seed_demo.py --skip-inventory
python scripts/seed/seed_demo.py --minimal
python scripts/seed/seed_demo.py --help
```
## 🚀 Expected Result After Refactoring