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

@@ -79,7 +79,7 @@ architecture:
- pip install uv
- uv sync --frozen
script:
- .venv/bin/python scripts/validate_architecture.py
- .venv/bin/python scripts/validate/validate_architecture.py
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
@@ -106,7 +106,7 @@ audit:
- pip install uv
- uv sync --frozen
script:
- .venv/bin/python scripts/validate_audit.py
- .venv/bin/python scripts/validate/validate_audit.py
allow_failure: true
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"

View File

@@ -20,7 +20,7 @@
<!-- Describe how you tested these changes -->
- [ ] Unit tests pass (`pytest tests/`)
- [ ] Architecture validation passes (`python scripts/validate_architecture.py`)
- [ ] Architecture validation passes (`python scripts/validate/validate_architecture.py`)
- [ ] Manual testing performed
## Checklist

View File

@@ -1,7 +1,7 @@
# Performance Rules Configuration
# ================================
# Performance-focused validation rules for the codebase.
# Run with: python scripts/validate_performance.py
# Run with: python scripts/validate/validate_performance.py
version: "1.0"
project: "letzshop-product-import"

View File

@@ -9,7 +9,7 @@ repos:
hooks:
- id: validate-architecture
name: Validate Architecture Patterns
entry: python scripts/validate_architecture.py
entry: python scripts/validate/validate_architecture.py
language: python
pass_filenames: false
always_run: true

View File

@@ -1,7 +1,7 @@
# Security Rules Configuration
# ============================
# Security-focused validation rules for the codebase.
# Run with: python scripts/validate_security.py
# Run with: python scripts/validate/validate_security.py
version: "1.0"
project: "letzshop-product-import"

View File

