1.0.1 โข Published 9 months ago
@cicube/ci-cleaner v1.0.1
CI Cleaner ๐งน
A powerful CI/CD cleanup tool maintained by CICube
Keep your CI/CD pipelines clean and efficient! Automatically remove temporary files, logs, and artifacts with intelligent pattern matching.
About CICube
CICube's AI agents monitor your GitHub Actions workflows, detect anomalies, and provide actionable fixes - saving you hours of debugging time.
Visit cicube.io to learn more about our other developer tools and solutions.
Features
- ๐ฏ Smart Pattern Matching: Advanced glob pattern support for precise file targeting
- ๐ซ Selective Exclusion: Protect important files with exclude patterns
- ๐ Safe Dry-Run Mode: Preview changes before execution
- ๐ค CI Platform Detection: Automatic detection and optimization for:
- GitHub Actions
- GitLab CI
- CircleCI
- Generic CI environments
- โ๏ธ Flexible Configuration: Support for both JSON and YAML config files
- ๐จ Beautiful Output: Clear, colorized console output for better visibility
Installation
# Global installation
npm install -g ci-cleaner
# Or use directly with npx
npx ci-cleanerQuick Start
# Basic cleanup with default patterns
ci-cleaner
# Specify custom patterns
ci-cleaner --patterns="dist/ *.log build/"
# Exclude specific patterns
ci-cleaner --exclude="important.log critical-data/"
# Preview changes with dry-run
ci-cleaner --dry-runConfiguration
Via Config File
Create a .cicleanerrc.json or .cicleanerrc.yaml in your project root:
{
"patterns": [
"dist/",
"*.log",
".cache",
"node_modules/",
"coverage/",
"build/",
"tmp/"
],
"exclude": [
"important.log",
"critical-data/"
]
}Or in YAML format:
patterns:
- dist/
- "*.log"
- .cache
- node_modules/
- coverage/
- build/
- tmp/
exclude:
- important.log
- critical-data/CI Integration Examples
GitHub Actions
- name: Cleanup Build Artifacts
run: npx ci-cleaner --patterns="dist/ coverage/"GitLab CI
cleanup:
stage: cleanup
script:
- npx ci-cleaner --patterns="dist/ *.tmp"CircleCI
- run:
name: Cleanup Workspace
command: npx ci-cleanerCommand Line Options
| Option | Description | Default |
|---|---|---|
--patterns, -p | File patterns to clean | **/tmp, **/*.log, .cache |
--exclude, -e | Patterns to exclude | [] |
--dry-run, -d | Preview without deleting | false |
--config, -c | Path to config file | - |
--help, -h | Show help | - |
--version | Show version | - |
Best Practices
- Always use dry-run first: Preview changes with
--dry-runbefore actual cleanup - Be specific with patterns: Use precise patterns to avoid accidental deletions
- Exclude critical files: Always exclude important files using the
--excludeoption - Use config files: Store your cleanup patterns in a config file for consistency
Support
- ๐ Issue Tracker: GitHub Issues
- ๐ฌ Community: Join us on Slack
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
MIT ยฉ CICube