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
|
|
@ -15,17 +15,18 @@ setup() {
|
|||
git config user.email "test@example.com"
|
||||
git config user.name "Test User"
|
||||
|
||||
# Set up environment
|
||||
export PROMPT_FILE="PROMPT.md"
|
||||
export LOG_DIR="logs"
|
||||
export DOCS_DIR="docs/generated"
|
||||
export STATUS_FILE="status.json"
|
||||
export EXIT_SIGNALS_FILE=".exit_signals"
|
||||
export CALL_COUNT_FILE=".call_count"
|
||||
export TIMESTAMP_FILE=".last_reset"
|
||||
export CLAUDE_SESSION_FILE=".claude_session_id"
|
||||
export RALPH_SESSION_FILE=".ralph_session"
|
||||
export RALPH_SESSION_HISTORY_FILE=".ralph_session_history"
|
||||
# Set up environment with .ralph/ subfolder structure
|
||||
export RALPH_DIR=".ralph"
|
||||
export PROMPT_FILE="$RALPH_DIR/PROMPT.md"
|
||||
export LOG_DIR="$RALPH_DIR/logs"
|
||||
export DOCS_DIR="$RALPH_DIR/docs/generated"
|
||||
export STATUS_FILE="$RALPH_DIR/status.json"
|
||||
export EXIT_SIGNALS_FILE="$RALPH_DIR/.exit_signals"
|
||||
export CALL_COUNT_FILE="$RALPH_DIR/.call_count"
|
||||
export TIMESTAMP_FILE="$RALPH_DIR/.last_reset"
|
||||
export CLAUDE_SESSION_FILE="$RALPH_DIR/.claude_session_id"
|
||||
export RALPH_SESSION_FILE="$RALPH_DIR/.ralph_session"
|
||||
export RALPH_SESSION_HISTORY_FILE="$RALPH_DIR/.ralph_session_history"
|
||||
export CLAUDE_MIN_VERSION="2.0.76"
|
||||
export CLAUDE_CODE_CMD="claude"
|
||||
export CLAUDE_USE_CONTINUE="true"
|
||||
|
|
@ -35,9 +36,9 @@ setup() {
|
|||
echo "$(date +%Y%m%d%H)" > "$TIMESTAMP_FILE"
|
||||
echo '{"test_only_loops": [], "done_signals": [], "completion_indicators": []}' > "$EXIT_SIGNALS_FILE"
|
||||
|
||||
# Create sample project files
|
||||
create_sample_prompt
|
||||
create_sample_fix_plan "@fix_plan.md" 10 3
|
||||
# Create sample project files in .ralph/ directory
|
||||
create_sample_prompt "$RALPH_DIR/PROMPT.md"
|
||||
create_sample_fix_plan "$RALPH_DIR/@fix_plan.md" 10 3
|
||||
|
||||
# Source library components
|
||||
source "${BATS_TEST_DIRNAME}/../../lib/date_utils.sh"
|
||||
|
|
@ -238,7 +239,7 @@ function_exists_in_ralph() {
|
|||
EOF
|
||||
|
||||
run parse_json_response "$output_file"
|
||||
local result_file=".json_parse_result"
|
||||
local result_file="$RALPH_DIR/.json_parse_result"
|
||||
|
||||
[[ -f "$result_file" ]]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue