Disk usage analysis, snapshot comparison, and safe cleanup planning for MoonBit
git clone https://github.com/xiaobai718-ab/moondisk.git
cd moondisk
moon update
moon run examples/quickstartmoon run cmd/main -- scan . --profile developermoon run cmd/main -- snapshot . --profile developer --output workspace.snapshot.json
moon run cmd/main -- audit workspace.snapshot.json
moon run cmd/main -- report workspace.snapshot.json --output workspace.report.htmlmoondisk scan <directory>
moondisk scan <directory> --profile quick
moondisk init-config --profile developer --output scan.json
moondisk scan <directory> --config scan.json
moondisk top <directory> --limit 20
moondisk tree <directory> --depth 3
moondisk snapshot <directory> --output snapshot.json
moondisk diff <old.json> <new.json>
moondisk hotspots <old.json> <new.json> --depth 1 --output hotspots.json
moondisk init-rules --output rules.json
moondisk plan <directory> --rules rules.json --quarantine <directory> --output plan.json
moondisk apply <plan.json> --output operation.json
moondisk restore <operation.json> --output restore.json
moondisk report <snapshot.json> --output report.html
moondisk csv <snapshot.json> --view files --output files.csv
moondisk csv <snapshot.json> --view directories --output directories.csv
moondisk insights <snapshot.json>
moondisk duplicates <directory> --min-size 1048576 --output duplicates.json
moondisk history-init <snapshot.json> --output history.json
moondisk history-add <history.json> <new-snapshot.json>
moondisk history-show <history.json> --limit 10
moondisk init-retention --output retention.json
moondisk history-compact <history.json> --config retention.json --output compacted.json
moondisk forecast <history.json> --days 30 --capacity 107374182400 --output forecast.json
moondisk composition <old.json> <new.json> --by category --output composition.json
moondisk init-growth-policy --output growth.json
moondisk check-growth <old.json> <new.json> --config growth.json --output evidence.json
moondisk find <snapshot.json> --pattern "src/*" --category source-code --extension mbt
moondisk init-budgets --output budgets.json
moondisk budgets <snapshot.json> --config budgets.json
moondisk budgets <snapshot.json> --config budgets.json --fail-on exceeded
moondisk init-policy --output policy.json
moondisk review-plan <plan.json> --policy policy.json
moondisk apply <plan.json> --policy policy.json --output operation.json
moondisk audit <snapshot.json> --output audit.json
moondisk audit-operation <operation.json>moondisk init-rules --output team.rules.json
moondisk plan ./workspace --rules team.rules.json --output cleanup.plan.jsonmoon run cmd/main -- init-budgets --output team.budgets.json
moon run cmd/main -- snapshot . --profile developer --output workspace.snapshot.json
moon run cmd/main -- budgets workspace.snapshot.json --config team.budgets.json --fail-on exceededmoon fmt --check
moon check --target native --deny-warn
moon test --target nativemoon package --list
moon login
moon publish --dry-run
moon publishpub(all) struct AgeBuckets {
day : CategoryStat
week : CategoryStat
month : CategoryStat
quarter : CategoryStat
year : CategoryStat
older : CategoryStat
} derive(Eq, Debug)pub(all) struct BudgetConfigIssue {
kind : BudgetConfigIssueKind
budget_id : String
message : String
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct BudgetResult {
id : String
path : String
maximum_bytes : Int64
actual_bytes : Int64
remaining_bytes : Int64
usage_tenths : Int
status : BudgetStatus
description : String
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct CompositionDrift {
dimension : CompositionDimension
before_total_bytes : Int64
after_total_bytes : Int64
net_bytes : Int64
changes : Array[CompositionChange]
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct DuplicateResult {
groups : Array[DuplicateGroup]
errors : Array[DuplicateError]
candidate_files : Int
compared_files : Int
reclaimable_size : Int64
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct EntryChange {
path : String
kind : ChangeKind
before : Entry?
after : Entry?
size_delta : Int64
} derive(Eq, Debug)pub(all) struct GrowthViolation {
kind : GrowthViolationKind
path : String
actual : Int64
limit : Int64
message : String
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct OperationAuditIssue {
kind : OperationAuditKind
source : String
destination : String
message : String
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct OperationItem {
source : String
destination : String
size : Int64
status : OperationStatus
message : String
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct PlanIssue {
kind : PlanIssueKind
path : String
message : String
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct PlanPolicy {
format_version : Int
allow_low_risk : Bool
allow_medium_risk : Bool
allow_high_risk : Bool
require_regenerable : Bool
maximum_items : Int
maximum_reclaimable_bytes : Int64
allowed_rule_ids : Array[String]
protected_patterns : Array[String]
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct PolicyViolation {
kind : PolicyViolationKind
path : String
message : String
} derive(Eq, ToJson, Debug, FromJson)pub(all) enum RuleCondition {
PathPattern(String)
Extension(String)
MinimumSize(Int64)
OlderThan(Int64)
EmptyDirectory
Any(Array[RuleCondition])
All(Array[RuleCondition])
Not(RuleCondition)
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct RuleConfigIssue {
kind : RuleConfigIssueKind
rule_id : String
message : String
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct ScanConfig {
format_version : Int
options : ScanOptions
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct ScanConfigIssue {
kind : ScanConfigIssueKind
value : String
message : String
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct SnapshotAuditIssue {
kind : SnapshotAuditKind
severity : AuditSeverity
path : String
message : String
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct SnapshotDiff {
changes : Array[EntryChange]
directories : Array[DirectoryChange]
added_size : Int64
removed_size : Int64
net_size : Int64
} derive(Eq, Debug)pub(all) struct StorageForecast {
observations : Int
horizon_days : Int
current_bytes : Int64
daily_growth_bytes : Int64
volatility_bytes : Int64
projected_bytes : Int64
confidence : ForecastConfidence
projections : Array[StorageProjection]
} derive(Eq, ToJson, Debug, FromJson)pub(all) struct StorageInsight {
kind : InsightKind
severity : InsightSeverity
title : String
detail : String
path : String
size : Int64
} derive(Eq, ToJson, Debug, FromJson)fn build_cleanup_plan(snapshot : Snapshot, matches : Array[RuleMatch], quarantine_root : String, created_at : Int64) -> CleanupPlanfn compare_composition(before : Snapshot, after : Snapshot, dimension : CompositionDimension) -> CompositionDriftfn condition_matches(condition : RuleCondition, entry : Entry, snapshot : Snapshot, now : Int64) -> Boolfn evaluate_growth_policy(before : Snapshot, after : Snapshot, policy : GrowthPolicy) -> GrowthPolicyResult raisefn is_hidden_path(path : String) -> Boolfn plan_history_retention(history : SnapshotHistory, policy : HistoryRetentionPolicy) -> RetentionDecision raisefn storage_insights(snapshot : Snapshot, now : Int64, options? : InsightOptions) -> Array[StorageInsight]Install
Download zipDisk usage analysis, snapshot comparison, and safe cleanup planning for MoonBit