LemonCore.Quality.Cleanup (lemon_core v0.1.0)

View Source

Scans and prunes stale agent-loop run artifacts.

Default mode is dry-run and reports:

Summary

Functions

Scans and optionally deletes stale docs and old run files.

Scans for stale docs and old run files without deleting anything.

Types

report()

@type report() :: %{
  root: String.t(),
  retention_days: pos_integer(),
  old_run_files: [String.t()],
  stale_docs: [map()],
  deleted_files: [String.t()]
}

Functions

prune(opts \\ [])

@spec prune(keyword()) :: report()

Scans and optionally deletes stale docs and old run files.

When :apply is true, actually deletes the old run files found. When :apply is false (default), performs a dry run.

Returns a report with the following keys:

  • :root - the root directory scanned
  • :retention_days - the retention period used
  • :old_run_files - list of file paths older than retention_days
  • :stale_docs - list of stale documentation entries
  • :deleted_files - list of files actually deleted (only when apply: true)

Options

  • :root - root directory to scan (defaults to current working directory)
  • :retention_days - number of days to retain files (defaults to 14)
  • :today - date to use as reference (defaults to today, useful for testing)
  • :apply - if true, actually delete files; if false, dry run (defaults to false)

scan(opts \\ [])

@spec scan(keyword()) :: report()

Scans for stale docs and old run files without deleting anything.

Returns a report with the following keys:

  • :root - the root directory scanned
  • :retention_days - the retention period used
  • :old_run_files - list of file paths older than retention_days
  • :stale_docs - list of stale documentation entries
  • :deleted_files - empty list (always empty for scan)

Options

  • :root - root directory to scan (defaults to current working directory)
  • :retention_days - number of days to retain files (defaults to 14)
  • :today - date to use as reference (defaults to today, useful for testing)