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:
@@ -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.
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user