Add modular app structure for L1 server refactoring

Phase 2 of the full modernization:
- App factory pattern with create_app()
- Settings via dataclass with env vars
- Dependency injection container
- Router stubs for auth, storage, api, recipes, cache, runs
- Service layer stubs for run, recipe, cache
- Repository layer placeholder

Routes are stubs that import from legacy server.py during migration.
Next: Migrate each router fully with templates.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
giles
2026-01-11 07:08:08 +00:00
parent 3e24156c99
commit adc876dbd6
16 changed files with 1057 additions and 0 deletions

57
app/routers/runs.py Normal file
View File

@@ -0,0 +1,57 @@
"""
Run management routes for L1 server.
Handles run creation, status, listing, and detail views.
"""
from fastapi import APIRouter, Request, Depends, HTTPException
from fastapi.responses import HTMLResponse
from artdag_common.middleware import UserContext, wants_html
from ..dependencies import require_auth, get_templates, get_current_user
router = APIRouter()
# TODO: Migrate routes from server.py lines 675-1789
# - POST /runs - Create run
# - GET /runs/{run_id} - Get run status
# - DELETE /runs/{run_id} - Delete run
# - GET /runs - List runs
# - GET /run/{run_id} - Run detail page
# - GET /run/{run_id}/plan - Plan visualization
# - GET /run/{run_id}/analysis - Analysis results
# - GET /run/{run_id}/artifacts - Artifacts list
@router.get("/runs")
async def list_runs(
request: Request,
user: UserContext = Depends(require_auth),
):
"""List all runs for the current user."""
# TODO: Implement
raise HTTPException(501, "Not yet migrated")
@router.get("/run/{run_id}")
async def run_detail(
run_id: str,
request: Request,
user: UserContext = Depends(require_auth),
):
"""Run detail page with tabs for plan/analysis/artifacts."""
# TODO: Implement
raise HTTPException(501, "Not yet migrated")
@router.get("/run/{run_id}/plan")
async def run_plan(
run_id: str,
request: Request,
user: UserContext = Depends(require_auth),
):
"""Plan visualization as interactive DAG."""
# TODO: Implement
raise HTTPException(501, "Not yet migrated")