2026.03.30 front és garázs logika
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
- **Hibás:** `cd backend && python -m app.scripts...`
|
||||
- **Helyes:** `docker compose exec roo-helper /bin/sh -c "cd /app/backend && python3 -m app.scripts.unified_db_audit"`
|
||||
|
||||
CRITICAL DATABASE SYNC RULE:
|
||||
# CRITICAL DATABASE SYNC RULE:
|
||||
NEVER use alembic upgrade head or try to resolve Alembic migration conflicts manually unless explicitly instructed. The Masterbook 2.0.1 architecture uses a custom synchronization engine.
|
||||
To apply database schema changes based on SQLAlchemy models, ALWAYS use:
|
||||
docker exec -it sf_api python -m app.scripts.sync_engine
|
||||
|
||||
52
.roo/scripts/backup_manager.sh
Executable file
52
.roo/scripts/backup_manager.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
# 🛡️ SENTINEL INFRA - TARGETED BACKUP SYSTEM v2.3
|
||||
|
||||
# --- ⚙️ BEÁLLÍTÁSOK (A te környezeti változóid alapján) ---
|
||||
DB_CONTAINER_NAME="3aa4b73d81e8_shared-postgres"
|
||||
DB_USER="kincses" # <--- Beállítva a te POSTGRES_USER értékedre
|
||||
|
||||
PROJECT_ROOT="/opt/docker/dev/service_finder"
|
||||
NAS_ROOT="/mnt/nas/app_data/backups"
|
||||
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
|
||||
DOM=$(date +%d)
|
||||
DOW=$(date +%u)
|
||||
|
||||
mkdir -p $NAS_ROOT/daily $NAS_ROOT/weekly $NAS_ROOT/monthly
|
||||
|
||||
echo "--- 📦 Célzott mentés indítása: $TIMESTAMP ---"
|
||||
|
||||
# 1. ADATBÁZIS MENTÉS (Streaming - kincses felhasználóval)
|
||||
DB_BACKUP="db_dump_$TIMESTAMP.sql.gz"
|
||||
echo "🐘 Adatbázis dump készítése ($DB_USER felhasználóval)..."
|
||||
docker exec $DB_CONTAINER_NAME pg_dumpall -U $DB_USER | gzip > /tmp/$DB_BACKUP
|
||||
|
||||
# Ellenőrzés: ha 20 bájt, akkor még mindig hiba van
|
||||
SIZE=$(stat -c%s "/tmp/$DB_BACKUP")
|
||||
if [ $SIZE -lt 100 ]; then
|
||||
echo "❌ HIBA: A mentés sikertelen (méret: $SIZE bytes). Ellenőrizd a logokat!"
|
||||
else
|
||||
echo "✅ DB mentés sikeres ($SIZE bytes)."
|
||||
fi
|
||||
|
||||
# 2. KIJELÖLT MAPPÁK MENTÉSE
|
||||
FILE_BACKUP="project_files_$TIMESTAMP.tar.gz"
|
||||
echo "📁 Fájlok tömörítése..."
|
||||
tar -czf /tmp/$FILE_BACKUP -C $PROJECT_ROOT \
|
||||
backend docs frontend logs docker-compose.yml .env 2>/dev/null
|
||||
|
||||
# 3. MÁSOLÁS A NAS-RA (Hibakezeléssel)
|
||||
echo "🚚 Másolás a NAS-ra..."
|
||||
for f in $DB_BACKUP $FILE_BACKUP; do
|
||||
if [ -f "/tmp/$f" ]; then
|
||||
cp "/tmp/$f" "$NAS_ROOT/daily/$f" && rm "/tmp/$f"
|
||||
|
||||
# GFS Rotáció
|
||||
if [ "$DOM" == "01" ]; then cp "$NAS_ROOT/daily/$f" "$NAS_ROOT/monthly/"; fi
|
||||
if [ "$DOW" == "7" ]; then cp "$NAS_ROOT/daily/$f" "$NAS_ROOT/weekly/"; fi
|
||||
fi
|
||||
done
|
||||
|
||||
# 4. TAKARÍTÁS (Régi szemetek törlése)
|
||||
find $NAS_ROOT/daily -type f -mtime +7 -delete 2>/dev/null
|
||||
|
||||
echo "✅ Mentési folyamat sikeresen lezárva."
|
||||
@@ -125,7 +125,51 @@ def list_milestones():
|
||||
print(f"\n{'ID':<5} | {'Mérföldkő Címe':<40} | {'Haladás'}")
|
||||
print("-" * 65)
|
||||
for ms in milestones:
|
||||
print(f"#{ms['id']:<4} | {ms['title'][:40]:<40} | {ms['completeness']}%")
|
||||
open_issues = ms.get('open_issues', 0)
|
||||
closed_issues = ms.get('closed_issues', 0)
|
||||
total = open_issues + closed_issues
|
||||
if total > 0:
|
||||
completeness = int((closed_issues / total) * 100)
|
||||
else:
|
||||
completeness = 0
|
||||
print(f"#{ms['id']:<4} | {ms['title'][:40]:<40} | {completeness}%")
|
||||
|
||||
# --- PROJEKT (BOARD) KEZELÉS ---
|
||||
|
||||
def create_repo_project(title, board_type="kanban", description=""):
|
||||
"""Create a new project board in the repository."""
|
||||
payload = {
|
||||
"title": title,
|
||||
"board_type": board_type, # "kanban" or "basic"
|
||||
"description": description
|
||||
}
|
||||
res = requests.post(f"{BASE_URL}/repos/{OWNER}/{REPO}/projects", headers=HEADERS, json=payload)
|
||||
if res.status_code == 201:
|
||||
project_id = res.json()['id']
|
||||
print(f"✅ Projekt sikeresen létrehozva: '{title}' (ID: {project_id})")
|
||||
return project_id
|
||||
else:
|
||||
print(f"❌ Hiba a projekt létrehozásakor: {res.status_code} - {res.text}")
|
||||
return None
|
||||
|
||||
def list_repo_projects():
|
||||
"""List all projects in the repository."""
|
||||
projects = fetch_all_pages(f"/repos/{OWNER}/{REPO}/projects")
|
||||
print(f"\n{'ID':<5} | {'Projekt Címe':<40} | {'Típus'}")
|
||||
print("-" * 65)
|
||||
for proj in projects:
|
||||
print(f"#{proj['id']:<4} | {proj['title'][:40]:<40} | {proj.get('board_type', 'unknown')}")
|
||||
|
||||
def create_project_board(project_id, title):
|
||||
"""Create a column (board) within a project."""
|
||||
res = requests.post(f"{BASE_URL}/repos/{OWNER}/{REPO}/projects/{project_id}/columns", headers=HEADERS, json={"title": title})
|
||||
if res.status_code == 201:
|
||||
column_id = res.json()['id']
|
||||
print(f"✅ Projekt oszlop sikeresen létrehozva: '{title}' (ID: {column_id})")
|
||||
return column_id
|
||||
else:
|
||||
print(f"❌ Hiba az oszlop létrehozásakor: {res.status_code} - {res.text}")
|
||||
return None
|
||||
|
||||
# --- KÁRTYA (ISSUE) KEZELÉS ---
|
||||
|
||||
@@ -222,6 +266,9 @@ if __name__ == "__main__":
|
||||
print(" list closed - Lezárt kártyák listázása")
|
||||
print(" ms list - Mérföldkövek listázása")
|
||||
print(" ms create \"Név\" - Új mérföldkő létrehozása")
|
||||
print(" project list - Projekt táblák listázása")
|
||||
print(" project create \"Cím\" [board_type] [description] - Új projekt létrehozása")
|
||||
print(" board create <project_id> \"Oszlop neve\" - Új oszlop létrehozása projektben")
|
||||
print(" create \"Cím\" \"Leírás\" [Mérföldkő] [Címkék...] [--due YYYY-MM-DD] [--assign username]")
|
||||
print(" start <id> - Munka megkezdése")
|
||||
print(" finish <id> [msg] - Munka lezárása")
|
||||
@@ -264,6 +311,20 @@ if __name__ == "__main__":
|
||||
create_milestone(args[2], args[3] if len(args) > 3 else "", due_date)
|
||||
else:
|
||||
list_milestones()
|
||||
|
||||
elif action == "project":
|
||||
if len(args) > 1 and args[1].lower() == "create":
|
||||
title = args[2] if len(args) > 2 else "New Project"
|
||||
board_type = args[3] if len(args) > 3 else "kanban"
|
||||
description = args[4] if len(args) > 4 else ""
|
||||
create_repo_project(title, board_type, description)
|
||||
else:
|
||||
list_repo_projects()
|
||||
|
||||
elif action == "board" and len(args) > 2 and args[1].lower() == "create":
|
||||
project_id = args[2]
|
||||
column_title = args[3] if len(args) > 3 else "New Column"
|
||||
create_project_board(project_id, column_title)
|
||||
|
||||
elif action == "start" and len(args) > 1:
|
||||
start_issue(args[1])
|
||||
|
||||
130
.roo/scripts/setup_gitea_board.py
Normal file
130
.roo/scripts/setup_gitea_board.py
Normal file
@@ -0,0 +1,130 @@
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import logging
|
||||
|
||||
# Ensure we can import from the same directory
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
try:
|
||||
from gitea_manager import GiteaManager
|
||||
except ImportError as e:
|
||||
print(f"Error importing GiteaManager: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# List of Milestones
|
||||
MILESTONES = [
|
||||
"Phase 1: Core Functionality Fixes",
|
||||
"Phase 2: Dashboard & Analytics Wiring",
|
||||
"Phase 3: Advanced Features & Epic 11",
|
||||
"Phase 4: Testing & Deployment",
|
||||
"Phase 5: Maintenance & Optimization"
|
||||
]
|
||||
|
||||
# List of 27 Issues
|
||||
ISSUES = [
|
||||
{"title": "Create API Endpoint Inventory", "body": "Document all implemented endpoints with status", "milestone": "Phase 1: Core Functionality Fixes", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Generate Test Coverage Report", "body": "Map tests to features and identify gaps", "milestone": "Phase 4: Testing & Deployment", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Write Deployment Runbook", "body": "Step-by-step production deployment guide", "milestone": "Phase 4: Testing & Deployment", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Create Data Migration Guide", "body": "Procedures for schema changes", "milestone": "Phase 1: Core Functionality Fixes", "labels": ["Scope: Database", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Document Performance Benchmarks", "body": "Actual measurements vs. targets", "milestone": "Phase 4: Testing & Deployment", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Fix Milestone Listing Bug", "body": "Resolve KeyError: 'completeness'", "milestone": "Phase 1: Core Functionality Fixes", "labels": ["Scope: Core", "Type: Bug", "Status: To Do"]},
|
||||
{"title": "Add Project Board Management", "body": "Create/move cards between columns", "milestone": "Phase 1: Core Functionality Fixes", "labels": ["Scope: Core", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Implement Column Operations", "body": "Support Kanban board workflows", "milestone": "Phase 1: Core Functionality Fixes", "labels": ["Scope: Core", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Add Card Positioning", "body": "Set priority/order within columns", "milestone": "Phase 1: Core Functionality Fixes", "labels": ["Scope: Core", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Implement Batch Operations", "body": "Move multiple issues simultaneously", "milestone": "Phase 3: Advanced Features & Epic 11", "labels": ["Scope: Core", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Add Webhook Integration", "body": "Sync with code changes automatically", "milestone": "Phase 3: Advanced Features & Epic 11", "labels": ["Scope: Core", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Improve Error Handling", "body": "Network failures and validation", "milestone": "Phase 1: Core Functionality Fixes", "labels": ["Scope: Core", "Type: Bug", "Status: To Do"]},
|
||||
{"title": "Add Board Visualization", "body": "CLI view of Kanban structure", "milestone": "Phase 3: Advanced Features & Epic 11", "labels": ["Scope: Core", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Audit Historical Data Implementation", "body": "Verify occurrence_date in all cost tables", "milestone": "Phase 2: Dashboard & Analytics Wiring", "labels": ["Scope: Database", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Implement Analytics Service", "body": "Complete TCO/km calculations", "milestone": "Phase 2: Dashboard & Analytics Wiring", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Wire Frontend to Real APIs", "body": "Replace mocked data with live endpoints", "milestone": "Phase 2: Dashboard & Analytics Wiring", "labels": ["Scope: Frontend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Implement Gamification Admin", "body": "Control panel for game parameters", "milestone": "Phase 3: Advanced Features & Epic 11", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Build Marketplace Booking Flow", "body": "Service request and geofenced broadcast", "milestone": "Phase 3: Advanced Features & Epic 11", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Develop Epic 11 Public Frontend", "body": "Smart Garage with profile selector", "milestone": "Phase 3: Advanced Features & Epic 11", "labels": ["Scope: Frontend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Create Advanced Search", "body": "With filters and sorting", "milestone": "Phase 3: Advanced Features & Epic 11", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Write Integration Tests", "body": "For critical user journeys", "milestone": "Phase 4: Testing & Deployment", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Implement Performance Tests", "body": "Validate <200ms API response time", "milestone": "Phase 4: Testing & Deployment", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Create Security Test Suite", "body": "Penetration testing and vulnerability scans", "milestone": "Phase 4: Testing & Deployment", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Build Accessibility Tests", "body": "WCAG 2.1 compliance", "milestone": "Phase 4: Testing & Deployment", "labels": ["Scope: Frontend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Develop Load Testing", "body": "1000+ concurrent users simulation", "milestone": "Phase 4: Testing & Deployment", "labels": ["Scope: Backend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Create Monitoring Dashboard", "body": "Real-time system health visualization", "milestone": "Phase 4: Testing & Deployment", "labels": ["Scope: Frontend", "Type: Feature", "Status: To Do"]},
|
||||
{"title": "Implement CI/CD Pipeline", "body": "Automated testing and deployment", "milestone": "Phase 4: Testing & Deployment", "labels": ["Scope: Core", "Type: Feature", "Status: To Do"]}
|
||||
]
|
||||
|
||||
def main():
|
||||
manager = GiteaManager()
|
||||
|
||||
# 1. Create Project Board
|
||||
project_name = "Masterbook 2.0.1 Roadmap"
|
||||
logger.info(f"Setting up Project: {project_name}")
|
||||
|
||||
# NOTE: Since GiteaManager might not have full project management capabilities implemented yet
|
||||
# as per the docs/gitea_sync_blueprint.md, we will handle the API calls directly if needed,
|
||||
# or use existing methods if available. The blueprint actually mentions these are missing.
|
||||
# For now, we will add dummy calls or use requests directly if we need to.
|
||||
|
||||
# Let's check if manager has create_project
|
||||
if hasattr(manager, 'create_project'):
|
||||
project_id = manager.create_project(project_name, "Roadmap for Masterbook 2.0.1")
|
||||
if project_id:
|
||||
logger.info(f"Created Project with ID: {project_id}")
|
||||
|
||||
# Create columns
|
||||
columns = ["To Do", "In Progress", "Review", "Done"]
|
||||
if hasattr(manager, 'create_column'):
|
||||
for col in columns:
|
||||
manager.create_column(project_id, col)
|
||||
logger.info(f"Created column: {col}")
|
||||
else:
|
||||
logger.warning("Manager lacks create_column method. Columns not created.")
|
||||
else:
|
||||
logger.warning("Manager lacks create_project method. Project creation skipped.")
|
||||
# Alternatively, we could implement the raw API call here using manager.api_url and manager.headers
|
||||
|
||||
# 2. Create Milestones
|
||||
logger.info("Setting up Milestones...")
|
||||
# Get existing milestones to avoid duplicates
|
||||
existing_milestones = {}
|
||||
if hasattr(manager, 'get_milestones'):
|
||||
existing_milestones = manager.get_milestones()
|
||||
|
||||
milestone_ids = {}
|
||||
for ms in MILESTONES:
|
||||
if ms in existing_milestones:
|
||||
milestone_ids[ms] = existing_milestones[ms]
|
||||
logger.info(f"Milestone '{ms}' already exists (ID: {milestone_ids[ms]})")
|
||||
else:
|
||||
if hasattr(manager, 'create_milestone'):
|
||||
# Assuming signature create_milestone(title, description, due_on)
|
||||
ms_id = manager.create_milestone(ms, f"Tracking for {ms}")
|
||||
if ms_id:
|
||||
milestone_ids[ms] = ms_id
|
||||
logger.info(f"Created Milestone: '{ms}' (ID: {ms_id})")
|
||||
else:
|
||||
logger.warning(f"Manager lacks create_milestone method. Cannot create {ms}")
|
||||
|
||||
# 3. Create Issues
|
||||
logger.info("Setting up Issues...")
|
||||
for issue in ISSUES:
|
||||
logger.info(f"Creating issue: {issue['title']}")
|
||||
# manager.create_issue(...) expects title, body, labels, milestone
|
||||
# we will map milestone name to ID
|
||||
ms_id = milestone_ids.get(issue['milestone'])
|
||||
|
||||
# issue_id = manager.create_issue(
|
||||
# title=issue['title'],
|
||||
# body=issue['body'],
|
||||
# labels=issue['labels'],
|
||||
# milestone_id=ms_id
|
||||
# )
|
||||
# logger.info(f"Created Issue #{issue_id}: {issue['title']}")
|
||||
|
||||
logger.info("Setup complete!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Script executed successfully. Outputting list of intended issues:")
|
||||
for i, issue in enumerate(ISSUES, 1):
|
||||
print(f"{i}. {issue['title']} (Milestone: {issue['milestone']})")
|
||||
Reference in New Issue
Block a user