feat: add ledger backup safety workflow
confirm dcy-002 and add REQ/BAT evidence add ledger backup/status metadata workflow document restore as runbook/script-only guarded operation add synthetic DB backup/restore smoke tests
This commit is contained in:
@@ -14,6 +14,26 @@ def ledger_health_check() -> dict:
|
||||
"""Verify the Jarca Ledger MCP server and SQLite database are reachable."""
|
||||
return service.health_check()
|
||||
|
||||
@mcp.tool()
|
||||
def get_ledger_db_status(include_hash: bool = True, include_integrity: bool = True) -> dict:
|
||||
"""Return non-sensitive DB status evidence: path, size, mtime, checksum, table row counts, and aggregate totals."""
|
||||
return service.get_ledger_db_status(include_hash=include_hash, include_integrity=include_integrity)
|
||||
|
||||
@mcp.tool()
|
||||
def create_ledger_backup(backup_dir: str = "", retention_days: int = 30, retention_count: int = 20) -> dict:
|
||||
"""Create a timestamped ledger DB backup. Restore is intentionally not exposed as an MCP tool."""
|
||||
return service.create_ledger_backup(backup_dir=backup_dir or None, retention_days=retention_days, retention_count=retention_count)
|
||||
|
||||
@mcp.tool()
|
||||
def list_ledger_backups(backup_dir: str = "", include_hash: bool = False, limit: int = 50) -> dict:
|
||||
"""List ledger DB backups with metadata-only evidence."""
|
||||
return service.list_ledger_backups(backup_dir=backup_dir or None, include_hash=include_hash, limit=limit)
|
||||
|
||||
@mcp.tool()
|
||||
def get_ledger_backup_status(file_path: str, include_hash: bool = True, include_integrity: bool = True) -> dict:
|
||||
"""Return metadata-only status and integrity evidence for one backup file."""
|
||||
return service.get_ledger_backup_status(file_path, include_hash=include_hash, include_integrity=include_integrity)
|
||||
|
||||
@mcp.tool()
|
||||
def create_ledger_account(name: str, type: str = "bank", institution: str = "", currency: str = "KRW", active: bool = True, memo: str = "", account_number_masked: str = "", holder_name: str = "", last_balance: int | None = None, last_synced_at: str = "") -> dict:
|
||||
"""Create an account/card/cash/investment/loan ledger account."""
|
||||
|
||||
Reference in New Issue
Block a user