feat(compact): Access database compact & repair API + CLI

- API: POST /api/compact (optional body {"files": [...]})
- CLI: python main.py compact [--db FILE]
- Local path: rename → CompactDatabase(bak→src) → delete bak (zero copy)
- UNC path: copy to local temp → compact → copy back (avoids DAO segfault)
- Uses DAO DBEngine.CompactDatabase via pywin32 COM
- new dep: pywin32>=306

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-08-06 11:23:43 +08:00
parent 79a95465e7
commit 42a2f99ed9
7 changed files with 749 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ from fastapi import FastAPI
from ..config import SyncConfig
from ..health import ServiceState
from . import deps
from .routes import compact as compact_routes
from .routes import health as health_routes
@@ -29,5 +30,6 @@ def create_app(state: ServiceState, cfg: SyncConfig) -> FastAPI:
openapi_url="/api/openapi.json",
)
deps.bind(state, cfg)
app.include_router(compact_routes.router)
app.include_router(health_routes.router)
return app