diskcleanup

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 28 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllowedCategories = map[string]bool{
	"temp": true, "test": true, "research": true, "download": true, "chrome-profile": true, "cron-output": true, "other": true}

Allowed tracking categories

Functions

func DryRun

func DryRun(ctx context.Context) ([]Entry, []Entry, error)

Auto delete and needs prompt lists without touching any file

func FmtSize

func FmtSize(n float64) string

Human size with one decimal in B, KB, MB, GB, TB or PB

func Forget

func Forget(ctx context.Context, pathStr string) (int, error)

Removes a path from tracking without deleting it and returns the number of entries dropped

func FormatStatus

func FormatStatus(s Status) string

Human readable status table for the slash command

func GuessCategory

func GuessCategory(ctx context.Context, path string) (string, error)

Category label for a path, empty when it must not be tracked

func IsSafePath

func IsSafePath(ctx context.Context, path string) bool

Accepts only paths under the home or a top level icebath- entry of the resolved tmp root

func Log

func Log(ctx context.Context, message string)

Appends a timestamped line to the audit log, dropping any OS error

func SaveTracked

func SaveTracked(ctx context.Context, tracked []Entry) error

Atomic save through tracked.json.tmp, backing up the old file before the rename

func Track

func Track(ctx context.Context, pathStr, category string, silent bool) (bool, error)

Registers a path for tracking and reports whether it was newly tracked

Types

type CategoryTotal

type CategoryTotal struct {
	Name  string
	Count int
	Size  float64
}

Per category totals in first seen order

type Entry

type Entry = *jsonutil.Object

One tracked.json entry in its stored key order

func LoadTracked

func LoadTracked(ctx context.Context) ([]Entry, error)

Tracked entries from tracked.json, restored from the backup when the file is corrupt

type KeyError

type KeyError struct{ Key string }

Tracked entry missing a field

func (*KeyError) Error

func (e *KeyError) Error() string

type Plugin

type Plugin struct{}

Compiled-in disk-cleanup plugin

func (Plugin) Manifest

func (Plugin) Manifest() plugins.Manifest

Manifest of the disk-cleanup plugin from its plugin.yaml

func (Plugin) Register

func (Plugin) Register(ctx *plugins.Context) error

Registers the tool call tracking hooks, the session end cleanup and the slash command

type Status

type Status struct {
	Categories   []CategoryTotal
	Top10        []TopItem
	TotalTracked int
}

Category breakdown, ten largest existing tracked files and the tracked count

func GetStatus

func GetStatus(ctx context.Context) (Status, error)

Per category breakdown and the ten largest existing tracked files

type Summary

type Summary struct {
	Deleted   int
	EmptyDirs int
	Freed     float64
	Errors    []string
}

Result of a quick cleanup run

func Quick

func Quick(ctx context.Context) (Summary, error)

Safe deterministic cleanup with no prompts, sweeping empty dirs afterwards

type TopItem

type TopItem struct {
	Path     string
	Size     float64
	Category string
}

One existing tracked path ranked by size

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL