Files
ClaudeForge/test/rollback.sh
Reza Rezvani 35d17b0ba3 feat(v2.0.0): migrate to Claude Code v2.1.4+ architecture
Major architectural update to support Claude Code v2.1.4+ features including
hooks, modern permission syntax, and hot-reload capabilities.

## Core Component Updates

### Skill (skill/SKILL.md)
- Updated frontmatter from old `tools:` to `permissions.allow:` array
- Added wildcard Bash permissions: Bash(ls:*), Bash(find:*), Bash(git:*)
- Python modules unchanged (backward compatible)

### Command (command/enhance-claude-md.md)
- Updated frontmatter from `allowed-tools:` to `permissions.allow:` array
- Added startup hook for workflow initiation
- 3-phase discovery workflow unchanged

### Guardian Agent (agent/claude-md-guardian.md)
- Updated frontmatter from `tools:` to `permissions.allow:` array
- Added SessionStart hook for auto-updates on new sessions
- Added PreToolUse/PostToolUse hooks for Write validation
- Added fork_safe: true for independent operation
- Removed obsolete mcp_tools field
- Agent workflow logic unchanged

## Installation Scripts

### install.sh
- Added Claude Code version detection (checks for 2.1.0+)
- Added auto-migration logic with timestamped backups
- Added post-installation v2.1.4 compatibility validation
- Updated version to 2.0.0
- Updated download URLs to main branch

### install.ps1
- Added equivalent PowerShell version detection
- Added auto-migration logic with timestamped backups
- Added post-installation v2.1.4 compatibility validation
- Updated version to 2.0.0
- Updated download URLs to main branch

## Documentation

### New Files
- docs/MIGRATION_V2.md: Comprehensive migration guide
- test/validate_migration.sh: Validation script (18 tests)
- test/rollback.sh: Rollback script for v1.x restoration
- test/README.md: Testing documentation

### Updated Files
- README.md: Updated version badges (2.0.0, Claude Code 2.1.4+)
- README.md: Added "New in v2.0" section highlighting features
- CHANGELOG.md: Added comprehensive v2.0.0 release entry
- CHANGELOG.md: Documented all changes, fixes, and breaking changes

## Validation

All changes validated:
✓ Python modules compile without errors
✓ install.sh bash syntax valid
✓ YAML frontmatter syntax valid (skill, command, agent)
✓ No Python code modified (2,190 lines unchanged)
✓ Backward compatible with existing installations

## Breaking Changes

- Minimum Claude Code version: 2.1.0+ (was 2.0+)
- Old permission syntax deprecated (but backward compatible)
- Users on Claude Code < 2.1.0 should use ClaudeForge v1.0.0

## Migration Path

Installer automatically:
1. Detects Claude Code version
2. Backs up v1.x installations
3. Installs v2.0 with new syntax
4. Validates compatibility

See docs/MIGRATION_V2.md for detailed instructions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2026-01-13 13:26:46 +01:00

79 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# ClaudeForge Rollback Script
# Rolls back from v2.0.0 to v1.0.0 using automatic backups
echo "=== ClaudeForge Rollback to v1.x ==="
echo ""
SKILLS_DIR="$HOME/.claude/skills"
COMMANDS_DIR="$HOME/.claude/commands"
AGENTS_DIR="$HOME/.claude/agents"
RESTORED_COUNT=0
# Find and restore skill backup
echo "Searching for skill backup..."
for backup in "$SKILLS_DIR"/claudeforge-skill.v1_backup_* "$SKILLS_DIR"/claudeforge-skill.backup.*; do
if [ -d "$backup" ]; then
echo "Found backup: $(basename $backup)"
rm -rf "$SKILLS_DIR/claudeforge-skill"
mv "$backup" "$SKILLS_DIR/claudeforge-skill"
echo "✓ Restored skill from: $(basename $backup)"
((RESTORED_COUNT++))
break
fi
done
# Find and restore command backup
echo ""
echo "Searching for command backup..."
for backup in "$COMMANDS_DIR"/enhance-claude-md.v1_backup_* "$COMMANDS_DIR"/enhance-claude-md.backup.*; do
if [ -d "$backup" ]; then
echo "Found backup: $(basename $backup)"
rm -rf "$COMMANDS_DIR/enhance-claude-md"
mv "$backup" "$COMMANDS_DIR/enhance-claude-md"
echo "✓ Restored command from: $(basename $backup)"
((RESTORED_COUNT++))
break
fi
done
# Find and restore agent backup
echo ""
echo "Searching for agent backup..."
for backup in "$AGENTS_DIR"/claude-md-guardian.md.v1_backup_* "$AGENTS_DIR"/claude-md-guardian.md.backup.*; do
if [ -f "$backup" ]; then
echo "Found backup: $(basename $backup)"
rm -f "$AGENTS_DIR/claude-md-guardian.md"
mv "$backup" "$AGENTS_DIR/claude-md-guardian.md"
echo "✓ Restored agent from: $(basename $backup)"
((RESTORED_COUNT++))
break
fi
done
# Summary
echo ""
echo "===================================="
echo "Rollback Summary"
echo "===================================="
echo "Components restored: $RESTORED_COUNT"
echo ""
if [ $RESTORED_COUNT -eq 0 ]; then
echo "⚠️ No backups found. Cannot rollback."
echo ""
echo "To manually install v1.0.0:"
echo " curl -fsSL https://github.com/alirezarezvani/ClaudeForge/archive/refs/tags/v1.0.0.tar.gz | tar -xz"
echo " cd ClaudeForge-1.0.0"
echo " ./install.sh"
exit 1
else
echo "✅ Rollback complete!"
echo ""
echo "Next steps:"
echo "1. Restart Claude Code"
echo "2. Test with: /enhance-claude-md"
exit 0
fi