Skip to content

feat: implement standard/custom rules system with automatic migration#13

Merged
maxritter merged 3 commits intomainfrom
fix/rules-migration-and-customization-system
Nov 17, 2025
Merged

feat: implement standard/custom rules system with automatic migration#13
maxritter merged 3 commits intomainfrom
fix/rules-migration-and-customization-system

Conversation

@maxritter
Copy link
Owner

@maxritter maxritter commented Nov 17, 2025

Summary

Implements a comprehensive standard/custom rules system that allows users to maintain their custom rules while receiving standard rule updates. Includes automatic migration for existing installations.

Key Features

🎯 Standard/Custom Rules System

  • Standard rules (.claude/rules/standard/) - Always updated by install script
  • Custom rules (.claude/rules/custom/) - Never touched, preserved across updates
  • config.yaml now has standard: and custom: sections per command
  • Custom rules can have same names as standard rules (prefixed with custom:)

🔄 Automatic Migration

  • New scripts/lib/migration.sh handles upgrades from old structure
  • Detects old rules layout and prompts user for migration
  • Creates backup before any changes
  • Converts config.yaml to new format automatically
  • Clear next steps for users with custom rules

🛠️ Install Script Improvements

  • Bash 3.2+ compatible - Removed associative arrays (fixes macOS compatibility)
  • Auto-install yq - For YAML config merging
  • Dependency checking - Validates required tools at startup
  • Better organization - Moved setup-env.sh to scripts/lib/
  • Fixed UX - Default answer capitalization (Y/n, y/N format)

📦 Build Script Fixes

  • Removed Bash 4+ requirement (works on macOS default Bash 3.2)
  • Uses temp files instead of associative arrays
  • Supports loading from both standard/ and custom/ directories
  • Custom skills automatically named @custom-skillname

Migration Flow

For users upgrading from older versions:

  1. Install script detects old structure
  2. Asks user for consent (warns about custom rules)
  3. Creates backup at .claude/rules.backup.[timestamp]
  4. Moves core/, extended/, workflow/ to standard/
  5. Creates empty custom/ directories
  6. Converts config.yaml to new format
  7. Shows next steps for manual custom rule migration

Testing Checklist

  • Fresh install works on macOS (Bash 3.2)
  • Fresh install works on Linux (Bash 4+)
  • Migration from old structure works
  • Custom rules are preserved during updates
  • Standard rules are updated correctly
  • Build script generates commands/skills correctly
  • yq installation works on all platforms

Breaking Changes

None - migration is automatic and backward compatible.

Documentation

  • Updated README with standard/custom rules explanation
  • Added migration documentation
  • Clarified update behavior

🤖 Generated with Claude Code

maxritter and others added 3 commits November 17, 2025 09:13
Major Changes:
- Add standard/custom rules directory structure for better update management
- Implement automatic migration system for existing installations
- Fix Bash 3.2 compatibility issues (removes associative arrays)
- Add yq auto-installation for YAML config merging
- Add comprehensive dependency checking at install start

Rules System:
- .claude/rules/standard/ - Always updated by install script
- .claude/rules/custom/ - Never touched, preserved across updates
- config.yaml now has standard/custom sections per command
- Custom rules prefixed with 'custom:' to allow name conflicts

Migration:
- scripts/lib/migration.sh - Handles upgrades from old structure
- Asks user consent before moving old rules to standard/
- Creates backup before migration
- Converts config.yaml to new standard/custom format

Install Improvements:
- Move setup-env.sh to scripts/lib/ for better organization
- Add ensure_yq() for YAML processing
- Add check_required_dependencies() for early validation
- Fix default answer capitalization (Y/n, y/N format)
- Preserve custom rules during config.yaml updates

Build Script Fixes:
- Remove Bash 4+ associative arrays requirement
- Use temp files for rule storage (Bash 3.2+ compatible)
- Support standard/ and custom/ rule loading
- Custom skills named @custom-skillname

Documentation:
- Update README with standard/custom rules explanation
- Document migration workflow
- Clarify update behavior

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

Co-Authored-By: Claude <noreply@anthropic.com>
Changes:
- Add --local flag to install.sh for testing without GitHub downloads
- Update _bootstrap_download() to support local file copying
- Update download_file() to use local files when LOCAL_MODE=true
- Update get_repo_files() to use local find when LOCAL_MODE=true
- Update E2E tests to use --local flag for CI/CD
- All tests now use local files instead of downloading from GitHub

Usage:
  Local testing: bash scripts/install.sh --local --non-interactive --skip-env
  CI/CD: Already integrated in tests/e2e/test-install.sh

This ensures CI/CD tests use the code from the current commit
instead of downloading from GitHub, preventing version mismatches.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@maxritter maxritter merged commit fee6c11 into main Nov 17, 2025
11 checks passed
@github-actions
Copy link
Contributor

🎉 This PR is included in version 2.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@maxritter maxritter deleted the fix/rules-migration-and-customization-system branch November 17, 2025 08:46
@github-actions
Copy link
Contributor

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@claude claude bot mentioned this pull request Feb 16, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant