add background migration task and status tool/prompt

Signed-off-by: phernandez <paul@basicmachines.co>
This commit is contained in:
phernandez
2025-06-04 16:52:12 -05:00
parent c5c70cb0f4
commit a3cae1064d
11 changed files with 542 additions and 9 deletions
+6 -6
View File
@@ -31,23 +31,23 @@ load_dotenv()
@dataclass
class AppContext:
watch_task: Optional[asyncio.Task]
migration_manager: Optional[Any] = None
@asynccontextmanager
async def app_lifespan(server: FastMCP) -> AsyncIterator[AppContext]: # pragma: no cover
"""Manage application lifecycle with type-safe context"""
# Initialize on startup
watch_task = await initialize_app(app_config)
# Initialize on startup (now returns migration_manager)
migration_manager = await initialize_app(app_config)
# Initialize project session with default project
session.initialize(app_config.default_project)
try:
yield AppContext(watch_task=watch_task)
yield AppContext(watch_task=None, migration_manager=migration_manager)
finally:
# Cleanup on shutdown
if watch_task:
watch_task.cancel()
# Cleanup on shutdown - migration tasks will be cancelled automatically
pass
# OAuth configuration function