@@ -105,19 +105,19 @@ init-prod:
@$(PYTHON) -m alembic upgrade heads
@echo ""
@echo "Step 1/6: Creating admin user and platform settings..."
$(PYTHON) scripts/init_production.py
$(PYTHON) scripts/seed/init_production.py
@echo ""
@echo "Step 2/6: Initializing log settings..."
$(PYTHON) scripts/init_log_settings.py
$(PYTHON) scripts/seed/init_log_settings.py
@echo ""
@echo "Step 3/6: Creating default CMS content pages..."
$(PYTHON) scripts/create_default_content_pages.py
$(PYTHON) scripts/seed/create_default_content_pages.py
@echo ""
@echo "Step 4/6: Creating platform pages and landing..."
$(PYTHON) scripts/create_platform_pages.py
$(PYTHON) scripts/seed/create_platform_pages.py
@echo ""
@echo "Step 5/6: Seeding email templates..."
$(PYTHON) scripts/seed_email_templates.py
$(PYTHON) scripts/seed/seed_email_templates.py
@echo ""
@echo "Step 6/6: Seeding subscription tiers..."
@echo " (Handled by init_production.py Step 6)"
@@ -127,40 +127,40 @@ init-prod:
seed-tiers:
@echo "🏷️ Seeding subscription tiers..."
$(PYTHON) -c "from scripts.init_production import *; from app.core.database import SessionLocal; from sqlalchemy import select; db = SessionLocal(); oms = db.execute(select(Platform).where(Platform.code == 'oms')).scalar_one_or_none(); create_subscription_tiers(db, oms) if oms else print('OMS platform not found'); db.commit(); db.close()"
$(PYTHON) -c "from scripts.seed.init_production import *; from app.core.database import SessionLocal; from sqlalchemy import select; db = SessionLocal(); oms = db.execute(select(Platform).where(Platform.code == 'oms')).scalar_one_or_none(); create_subscription_tiers(db, oms) if oms else print('OMS platform not found'); db.commit(); db.close()"
@echo "✅ Subscription tiers seeded"
# First-time installation - Complete setup with configuration validation
platform-install:
@echo "🚀 WIZAMART PLATFORM INSTALLATION"
@echo "=================================="
$(PYTHON) scripts/install.py
$(PYTHON) scripts/seed/install.py
# Demo data seeding - Cross-platform using Python to set environment
seed-demo:
@echo "🎪 Seeding demo data (normal mode)..."
ifeq ($(DETECTED_OS),Windows)
@set SEED_MODE=normal&& $(PYTHON) scripts/seed_demo.py
@set SEED_MODE=normal&& $(PYTHON) scripts/seed/seed_demo.py
else
SEED_MODE=normal $(PYTHON) scripts/seed_demo.py
SEED_MODE=normal $(PYTHON) scripts/seed/seed_demo.py
endif
@echo "✅ Demo seeding completed"
seed-demo-minimal:
@echo "🎪 Seeding demo data (minimal mode - 1 store only)..."
ifeq ($(DETECTED_OS),Windows)
@set SEED_MODE=minimal&& $(PYTHON) scripts/seed_demo.py
@set SEED_MODE=minimal&& $(PYTHON) scripts/seed/seed_demo.py
else
SEED_MODE=minimal $(PYTHON) scripts/seed_demo.py
SEED_MODE=minimal $(PYTHON) scripts/seed/seed_demo.py
endif
@echo "✅ Minimal demo seeding completed"
seed-demo-reset:
@echo "⚠️ WARNING: This will DELETE ALL existing data!"
ifeq ($(DETECTED_OS),Windows)
@set SEED_MODE=reset&& $(PYTHON) scripts/seed_demo.py
@set SEED_MODE=reset&& $(PYTHON) scripts/seed/seed_demo.py
else
SEED_MODE=reset $(PYTHON) scripts/seed_demo.py
SEED_MODE=reset $(PYTHON) scripts/seed/seed_demo.py
endif
db-setup: migrate-up init-prod seed-demo
@@ -175,34 +175,34 @@ db-reset:
@echo "Applying all migrations..."
$(PYTHON) -m alembic upgrade head
@echo "Initializing production data..."
$(PYTHON) scripts/init_production.py
$(PYTHON) scripts/seed/init_production.py
@echo "Seeding demo data..."
ifeq ($(DETECTED_OS),Windows)
@set SEED_MODE=reset&& set FORCE_RESET=true&& $(PYTHON) scripts/seed_demo.py
@set SEED_MODE=reset&& set FORCE_RESET=true&& $(PYTHON) scripts/seed/seed_demo.py
else
SEED_MODE=reset FORCE_RESET=true $(PYTHON) scripts/seed_demo.py
SEED_MODE=reset FORCE_RESET=true $(PYTHON) scripts/seed/seed_demo.py
endif
@echo ""
@echo "✅ Database completely reset!"
backup-db:
@echo "Creating database backup..."
@$(PYTHON) scripts/backup_database.py
@$(PYTHON) scripts/seed/backup_database.py
# Utility commands (usually not needed - init-prod handles these)
create-cms-defaults:
@echo "📄 Creating default CMS content pages..."
$(PYTHON) scripts/create_default_content_pages.py
$(PYTHON) scripts/seed/create_default_content_pages.py
@echo "✅ CMS defaults created"
create-platform-pages:
@echo "🏠 Creating platform pages and landing..."
$(PYTHON) scripts/create_platform_pages.py
$(PYTHON) scripts/seed/create_platform_pages.py
@echo "✅ Platform pages created"
init-logging:
@echo "📝 Initializing log settings..."
$(PYTHON) scripts/init_log_settings.py
$(PYTHON) scripts/seed/init_log_settings.py
@echo "✅ Log settings initialized"
# =============================================================================
@@ -325,31 +325,31 @@ ci: lint-strict verify-imports test-coverage
verify-imports:
@echo "Verifying critical imports..."
$(PYTHON) scripts/verify_critical_imports.py
$(PYTHON) scripts/validate/verify_critical_imports.py
arch-check:
@echo "Running architecture validation..."
$(PYTHON) scripts/validate_architecture.py
$(PYTHON) scripts/validate/validate_architecture.py
arch-check-file:
ifeq ($(DETECTED_OS),Windows)
@if "$(file)"=="" (echo Error: Please provide a file. Usage: make arch-check-file file="path/to/file.py") else ($(PYTHON) scripts/validate_architecture.py -f "$(file)")
@if "$(file)"=="" (echo Error: Please provide a file. Usage: make arch-check-file file="path/to/file.py") else ($(PYTHON) scripts/validate/validate_architecture.py -f "$(file)")
else
@if [ -z "$(file)" ]; then \
echo "Error: Please provide a file. Usage: make arch-check-file file=\"path/to/file.py\""; \
else \
$(PYTHON) scripts/validate_architecture.py -f "$(file)"; \
$(PYTHON) scripts/validate/validate_architecture.py -f "$(file)"; \
fi
endif
arch-check-object:
ifeq ($(DETECTED_OS),Windows)
@if "$(name)"=="" (echo Error: Please provide an object name. Usage: make arch-check-object name="merchant") else ($(PYTHON) scripts/validate_architecture.py -o "$(name)")
@if "$(name)"=="" (echo Error: Please provide an object name. Usage: make arch-check-object name="merchant") else ($(PYTHON) scripts/validate/validate_architecture.py -o "$(name)")
else
@if [ -z "$(name)" ]; then \
echo "Error: Please provide an object name. Usage: make arch-check-object name=\"merchant\""; \
else \
$(PYTHON) scripts/validate_architecture.py -o "$(name)"; \
$(PYTHON) scripts/validate/validate_architecture.py -o "$(name)"; \
fi
endif

