bankai/backup

Safe catalog, validation, preview, and restore operations for task backups.

Types

pub type CatalogEntry {
  CatalogEntry(path: String, task_count: Int, valid: Bool)
}

Constructors

  • CatalogEntry(path: String, task_count: Int, valid: Bool)
pub type DetailedDivergence {
  DetailedDivergence(
    current_count: Int,
    backup_count: Int,
    same_tasks: Int,
    added_in_backup: List(String),
    missing_in_backup: List(String),
    modified_in_backup: List(String),
  )
}

Constructors

  • DetailedDivergence(
      current_count: Int,
      backup_count: Int,
      same_tasks: Int,
      added_in_backup: List(String),
      missing_in_backup: List(String),
      modified_in_backup: List(String),
    )
pub type RestorePreview {
  RestorePreview(current_count: Int, backup_count: Int)
}

Constructors

  • RestorePreview(current_count: Int, backup_count: Int)

Values

pub fn analyze_duplicates(
  tasks: List(types.Task),
) -> List(List(types.Task))

Group tasks that share the same title (potential duplicates).

pub fn analyze_stale(
  tasks: List(types.Task),
  older_than: Int,
) -> List(types.Task)

Find open/in-progress/blocked tasks whose updated_at is older than the cutoff.

pub fn catalog(
  workspace: String,
) -> Result(List(CatalogEntry), String)

Catalog task backups in a workspace. A workspace that does not yet exist has an empty catalog; corrupt backups remain visible with valid: False.

pub fn divergence_detail(
  workspace: String,
  path: String,
) -> Result(DetailedDivergence, String)

Detailed divergence comparing existing workspace tasks with candidate backup tasks.

pub fn preview_restore(
  workspace: String,
  path: String,
) -> Result(RestorePreview, String)

Compare the validated backup with the current task store without mutating it.

pub fn prune(
  workspace: String,
  keep keep: Int,
) -> Result(Int, String)

Delete all but the newest keep backups. Returns the number pruned.

pub fn restore(
  workspace: String,
  path: String,
) -> Result(Nil, String)

Restore a validated backup. Validation happens before any target write.

pub fn validate(path: String) -> Result(List(types.Task), String)

Validate that a backup exists and contains only integrity-valid tasks.

Search Document