feat(structure): migrate Ralph files to .ralph/ subfolder (#109)
* feat(structure): migrate Ralph files to .ralph/ subfolder BREAKING CHANGE: Ralph configuration files now live in .ralph/ subfolder This refactoring moves all Ralph-specific files into a hidden .ralph/ directory while keeping src/ at the project root. This improves compatibility with existing tooling and keeps the project root clean. Changes: - Move PROMPT.md, @fix_plan.md, @AGENT.md to .ralph/ - Move specs/, logs/, docs/generated/, examples/ to .ralph/ - Move state files (.response_analysis, .circuit_breaker_state, etc.) to .ralph/ - Keep src/ at project root (unchanged) - Add RALPH_DIR=".ralph" configuration variable - Add ralph-migrate command for existing projects - Create migrate_to_ralph_folder.sh migration script - Update all path references in scripts and tests - Update documentation (README.md, CLAUDE.md) New project structure: project/ ├── .ralph/ # Ralph configuration │ ├── PROMPT.md │ ├── @fix_plan.md │ ├── @AGENT.md │ ├── specs/ │ ├── logs/ │ └── docs/generated/ └── src/ # Source code (unchanged) Migration: Run `ralph-migrate` in existing projects to upgrade. All 310 tests pass (100% pass rate). * chore: add .claude/settings.local.json to .gitignore * fix: address code review feedback for .ralph/ subfolder structure Fixes multiple path-related issues identified in code review: Test fixes: - Fix create_sample_prompt to use $RALPH_DIR/PROMPT.md in test_session_continuity.bats - Fix result_file path to use $RALPH_DIR/.json_parse_result in test_json_parsing.bats - Fix @fix_plan.md and .response_analysis paths in test_cli_modern.bats - Update templates directory missing test to account for global fallback Template fix: - Fix @fix_plan.md reference in templates/PROMPT.md to use .ralph/ prefix Script fixes: - Fix PROMPT_FILE comparison in ralph_loop.sh to use $RALPH_DIR/PROMPT.md - Fix examples migration logic in migrate_to_ralph_folder.sh (remove premature mkdir) - Move templates directory check AFTER cd in setup.sh (was checking wrong location) - Add template directory validation with fallback to global templates All 310 tests pass. * Update migrate_to_ralph_folder.sh Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com> * fix: address code review feedback for .ralph/ subfolder structure Code Review Fixes: - Fix test_json_parsing.bats: all result_file and session file paths now use $RALPH_DIR prefix - Fix ralph_loop.sh help text: paths now show .ralph/.ralph_session, .ralph/.call_count, etc. - Fix migrate_to_ralph_folder.sh: - Proper error handling for date command (separate local declaration) - Use cp -a source/. dest/ pattern to preserve dotfiles and attributes - Remove 2>/dev/null suppression to surface copy errors - Update create_files.sh to use .ralph/ structure for embedded scripts - Update .gitignore with all .ralph/ state file paths - Add old structure detection in ralph_loop.sh with helpful migration message Version Update: - Bump to v0.10.0 (breaking change: structural reorganization) - Update README.md and CLAUDE.md with new version and release notes - Add ralph-migrate documentation to Key Commands section All 310 tests pass. --------- Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
This commit is contained in:
parent
0e95f67318
commit
9b19d70e35
27 changed files with 1126 additions and 585 deletions
50
install.sh
50
install.sh
|
|
@ -154,21 +154,37 @@ EOF
|
|||
RALPH_HOME="$HOME/.ralph"
|
||||
|
||||
exec "$RALPH_HOME/ralph_import.sh" "$@"
|
||||
EOF
|
||||
|
||||
# Create ralph-migrate command
|
||||
cat > "$INSTALL_DIR/ralph-migrate" << 'EOF'
|
||||
#!/bin/bash
|
||||
# Ralph Migration - Global Command
|
||||
# Migrates existing projects from flat structure to .ralph/ subfolder
|
||||
|
||||
RALPH_HOME="$HOME/.ralph"
|
||||
|
||||
exec "$RALPH_HOME/migrate_to_ralph_folder.sh" "$@"
|
||||
EOF
|
||||
|
||||
# Copy actual script files to Ralph home with modifications for global operation
|
||||
cp "$SCRIPT_DIR/ralph_monitor.sh" "$RALPH_HOME/"
|
||||
|
||||
|
||||
# Copy PRD import script to Ralph home
|
||||
cp "$SCRIPT_DIR/ralph_import.sh" "$RALPH_HOME/"
|
||||
|
||||
|
||||
# Copy migration script to Ralph home
|
||||
cp "$SCRIPT_DIR/migrate_to_ralph_folder.sh" "$RALPH_HOME/"
|
||||
|
||||
# Make all commands executable
|
||||
chmod +x "$INSTALL_DIR/ralph"
|
||||
chmod +x "$INSTALL_DIR/ralph-monitor"
|
||||
chmod +x "$INSTALL_DIR/ralph-monitor"
|
||||
chmod +x "$INSTALL_DIR/ralph-setup"
|
||||
chmod +x "$INSTALL_DIR/ralph-import"
|
||||
chmod +x "$INSTALL_DIR/ralph-migrate"
|
||||
chmod +x "$RALPH_HOME/ralph_monitor.sh"
|
||||
chmod +x "$RALPH_HOME/ralph_import.sh"
|
||||
chmod +x "$RALPH_HOME/migrate_to_ralph_folder.sh"
|
||||
chmod +x "$RALPH_HOME/lib/"*.sh
|
||||
|
||||
log "SUCCESS" "Ralph scripts installed to $INSTALL_DIR"
|
||||
|
|
@ -193,7 +209,7 @@ install_ralph_loop() {
|
|||
# Install global setup.sh
|
||||
install_setup() {
|
||||
log "INFO" "Installing global setup script..."
|
||||
|
||||
|
||||
# Create modified setup.sh for global operation
|
||||
cat > "$RALPH_HOME/setup.sh" << 'EOF'
|
||||
#!/bin/bash
|
||||
|
|
@ -210,14 +226,15 @@ echo "🚀 Setting up Ralph project: $PROJECT_NAME"
|
|||
mkdir -p "$PROJECT_NAME"
|
||||
cd "$PROJECT_NAME"
|
||||
|
||||
# Create structure
|
||||
mkdir -p {specs/stdlib,src,examples,logs,docs/generated}
|
||||
# Create structure with .ralph/ subfolder
|
||||
mkdir -p src
|
||||
mkdir -p .ralph/{specs/stdlib,examples,logs,docs/generated}
|
||||
|
||||
# Copy templates from Ralph home
|
||||
cp "$RALPH_HOME/templates/PROMPT.md" .
|
||||
cp "$RALPH_HOME/templates/fix_plan.md" @fix_plan.md
|
||||
cp "$RALPH_HOME/templates/AGENT.md" @AGENT.md
|
||||
cp -r "$RALPH_HOME/templates/specs/"* specs/ 2>/dev/null || true
|
||||
# Copy templates from Ralph home to .ralph/ subfolder
|
||||
cp "$RALPH_HOME/templates/PROMPT.md" .ralph/
|
||||
cp "$RALPH_HOME/templates/fix_plan.md" .ralph/@fix_plan.md
|
||||
cp "$RALPH_HOME/templates/AGENT.md" .ralph/@AGENT.md
|
||||
cp -r "$RALPH_HOME/templates/specs/"* .ralph/specs/ 2>/dev/null || true
|
||||
|
||||
# Initialize git
|
||||
git init
|
||||
|
|
@ -227,14 +244,14 @@ git commit -m "Initial Ralph project setup"
|
|||
|
||||
echo "✅ Project $PROJECT_NAME created!"
|
||||
echo "Next steps:"
|
||||
echo " 1. Edit PROMPT.md with your project requirements"
|
||||
echo " 2. Update specs/ with your project specifications"
|
||||
echo " 1. Edit .ralph/PROMPT.md with your project requirements"
|
||||
echo " 2. Update .ralph/specs/ with your project specifications"
|
||||
echo " 3. Run: ralph --monitor"
|
||||
echo " 4. Monitor: ralph-monitor (if running manually)"
|
||||
EOF
|
||||
|
||||
chmod +x "$RALPH_HOME/setup.sh"
|
||||
|
||||
|
||||
log "SUCCESS" "Global setup script installed"
|
||||
}
|
||||
|
||||
|
|
@ -275,12 +292,13 @@ main() {
|
|||
echo " ralph --help # Show Ralph options"
|
||||
echo " ralph-setup my-project # Create new Ralph project"
|
||||
echo " ralph-import prd.md # Convert PRD to Ralph project"
|
||||
echo " ralph-migrate # Migrate existing project to .ralph/ structure"
|
||||
echo " ralph-monitor # Manual monitoring dashboard"
|
||||
echo ""
|
||||
echo "Quick start:"
|
||||
echo " 1. ralph-setup my-awesome-project"
|
||||
echo " 2. cd my-awesome-project"
|
||||
echo " 3. # Edit PROMPT.md with your requirements"
|
||||
echo " 3. # Edit .ralph/PROMPT.md with your requirements"
|
||||
echo " 4. ralph --monitor"
|
||||
echo ""
|
||||
|
||||
|
|
@ -296,7 +314,7 @@ case "${1:-install}" in
|
|||
;;
|
||||
uninstall)
|
||||
log "INFO" "Uninstalling Ralph for Claude Code..."
|
||||
rm -f "$INSTALL_DIR/ralph" "$INSTALL_DIR/ralph-monitor" "$INSTALL_DIR/ralph-setup" "$INSTALL_DIR/ralph-import"
|
||||
rm -f "$INSTALL_DIR/ralph" "$INSTALL_DIR/ralph-monitor" "$INSTALL_DIR/ralph-setup" "$INSTALL_DIR/ralph-import" "$INSTALL_DIR/ralph-migrate"
|
||||
rm -rf "$RALPH_HOME"
|
||||
log "SUCCESS" "Ralph for Claude Code uninstalled"
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue