Add cleanup script, version tracking, and changelog
New files: - automation/clean.sh: Clean up old logs, reports, backups (with --dry-run) - VERSION: Tracks configuration version (1.0.0) - CHANGELOG.md: Documents all changes in this refactor The cleanup script handles: - Old workflow logs (>30 days) - Old health reports (>30 days) - Excess backups (keeps last 10) Respects managed directories (projects/, stats-cache.json). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
57
CHANGELOG.md
Normal file
57
CHANGELOG.md
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this Claude Code configuration.
|
||||||
|
|
||||||
|
## [1.0.0] - 2026-01-01
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
#### Plugin Structure
|
||||||
|
- `.claude-plugin/plugin.json` - Plugin manifest for distribution
|
||||||
|
- `.claude-plugin/marketplace.json` - Local development marketplace
|
||||||
|
|
||||||
|
#### Hooks
|
||||||
|
- `SessionStart` hook - Loads context, checks pending items
|
||||||
|
- `PreCompact` hook - Reminds to preserve context before compaction
|
||||||
|
- `hooks/scripts/session-start.sh` - Session initialization script
|
||||||
|
- `hooks/scripts/pre-compact.sh` - Pre-compaction handler
|
||||||
|
|
||||||
|
#### Commands
|
||||||
|
- `/help` - Show available commands and skills
|
||||||
|
- `/status` - Dashboard overview across all domains
|
||||||
|
- `/summarize` - Save session to memory
|
||||||
|
- `/maintain` - Configuration maintenance operations
|
||||||
|
|
||||||
|
#### Skills (Resources Pattern)
|
||||||
|
All skills refactored to use scripts + references pattern:
|
||||||
|
- `gmail/scripts/` - check_unread.py, check_urgent.py, search.py
|
||||||
|
- `gmail/references/` - query-patterns.md
|
||||||
|
- `gcal/scripts/` - agenda.py, next_event.py
|
||||||
|
- `k8s-quick-status/scripts/` - quick-status.sh
|
||||||
|
- `sysadmin-health/scripts/` - health-check.sh
|
||||||
|
- `usage/scripts/` - usage_report.py
|
||||||
|
|
||||||
|
#### Automation Scripts
|
||||||
|
- `validate-setup.sh` - Validate configuration
|
||||||
|
- `quick-status.sh` - Dashboard status
|
||||||
|
- `backup.sh` - Create configuration backup
|
||||||
|
- `restore.sh` - Restore from backup
|
||||||
|
- `clean.sh` - Clean up old files
|
||||||
|
|
||||||
|
#### Documentation
|
||||||
|
- README.md in every directory
|
||||||
|
- Top-level README.md with quick start guide
|
||||||
|
- CHANGELOG.md (this file)
|
||||||
|
- VERSION file
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- CLAUDE.md streamlined, references directory READMEs
|
||||||
|
- Skills use `allowed-tools` for capability restrictions
|
||||||
|
- Component registry includes script paths
|
||||||
|
- Expanded trigger phrases for better skill matching
|
||||||
|
|
||||||
|
### Technical Details
|
||||||
|
- 34 files changed
|
||||||
|
- +2500 lines added
|
||||||
|
- Full documentation coverage
|
||||||
|
- Validation script passes all checks
|
||||||
120
automation/clean.sh
Executable file
120
automation/clean.sh
Executable file
@@ -0,0 +1,120 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Clean up temporary and old files
|
||||||
|
# Usage: clean.sh [--dry-run]
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
CLAUDE_DIR="${HOME}/.claude"
|
||||||
|
DRY_RUN="${1:-}"
|
||||||
|
|
||||||
|
# Colors
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
echo "🧹 Claude Code Cleanup"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if [[ "${DRY_RUN}" == "--dry-run" ]]; then
|
||||||
|
echo -e "${YELLOW}Dry run mode - no files will be deleted${NC}"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
total_freed=0
|
||||||
|
|
||||||
|
# Helper to delete files
|
||||||
|
delete_files() {
|
||||||
|
local pattern="$1"
|
||||||
|
local description="$2"
|
||||||
|
local max_age="${3:-}"
|
||||||
|
|
||||||
|
local files
|
||||||
|
if [[ -n "${max_age}" ]]; then
|
||||||
|
files=$(find ${pattern} -type f -mtime +${max_age} 2>/dev/null || true)
|
||||||
|
else
|
||||||
|
files=$(find ${pattern} -type f 2>/dev/null || true)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "${files}" ]]; then
|
||||||
|
local count=$(echo "${files}" | wc -l)
|
||||||
|
local size=$(echo "${files}" | xargs du -ch 2>/dev/null | tail -1 | cut -f1)
|
||||||
|
|
||||||
|
echo "${description}: ${count} files (${size})"
|
||||||
|
|
||||||
|
if [[ "${DRY_RUN}" != "--dry-run" ]]; then
|
||||||
|
echo "${files}" | xargs rm -f
|
||||||
|
echo -e " ${GREEN}✓${NC} Deleted"
|
||||||
|
else
|
||||||
|
echo " Would delete:"
|
||||||
|
echo "${files}" | head -5 | sed 's/^/ /'
|
||||||
|
[[ $(echo "${files}" | wc -l) -gt 5 ]] && echo " ..."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "${description}: nothing to clean"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# Old workflow logs (older than 30 days)
|
||||||
|
echo "=== Workflow Logs ==="
|
||||||
|
delete_files "${CLAUDE_DIR}/logs/workflows/*.log" "Old logs (>30 days)" 30
|
||||||
|
|
||||||
|
# Old health reports (older than 30 days)
|
||||||
|
echo "=== Health Reports ==="
|
||||||
|
delete_files "${CLAUDE_DIR}/logs/health-reports/*.md" "Old reports (>30 days)" 30
|
||||||
|
|
||||||
|
# Old backups (keep last 10)
|
||||||
|
echo "=== Backups ==="
|
||||||
|
BACKUP_DIR="${CLAUDE_DIR}/backups"
|
||||||
|
if [[ -d "${BACKUP_DIR}" ]]; then
|
||||||
|
backup_count=$(ls -1 "${BACKUP_DIR}"/*.tar.gz 2>/dev/null | wc -l || echo "0")
|
||||||
|
if [[ ${backup_count} -gt 10 ]]; then
|
||||||
|
old_backups=$(ls -1t "${BACKUP_DIR}"/*.tar.gz | tail -n +11)
|
||||||
|
count=$(echo "${old_backups}" | wc -l)
|
||||||
|
echo "Old backups (keeping last 10): ${count} files"
|
||||||
|
if [[ "${DRY_RUN}" != "--dry-run" ]]; then
|
||||||
|
echo "${old_backups}" | xargs rm -f
|
||||||
|
echo -e " ${GREEN}✓${NC} Deleted"
|
||||||
|
else
|
||||||
|
echo " Would delete:"
|
||||||
|
echo "${old_backups}" | head -3 | sed 's/^/ /'
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Backups: ${backup_count} files (keeping all)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Backups: no backup directory"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Project cache files
|
||||||
|
echo "=== Project Cache ==="
|
||||||
|
if [[ -d "${CLAUDE_DIR}/projects" ]]; then
|
||||||
|
# Count files in projects dir
|
||||||
|
project_files=$(find "${CLAUDE_DIR}/projects" -type f 2>/dev/null | wc -l)
|
||||||
|
project_size=$(du -sh "${CLAUDE_DIR}/projects" 2>/dev/null | cut -f1 || echo "0")
|
||||||
|
echo "Project cache: ${project_files} files (${project_size})"
|
||||||
|
echo " (managed by Claude Code, not cleaning)"
|
||||||
|
else
|
||||||
|
echo "Project cache: not present"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Stats cache
|
||||||
|
echo "=== Stats Cache ==="
|
||||||
|
if [[ -f "${CLAUDE_DIR}/stats-cache.json" ]]; then
|
||||||
|
size=$(du -h "${CLAUDE_DIR}/stats-cache.json" | cut -f1)
|
||||||
|
echo "Stats cache: ${size}"
|
||||||
|
echo " (managed by Claude Code, not cleaning)"
|
||||||
|
else
|
||||||
|
echo "Stats cache: not present"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
echo "=== Summary ==="
|
||||||
|
if [[ "${DRY_RUN}" == "--dry-run" ]]; then
|
||||||
|
echo "Dry run complete. Run without --dry-run to delete files."
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}✓${NC} Cleanup complete!"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user