All checks were successful
Deploy Development / deploy (push) Successful in 48s
Test Suite / pytest-backend (push) Successful in 2m20s
Test Suite / lint-backend (push) Successful in 3s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 19s
Test Suite / playwright-smoke (push) Successful in 14s
Migration 023, Engine, API und ADP für Durchführungsplan getrennt vom Gate-Graph; Docs und Sprint-Assignment synchronisiert. Co-authored-by: Cursor <cursoragent@cursor.com>
140 lines
3.5 KiB
Python
140 lines
3.5 KiB
Python
"""Jinkendo Kairo — FastAPI application entry point."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from db import check_db
|
|
from version import APP_NAME, APP_VERSION, DB_SCHEMA_VERSION
|
|
|
|
import steering # noqa: F401 — bootstrap hooks & methods
|
|
|
|
if os.getenv("KAIRO_DB_READY") != "1":
|
|
if os.getenv("SKIP_DB_MIGRATE", "").strip().lower() not in ("1", "true", "yes"):
|
|
import run_migrations
|
|
|
|
exit_code = run_migrations.main()
|
|
if exit_code != 0:
|
|
print(f"[FAIL] Migrationen fehlgeschlagen (Exit {exit_code})")
|
|
sys.exit(exit_code)
|
|
else:
|
|
print("[SKIP_DB_MIGRATE] Migrationen übersprungen")
|
|
|
|
if os.getenv("SKIP_SEEDS", "").strip().lower() not in ("1", "true", "yes"):
|
|
import run_seeds
|
|
|
|
exit_code = run_seeds.main()
|
|
if exit_code != 0:
|
|
print(f"[FAIL] Seeds fehlgeschlagen (Exit {exit_code})")
|
|
sys.exit(exit_code)
|
|
else:
|
|
print("[SKIP_SEEDS] Data-Seeds übersprungen")
|
|
|
|
allowed_origins = [
|
|
origin.strip()
|
|
for origin in os.getenv("ALLOWED_ORIGINS", "http://localhost:3097").split(",")
|
|
if origin.strip()
|
|
]
|
|
|
|
app = FastAPI(
|
|
title="Jinkendo Kairo",
|
|
version=APP_VERSION,
|
|
docs_url="/api/docs" if os.getenv("ENVIRONMENT", "development") != "production" else None,
|
|
redoc_url=None,
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=allowed_origins,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
from routers import ( # noqa: E402
|
|
actions,
|
|
actors,
|
|
auth,
|
|
backlog,
|
|
blockers,
|
|
config,
|
|
decisions,
|
|
entity_archetypes,
|
|
evidence,
|
|
execution_plan,
|
|
features,
|
|
initiatives,
|
|
journey,
|
|
me,
|
|
milestones,
|
|
projects,
|
|
roadmap,
|
|
prompts,
|
|
recurring,
|
|
reviews,
|
|
steering,
|
|
tasks,
|
|
workspace,
|
|
)
|
|
|
|
app.include_router(auth.router)
|
|
app.include_router(me.router)
|
|
app.include_router(features.router)
|
|
app.include_router(prompts.router)
|
|
app.include_router(config.router)
|
|
app.include_router(initiatives.router)
|
|
app.include_router(entity_archetypes.router)
|
|
app.include_router(journey.initiative_router)
|
|
app.include_router(journey.roadmap_router)
|
|
app.include_router(actions.router)
|
|
app.include_router(projects.initiative_router)
|
|
app.include_router(projects.items_router)
|
|
app.include_router(tasks.router)
|
|
app.include_router(blockers.router)
|
|
app.include_router(backlog.router)
|
|
app.include_router(milestones.router)
|
|
app.include_router(roadmap.initiative_router)
|
|
app.include_router(roadmap.items_router)
|
|
app.include_router(roadmap.deps_router)
|
|
app.include_router(roadmap.criteria_router)
|
|
app.include_router(execution_plan.initiative_router)
|
|
app.include_router(evidence.router)
|
|
app.include_router(decisions.router)
|
|
app.include_router(reviews.router)
|
|
app.include_router(recurring.router)
|
|
app.include_router(steering.router)
|
|
app.include_router(actors.router)
|
|
app.include_router(workspace.router)
|
|
|
|
|
|
@app.get("/api/health")
|
|
def api_health():
|
|
db_status = "ok"
|
|
try:
|
|
if not check_db():
|
|
db_status = "error"
|
|
except Exception:
|
|
db_status = "error"
|
|
|
|
status = "ok" if db_status == "ok" else "degraded"
|
|
return {
|
|
"status": status,
|
|
"app": APP_NAME,
|
|
"db": db_status,
|
|
"version": APP_VERSION,
|
|
"schema": DB_SCHEMA_VERSION,
|
|
}
|
|
|
|
|
|
@app.get("/api/version")
|
|
def api_version():
|
|
return {
|
|
"app": APP_NAME,
|
|
"version": APP_VERSION,
|
|
"schema": DB_SCHEMA_VERSION,
|
|
}
|