Files
SuperCharged-Claude-Code-Up…/skills/plugins/examples/docker-helper/commands/cleanup.ts
admin b723e2bd7d Reorganize: Move all skills to skills/ folder
- Created skills/ directory
- Moved 272 skills to skills/ subfolder
- Kept agents/ at root level
- Kept installation scripts and docs at root level

Repository structure:
- skills/           - All 272 skills from skills.sh
- agents/           - Agent definitions
- *.sh, *.ps1       - Installation scripts
- README.md, etc.   - Documentation

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-23 18:05:17 +00:00

64 lines
1.6 KiB
TypeScript

/**
* Docker Cleanup Command
* Clean up unused containers, images, and volumes
*/
import { exec } from 'child_process'
import { promisify } from 'util'
const execAsync = promisify(exec)
export interface CleanupOptions {
containers?: boolean
images?: boolean
volumes?: boolean
networks?: boolean
all?: boolean
}
export async function handle(args: CleanupOptions, context: any): Promise<string> {
const {
containers = true,
images = true,
volumes = false,
networks = false,
all = false
} = args
const results: string[] = []
try {
if (all || containers) {
results.push('Cleaning up stopped containers...')
const { stdout: containerOutput } = await execAsync('docker container prune -f')
results.push(containerOutput)
}
if (all || images) {
results.push('\nCleaning up dangling images...')
const { stdout: imageOutput } = await execAsync('docker image prune -a -f')
results.push(imageOutput)
}
if (all || volumes) {
results.push('\nCleaning up unused volumes...')
const { stdout: volumeOutput } = await execAsync('docker volume prune -f')
results.push(volumeOutput)
}
if (all || networks) {
results.push('\nCleaning up unused networks...')
const { stdout: networkOutput } = await execAsync('docker network prune -f')
results.push(networkOutput)
}
results.push('\n✓ Docker cleanup complete!')
return results.join('\n')
} catch (error: any) {
throw new Error(`Docker cleanup failed: ${error.message}`)
}
}
export default { handle }