* 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>
58 lines
1.8 KiB
Bash
Executable file
58 lines
1.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Ralph Project Setup Script
|
|
# Creates project structure with Ralph-specific files in .ralph/ subfolder
|
|
set -e
|
|
|
|
PROJECT_NAME=${1:-"my-project"}
|
|
|
|
echo "🚀 Setting up Ralph project: $PROJECT_NAME"
|
|
|
|
# Create project directory
|
|
mkdir -p "$PROJECT_NAME"
|
|
cd "$PROJECT_NAME"
|
|
|
|
# Determine templates directory location (checked AFTER cd into project)
|
|
# Check local ../templates first, then global ~/.ralph/templates
|
|
TEMPLATES_DIR=""
|
|
if [[ -d "../templates" ]]; then
|
|
TEMPLATES_DIR="../templates"
|
|
elif [[ -d "$HOME/.ralph/templates" ]]; then
|
|
TEMPLATES_DIR="$HOME/.ralph/templates"
|
|
else
|
|
echo "❌ Error: Templates directory not found."
|
|
echo " Expected at: ../templates or ~/.ralph/templates"
|
|
echo " Please run ./install.sh first to install Ralph globally."
|
|
exit 1
|
|
fi
|
|
|
|
# Verify required template files exist
|
|
if [[ ! -f "$TEMPLATES_DIR/PROMPT.md" ]]; then
|
|
echo "❌ Error: Required template file PROMPT.md not found in $TEMPLATES_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
# Create structure:
|
|
# - src/ stays at root for compatibility with existing tooling
|
|
# - All Ralph-specific files go in .ralph/ subfolder
|
|
mkdir -p src
|
|
mkdir -p .ralph/{specs/stdlib,examples,logs,docs/generated}
|
|
|
|
# Copy templates to .ralph/
|
|
cp "$TEMPLATES_DIR/PROMPT.md" .ralph/
|
|
cp "$TEMPLATES_DIR/fix_plan.md" .ralph/@fix_plan.md
|
|
cp "$TEMPLATES_DIR/AGENT.md" .ralph/@AGENT.md
|
|
cp -r "$TEMPLATES_DIR/specs"/* .ralph/specs/ 2>/dev/null || true
|
|
|
|
# Initialize git
|
|
git init
|
|
echo "# $PROJECT_NAME" > README.md
|
|
git add .
|
|
git commit -m "Initial Ralph project setup"
|
|
|
|
echo "✅ Project $PROJECT_NAME created!"
|
|
echo "Next steps:"
|
|
echo " 1. Edit .ralph/PROMPT.md with your project requirements"
|
|
echo " 2. Update .ralph/specs/ with your project specifications"
|
|
echo " 3. Run: ../ralph_loop.sh"
|
|
echo " 4. Monitor: ../ralph_monitor.sh"
|