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