purge

gest purge: purge terminal, archived, and orphaned data from the store.

struct Command

source

pub struct Command

Purge terminal, archived, and orphaned data from the store.

By default operates on the current project. Pass --all-projects to sweep the entire store. When no selector flags are given, all selectors are applied (the confirmation prompt is the safety net).

Field Type Description
all_projects bool Operate across every project in the store instead of the current one.
dry_run bool Show what would be purged without making any changes.
artifacts bool Purge archived artifacts.
iterations bool Purge archived iterations (terminal: completed/cancelled).
projects bool Purge archived projects (non-undoable).
relationships bool Purge dangling relationship rows.
tasks bool Purge terminal tasks (done/cancelled).
tombstones bool Purge orphan tombstone files.
yes bool Skip the interactive confirmation prompt.

Implements FromArgMatches, Args, Debug.

Command::call

source

pub async fn call(&self, context: &AppContext) -> Result<(), Error>

Execute the purge command.

Parameter Type Description
context &AppContext the application context: settings, store and current project
returns Result<(), Error> Ok(()) when the command succeeds, or the error that stopped it.

fn build_summary

source

fn build_summary(
    tasks: &TerminalTasks,
    iterations: &TerminalIterations,
    artifacts: &ArchivedArtifacts,
    projects: &ArchivedProjects,
    relationships: &DanglingRelationships,
    tombstones: &OrphanTombstones,
) -> Summary

Build the purge-summary block rendered before the confirmation prompt.

When every selector reports zero the block renders with an empty_message in place of the row list; otherwise it renders the title followed by one row per non-empty selector.

Parameter Type Description
tasks &TerminalTasks the done and cancelled tasks found
iterations &TerminalIterations the completed and cancelled iterations found
artifacts &ArchivedArtifacts the archived artifacts found
projects &ArchivedProjects the archived projects found
relationships &DanglingRelationships the relationships whose source or target is gone
tombstones &OrphanTombstones the orphaned tombstone files found
returns Summary The summary, ready to print.

fn collect_gest_dirs

source

async fn collect_gest_dirs(
    conn: &libsql::Connection,
    scope: &Scope,
) -> Result<Vec<(Id, PathBuf)>, Error>

Collect (project_id, gest_dir_path) pairs for tombstone scanning.

Parameter Type Description
conn &libsql::Connection the database connection
scope &Scope one project, or every project, archived ones included
returns Result<Vec<(Id, PathBuf)>, Error> A pair for each project in scope whose root has a .gest directory, or the store error.