Support Script: Collection Recovery¶
Issue: User lost collection data, corrupted manifest, or wants to restore from backup Time to resolve: 10-15 minutes Difficulty: Medium Escalation: None needed (if backup available)
Quick Diagnosis¶
Ask the user: 1. "Did you accidentally delete the collection?" 2. "Are you seeing errors when listing or deploying?" 3. "Do you have a backup of your collection?"
Signs of Collection Corruption¶
skillmeat listreturns errorsskillmeat show <name>fails- Manifest file is empty or malformed
- Collection appears to be missing files
Signs of Data Loss¶
- Collections directory missing or empty
- Can't find collection.toml file
- Artifacts aren't loading
Recovery Steps¶
Step 1: Check Collection Status¶
# Check if collection exists
ls ~/.skillmeat/collection.toml
# Check collection directory
ls -la ~/.skillmeat/
# Try to list artifacts
skillmeat list --verbose
Expected output: List of artifacts or error message
Step 2: Backup Current State (If Possible)¶
Before doing anything, make a backup:
# Backup current state
mkdir ~/collection-recovery-backup
cp -r ~/.skillmeat ~/collection-recovery-backup/
# Note timestamp
date > ~/collection-recovery-backup/RECOVERY-DATE.txt
This preserves current state in case recovery fails.
Step 3: Validate Collection Manifest¶
Check if manifest file is corrupted:
# Check manifest syntax
python3 -m py_compile ~/.skillmeat/collection.toml 2>&1
# Or check with TOML parser
python3 -c "
import tomllib
with open(expanduser('~/.skillmeat/collection.toml'), 'rb') as f:
tomllib.load(f)
print('Manifest is valid')
"
If valid: Manifest is OK, issue is elsewhere If invalid: Manifest is corrupted, needs repair
Step 4: Repair Corrupted Manifest¶
If manifest is corrupted:
# Check current content
cat ~/.skillmeat/collection.toml
# If completely corrupted or empty
rm ~/.skillmeat/collection.toml
skillmeat init
Step 5: Restore from Backup (If Available)¶
If user has a backup:
# Check backup location
ls ~/collection-recovery-backup/
# or
ls ~/Downloads/skillmeat-backup/
# or similar
# Restore from backup
cp ~/collection-recovery-backup/collection.toml ~/.skillmeat/collection.toml
cp -r ~/collection-recovery-backup/artifacts ~/.skillmeat/
# Verify restoration
skillmeat list
Step 6: Verify Collection Integrity¶
Test that collection is working:
# List artifacts
skillmeat list
# Check specific artifact
skillmeat show <artifact-name>
# Try a deployment (non-destructive)
skillmeat deploy <artifact> --dry-run
Recovery Options by Scenario¶
Scenario: Completely Lost Collection¶
User has no backup
Options: 1. Recreate from scratch:
-
Check if artifacts are in deployments:
-
Search marketplace for artifacts they might have used:
Tell user: "We can rebuild your collection. Do you remember what artifacts you had? We can look them up in the marketplace."
Scenario: Corrupted Manifest¶
Manifest file is malformed
Steps: 1. Backup current state 2. Remove corrupted manifest:
3. Re-initialize: 4. Re-add artifacts from memory or marketplaceScenario: Missing Artifacts Directory¶
Artifacts directory deleted or moved
Steps: 1. Check if backup exists:
-
If backup exists, restore:
-
If no backup, reinitialize and re-add artifacts
Scenario: Lock File Corrupted¶
Artifacts have wrong versions or dependencies broken
Steps: 1. Remove lock file:
-
Update all artifacts to re-lock:
-
Verify status:
Common Issues & Fixes¶
Issue: "collection.toml not found"¶
Cause: Collection was deleted or initialization failed
Fix:
Issue: "Invalid TOML syntax"¶
Cause: Manifest file is corrupted
Fix:
# View corruption
cat ~/.skillmeat/collection.toml
# Compare with backup if available
diff ~/.skillmeat/collection.toml ~/backup/collection.toml
# Restore from backup or reinitialize
Issue: "Artifacts not loading"¶
Cause: Artifacts directory missing or file permissions wrong
Fix:
# Check directory exists
ls ~/.skillmeat/artifacts/
# Fix permissions
chmod -R 755 ~/.skillmeat/
# If missing, restore from backup
cp -r ~/backup/artifacts ~/.skillmeat/
Issue: "Circular dependency detected"¶
Cause: Lock file has conflicting versions
Fix:
# Remove lock file to force regeneration
rm ~/.skillmeat/collection.lock
# Update everything
skillmeat update --all --verbose
# Check for real conflicts
skillmeat verify
What to Tell the User¶
If data is lost:¶
"I understand - losing data is frustrating. Here's the good news: if your artifacts are also deployed to your projects, we can recover them. Let me check your projects and we can re-add them to your collection."
If manifest is corrupted:¶
"Your manifest file got corrupted, probably from an interrupted operation. No worries - this is recoverable. We can either restore from a backup if you have one, or reinitialize and re-add your artifacts."
If they don't have a backup:¶
"This is a good opportunity to implement backups going forward. For now, let's focus on recovering what we can. Do you remember what artifacts you had, or can we find them in the marketplace?"
Prevention Tips¶
Share these with users to prevent collection loss:
-
Regular backups:
-
Monitor collection health:
-
Use snapshots for major changes:
-
Keep Git repository:
Escalation Conditions¶
Escalate to engineering if: - Manifest is corrupted and won't re-initialize - Artifacts directory can't be restored - Permission errors prevent recovery - User has custom modifications that can't be recovered
Escalation path: Create GitHub issue with: - Error messages from recovery attempts - Contents of collection.toml (sanitized) - Available backups or recovery options - OS and Python version
Related Resources¶
Script Metadata¶
- Audience: Users with lost/corrupted collections
- Complexity: Medium
- Resolution Time: 10-15 minutes
- Success Rate: 80%+ (higher if backup available)