View File

@@ -28,9 +28,9 @@ VALID_VALIDATOR_TYPES = [VALIDATOR_ARCHITECTURE, VALIDATOR_SECURITY, VALIDATOR_P
# Map validator types to their scripts
VALIDATOR_SCRIPTS = {
VALIDATOR_ARCHITECTURE: "scripts/validate_architecture.py",
VALIDATOR_SECURITY: "scripts/validate_security.py",
VALIDATOR_PERFORMANCE: "scripts/validate_performance.py",
VALIDATOR_ARCHITECTURE: "scripts/validate/validate_architecture.py",
VALIDATOR_SECURITY: "scripts/validate/validate_security.py",
VALIDATOR_PERFORMANCE: "scripts/validate/validate_performance.py",
}
# Human-readable names

View File

@@ -2,7 +2,7 @@
This document describes the architectural patterns and design decisions that must be followed throughout the codebase.
> **Note:** These patterns are enforced automatically by `scripts/validate_architecture.py`. Run the validator before committing code.
> **Note:** These patterns are enforced automatically by `scripts/validate/validate_architecture.py`. Run the validator before committing code.
---
@@ -609,16 +609,16 @@ function storesManager() {
```bash
# Validate entire codebase
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
# Validate specific directory
python scripts/validate_architecture.py app/api/
python scripts/validate/validate_architecture.py app/api/
# Verbose output with context
python scripts/validate_architecture.py --verbose
python scripts/validate/validate_architecture.py --verbose
# Errors only (suppress warnings)
python scripts/validate_architecture.py --errors-only
python scripts/validate/validate_architecture.py --errors-only
```
### Pre-commit Hook
@@ -644,7 +644,7 @@ Add to your CI pipeline:
# .github/workflows/ci.yml
- name: Validate Architecture
run: |
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
```
---
@@ -703,4 +703,4 @@ class StoreService:
---
**Remember:** These patterns are enforced automatically. Run `python scripts/validate_architecture.py` before committing!
**Remember:** These patterns are enforced automatically. Run `python scripts/validate/validate_architecture.py` before committing!

View File

@@ -153,7 +153,7 @@ async def update_merchant_endpoint(merchant_id: int, data: MerchantUpdate, db: S
## Validation Command
```bash
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
```
## Next Actions

View File

@@ -183,7 +183,7 @@ def get_module_if_enabled(db, platform_id, module_code):
## Architecture Validation
The architecture validator (`scripts/validate_architecture.py`) includes rules to detect violations:
The architecture validator (`scripts/validate/validate_architecture.py`) includes rules to detect violations:
| Rule | Severity | Description |
|------|----------|-------------|
@@ -193,7 +193,7 @@ The architecture validator (`scripts/validate_architecture.py`) includes rules t
Run validation:
```bash
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
```
## Provider Pattern Summary

View File

@@ -262,7 +262,7 @@ pytest tests/unit/core/test_frontend_detector.py tests/unit/middleware/test_fron
## Architecture Rules
These rules are enforced by `scripts/validate_architecture.py`:
These rules are enforced by `scripts/validate/validate_architecture.py`:
| Rule | Description |
|------|-------------|

View File

@@ -1216,7 +1216,7 @@ MARKETPLACE_BATCH_SIZE=500
## Architecture Validation Rules
The architecture validator (`scripts/validate_architecture.py`) enforces module structure:
The architecture validator (`scripts/validate/validate_architecture.py`) enforces module structure:
| Rule | Severity | Description |
|------|----------|-------------|
@@ -1246,7 +1246,7 @@ The architecture validator (`scripts/validate_architecture.py`) enforces module
Run validation:
```bash
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
```
## Best Practices

View File

@@ -47,7 +47,7 @@ Add new rule:
### Task 1.2: Update validator to check this rule
**File:** `scripts/validate_architecture.py`
**File:** `scripts/validate/validate_architecture.py`
Add validation for API-007.
@@ -340,5 +340,5 @@ After migrated to `app/modules/cart/services/cart_service.py`.
### Modified Files
- `app/api/deps.py` (CustomerContext return type)
- `scripts/validate_architecture.py` (add API-007 check)
- `scripts/validate/validate_architecture.py` (add API-007 check)
- All files currently importing from legacy locations

View File

@@ -101,7 +101,7 @@ Committed all pending module migration work:
Run architecture validator and fix all modules to comply with rules:
```bash
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
```
Check each module for:

View File

@@ -246,7 +246,7 @@ router.include_router({module}_admin_router, tags=["admin-{module}"])
## Validation
After each module migration:
1. Run `python scripts/validate_architecture.py`
1. Run `python scripts/validate/validate_architecture.py`
2. Test affected endpoints manually
3. Verify imports work: `python -c "from app.api.v1.admin import router"`

View File

@@ -142,4 +142,4 @@ Added new rules to enforce module-first architecture:
- `/docs/architecture/module-system.md`
- `/docs/development/migration/module-autodiscovery-migration.md`
- `/.architecture-rules/module.yaml`
- `/scripts/validate_architecture.py`
- `/scripts/validate/validate_architecture.py`

View File

@@ -525,7 +525,7 @@ The architecture enforces a strict layered pattern for where exceptions should b
### Enforced by Architecture Validation
The validation script (`scripts/validate_architecture.py`) enforces these rules:
The validation script (`scripts/validate/validate_architecture.py`) enforces these rules:
**Rule API-003: Endpoints must NOT raise exceptions directly**
- Detects `raise HTTPException`, `raise InvalidTokenException`, etc. in endpoint files
@@ -542,7 +542,7 @@ Architecture validation runs on every commit:
hooks:
- id: validate-architecture
name: Validate Architecture Patterns
entry: python scripts/validate_architecture.py
entry: python scripts/validate/validate_architecture.py
language: python
pass_filenames: false
always_run: true
@@ -550,8 +550,8 @@ Architecture validation runs on every commit:
To run manually:
```bash
python scripts/validate_architecture.py # Full validation
python scripts/validate_architecture.py -d app/api/v1/store/ # Specific directory
python scripts/validate/validate_architecture.py # Full validation
python scripts/validate/validate_architecture.py -d app/api/v1/store/ # Specific directory
```
See `.architecture-rules.yaml` for the complete rule definitions.

View File

@@ -291,7 +291,7 @@ docker compose -f docker-compose.prod.yml up -d
docker compose -f docker-compose.prod.yml exec api alembic upgrade head
# Initialize data
docker compose -f docker-compose.prod.yml exec api python scripts/init_production.py
docker compose -f docker-compose.prod.yml exec api python scripts/seed/init_production.py
```
---

View File

@@ -85,7 +85,7 @@ source .venv/bin/activate
alembic upgrade head
# Initialize production data
python scripts/init_production.py
python scripts/seed/init_production.py
```
### 3. Static Assets

View File

@@ -248,7 +248,7 @@ nano .env # Edit with production values
sudo -u postgres createuser wizamart_user
sudo -u postgres createdb wizamart_db -O wizamart_user
alembic upgrade head
python scripts/init_production.py
python scripts/seed/init_production.py
# 6. Create systemd service
sudo nano /etc/systemd/system/wizamart.service

View File

@@ -44,7 +44,7 @@ nano .env # Edit with production values
# 6. Initialize database
alembic upgrade head
python scripts/init_production.py
python scripts/seed/init_production.py
# 7. Exit wizamart user
exit

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

View File

@@ -217,7 +217,7 @@ Then update the footer template:
### 7. Create Default Platform Pages (Script)
Create `scripts/create_default_content_pages.py`:
Create `scripts/seed/create_default_content_pages.py`:
```python
#!/usr/bin/env python3
@@ -347,7 +347,7 @@ if __name__ == "__main__":
Run it:
```bash
python scripts/create_default_content_pages.py
python scripts/seed/create_default_content_pages.py
```
## Testing

View File

@@ -505,7 +505,7 @@ Standard slugs to implement:
1. **Create Platform Defaults**:
```bash
python scripts/create_default_content_pages.py
python scripts/seed/create_default_content_pages.py
```
2. **Migrate Existing Static Templates**:

View File

@@ -171,7 +171,7 @@ Templates use Jinja2 syntax for variable interpolation:
Run the seed script to populate default templates:
```bash
python scripts/seed_email_templates.py
python scripts/seed/seed_email_templates.py
```
This creates templates for:
@@ -302,7 +302,7 @@ Test coverage includes:
app/services/email_service.py # Email service with provider abstraction
models/database/email.py # EmailTemplate and EmailLog models
app/core/config.py # Email configuration settings
scripts/seed_email_templates.py # Template seeding script
scripts/seed/seed_email_templates.py # Template seeding script
```
### Provider Abstraction

View File

@@ -193,7 +193,7 @@ Manage all platform content pages from a single interface:
```bash
# Create all default platform pages
python scripts/create_platform_pages.py
python scripts/seed/create_platform_pages.py
```
This creates:
@@ -568,7 +568,7 @@ return templates.TemplateResponse(
**Solutions:**
1. Run seeder script:
```bash
python scripts/create_platform_pages.py
python scripts/seed/create_platform_pages.py
```
2. Verify page exists:

View File

@@ -11,7 +11,7 @@ Quick reference for setting up and customizing the platform homepage and content
Run the seeder script to create all default platform pages:
```bash
python scripts/create_platform_pages.py
python scripts/seed/create_platform_pages.py
```
This creates:
@@ -253,7 +253,7 @@ Result in header: `About | FAQ | Contact`
**Fix:** Run seeder script
```bash
python scripts/create_platform_pages.py
python scripts/seed/create_platform_pages.py
```
### Navigation menu is empty

View File

@@ -296,7 +296,7 @@ Tests:
- `alembic/versions/v0a1b2c3d4e5_add_store_email_settings.py` - Migration
- `app/services/store_email_settings_service.py` - Service
- `app/api/v1/store/email_settings.py` - API endpoints
- `scripts/install.py` - Installation wizard
- `scripts/seed/install.py` - Installation wizard
### Modified Files
- `app/services/email_service.py` - Added platform config, store providers

View File

@@ -329,11 +329,11 @@ The migration:
## Seeding Templates
**File:** `scripts/seed_email_templates.py`
**File:** `scripts/seed/seed_email_templates.py`
Run seed script:
```bash
python scripts/seed_email_templates.py
python scripts/seed/seed_email_templates.py
```
The script:

View File

@@ -228,12 +228,12 @@ Remaining 13 warnings require provider pattern refactoring. To be tackled in a f
Current state:
```
$ python scripts/validate_architecture.py
$ python scripts/validate/validate_architecture.py
→ 0 errors, 13 warnings (all IMPORT-002 — provider pattern candidates)
```
After Part B complete:
```
$ python scripts/validate_architecture.py
$ python scripts/validate/validate_architecture.py
→ 0 errors, 0 warnings
```

View File

@@ -538,7 +538,7 @@ grep -r "from app.modules.orders" app/modules/core/ app/modules/tenancy/ app/mod
# This would be a more advanced test
# Run architecture validator
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
```
---

View File

@@ -590,7 +590,7 @@ ADD COLUMN is_custom BOOLEAN DEFAULT FALSE;
2. **Migrations run:** `make migrate-up`
3. **Architecture validation:** `python scripts/validate_architecture.py -v`
3. **Architecture validation:** `python scripts/validate/validate_architecture.py -v`
4. **Unit tests:** Test permission filtering logic
- Platform with no config → all permissions allowed

View File

@@ -21,19 +21,19 @@ This directory contains scripts for validating and enforcing architectural patte
```bash
# Validate entire codebase
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
# Validate specific directory
python scripts/validate_architecture.py app/api/
python scripts/validate/validate_architecture.py app/api/
# Verbose output with code context
python scripts/validate_architecture.py --verbose
python scripts/validate/validate_architecture.py --verbose
# Show only errors (suppress warnings)
python scripts/validate_architecture.py --errors-only
python scripts/validate/validate_architecture.py --errors-only
# Use custom config file
python scripts/validate_architecture.py --config custom-rules.yaml
python scripts/validate/validate_architecture.py --config custom-rules.yaml
```
### Exit Codes
@@ -175,7 +175,7 @@ jobs:
- name: Validate Architecture
run: |
python scripts/validate_architecture.py
python scripts/validate/validate_architecture.py
```
### Documentation
@@ -192,7 +192,7 @@ To add new rules:
1. Add rule definition to `.architecture-rules.yaml`
2. Implement validation logic in `validate_architecture.py`
3. Add examples to `docs/architecture/architecture-patterns.md`
4. Test with `python scripts/validate_architecture.py --verbose`
4. Test with `python scripts/validate/validate_architecture.py --verbose`
### Troubleshooting

View File

@@ -8,14 +8,14 @@ This provides a single entry point for comprehensive code validation,
useful for CI/CD pipelines and pre-commit hooks.
Usage:
python scripts/validate_all.py # Run all validators
python scripts/validate_all.py --security # Run only security validator
python scripts/validate_all.py --performance # Run only performance validator
python scripts/validate_all.py --architecture # Run only architecture validator
python scripts/validate_all.py --audit # Run only audit validator
python scripts/validate_all.py -v # Verbose output
python scripts/validate_all.py --fail-fast # Stop on first failure
python scripts/validate_all.py --json # JSON output
python scripts/validate/validate_all.py # Run all validators
python scripts/validate/validate_all.py --security # Run only security validator
python scripts/validate/validate_all.py --performance # Run only performance validator
python scripts/validate/validate_all.py --architecture # Run only architecture validator
python scripts/validate/validate_all.py --audit # Run only audit validator
python scripts/validate/validate_all.py -v # Verbose output
python scripts/validate/validate_all.py --fail-fast # Stop on first failure
python scripts/validate/validate_all.py --json # JSON output
Options:
--architecture Run architecture validator
@@ -41,8 +41,7 @@ def run_architecture_validator(verbose: bool = False) -> tuple[int, dict]:
"""Run the architecture validator"""
try:
# Import dynamically to avoid circular imports
sys.path.insert(0, str(Path(__file__).parent.parent))
from scripts.validate_architecture import ArchitectureValidator
from validate_architecture import ArchitectureValidator
config_path = Path.cwd() / ".architecture-rules.yaml"
validator = ArchitectureValidator(config_path=config_path, verbose=verbose)

View File

@@ -12,12 +12,12 @@ This script checks that the codebase follows key architectural decisions:
- API endpoint patterns
Usage:
python scripts/validate_architecture.py # Check all files in current directory
python scripts/validate_architecture.py -d app/api/ # Check specific directory
python scripts/validate_architecture.py -f app/api/v1/stores.py # Check single file
python scripts/validate_architecture.py -o merchant # Check all merchant-related files
python scripts/validate_architecture.py -o store --verbose # Check store files with details
python scripts/validate_architecture.py --json # JSON output
python scripts/validate/validate_architecture.py # Check all files in current directory
python scripts/validate/validate_architecture.py -d app/api/ # Check specific directory
python scripts/validate/validate_architecture.py -f app/api/v1/stores.py # Check single file
python scripts/validate/validate_architecture.py -o merchant # Check all merchant-related files
python scripts/validate/validate_architecture.py -o store --verbose # Check store files with details
python scripts/validate/validate_architecture.py --json # JSON output
Options:
-f, --file PATH Validate a single file (.py, .js, or .html)

View File

@@ -11,10 +11,10 @@ import sys
from pathlib import Path
# Add project root to path
sys.path.insert(0, str(Path(__file__).parent.parent))
# Add parent directory to path for imports
sys.path.insert(0, str(Path(__file__).parent))
from scripts.base_validator import BaseValidator
from base_validator import BaseValidator
class AuditValidator(BaseValidator):

View File

@@ -13,12 +13,12 @@ This script checks for common performance issues:
- Missing timeouts and connection pooling
Usage:
python scripts/validate_performance.py # Check all files
python scripts/validate_performance.py -d app/services/ # Check specific directory
python scripts/validate_performance.py -f app/api/v1/products.py # Check single file
python scripts/validate_performance.py -v # Verbose output
python scripts/validate_performance.py --json # JSON output
python scripts/validate_performance.py --errors-only # Only show errors
python scripts/validate/validate_performance.py # Check all files
python scripts/validate/validate_performance.py -d app/services/ # Check specific directory
python scripts/validate/validate_performance.py -f app/api/v1/products.py # Check single file
python scripts/validate/validate_performance.py -v # Verbose output
python scripts/validate/validate_performance.py --json # JSON output
python scripts/validate/validate_performance.py --errors-only # Only show errors
Options:
-f, --file PATH Validate a single file

View File

@@ -14,12 +14,12 @@ This script checks for common security vulnerabilities:
- Data exposure risks
Usage:
python scripts/validate_security.py # Check all files
python scripts/validate_security.py -d app/api/ # Check specific directory
python scripts/validate_security.py -f app/api/v1/auth.py # Check single file
python scripts/validate_security.py -v # Verbose output
python scripts/validate_security.py --json # JSON output
python scripts/validate_security.py --errors-only # Only show errors
python scripts/validate/validate_security.py # Check all files
python scripts/validate/validate_security.py -d app/api/ # Check specific directory
python scripts/validate/validate_security.py -f app/api/v1/auth.py # Check single file
python scripts/validate/validate_security.py -v # Verbose output
python scripts/validate/validate_security.py --json # JSON output
python scripts/validate/validate_security.py --errors-only # Only show errors
Options:
-f, --file PATH Validate a single file