@Command(name="clean",description="Remove completed jobs")publicclassCleanCommandextendsBaseCommand{@Option(names={"--all"},description="Remove all completed jobs regardless of age")privatebooleanall;@Option(names={"--older-than"},description="Remove jobs older than duration (e.g., 24h, 7d)")privateStringolderThan;@Option(names={"--include-failed"},description="Also remove failed jobs")privatebooleanincludeFailed;@Option(names={"--dry-run"},description="Show what would be removed without removing")privatebooleandryRun;@Option(names={"--job-id"},description="Remove specific job")privateStringjobId;@OverridepublicIntegercall(){// 1. Find jobs matching criteria// 2. Filter by age/state// 3. Remove (or show dry-run)// 4. Output summary}}
2. Usage Examples
# Remove completed jobs older than default max_age
barn clean
# Remove all completed jobs regardless of age
barn clean --all
# Remove jobs older than 24 hours
barn clean --older-than=24h
# Include failed jobs
barn clean --include-failed
# Dry run - show what would be removed
barn clean --dry-run
# Remove specific job
barn clean --job-id=job-9f83c
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Imported from GitHub samson-media/barn#13 — opened by @daniel-samson on 2026-01-21 12:39:53 UTC
Overview
Implement the
barn cleancommand that removes completed jobs.Context
docs/config.md(cleanup settings)Requirements
1. Clean Command
com.samsonmedia.barn.cli.CleanCommand.java:2. Usage Examples
3. Age Duration Parser
Support human-readable durations:
30m- 30 minutes24h- 24 hours7d- 7 days2w- 2 weeks4. Cleanup Rules
5. Output
Human format:
Dry-run format:
JSON format:
6. Safety
7. Tests Required
CleanCommandTest.java: Test filtering, age parsingDurationParserTest.java: Test duration string parsingAcceptance Criteria
barn cleanremoves old completed jobs--allremoves all completed jobs--older-thanrespects duration--include-failedremoves failed jobs--dry-runshows preview without deleting--job-idremoves specific jobmvn verifypassesImplementation Notes
Calculate directory size:
Format size:
Definition of Done
@daniel-samson commented on 2026-01-21 14:29:20 UTC:
Implemented barn clean command with tests