refactor(naming): remove @ prefix from on-disk filenames (#131)
* refactor(naming): remove @ prefix from on-disk filenames BREAKING CHANGE: Renames @fix_plan.md → fix_plan.md and @AGENT.md → AGENT.md This change improves POSIX compliance and compatibility with command-line tools. The @ prefix was originally used to avoid naming conflicts, but with the .ralph/ folder structure introduced in v0.10.0, this convention is no longer necessary. Changes: - Update all scripts to use new naming (fix_plan.md, AGENT.md) - Update migration script to handle both old and new naming conventions - Update templates to use new naming - Update all documentation references - Update all 420 tests to expect new naming (TDD approach) Migration: - Existing projects with @-prefixed files will be automatically renamed when running ralph-migrate - Projects already using the new naming will continue to work unchanged * docs(claude): update file naming conventions section * fix(migrate): prevent orphaned @-prefixed files during migration When both root/@fix_plan.md and .ralph/@fix_plan.md exist, the root file now takes priority and the .ralph/@fix_plan.md is removed (backup exists). This prevents orphaned legacy files after migration. --------- Co-authored-by: Test User <test@example.com>
This commit is contained in:
parent
05c57207f3
commit
c7e7a1c6a3
32 changed files with 288 additions and 236 deletions
|
|
@ -123,7 +123,7 @@ You are Ralph, an autonomous AI development agent working on a Task Management A
|
|||
|
||||
## Current Objectives
|
||||
1. Study specs/* to learn about the project specifications
|
||||
2. Review @fix_plan.md for current priorities
|
||||
2. Review fix_plan.md for current priorities
|
||||
3. Implement the highest priority item using best practices
|
||||
4. Use parallel subagents for complex tasks (max 100 concurrent)
|
||||
5. Run tests after each implementation
|
||||
|
|
@ -134,7 +134,7 @@ You are Ralph, an autonomous AI development agent working on a Task Management A
|
|||
- Search the codebase before assuming something isn't implemented
|
||||
- Use subagents for expensive operations (file searching, analysis)
|
||||
- Write comprehensive tests with clear documentation
|
||||
- Update @fix_plan.md with your learnings
|
||||
- Update fix_plan.md with your learnings
|
||||
- Commit working changes with descriptive messages
|
||||
|
||||
## 🧪 Testing Guidelines (CRITICAL)
|
||||
|
|
@ -145,13 +145,13 @@ You are Ralph, an autonomous AI development agent working on a Task Management A
|
|||
- Focus on CORE functionality first, comprehensive testing later
|
||||
|
||||
## Current Task
|
||||
Follow @fix_plan.md and choose the most important item to implement next.
|
||||
Follow fix_plan.md and choose the most important item to implement next.
|
||||
EOF
|
||||
}
|
||||
|
||||
# Sample @fix_plan.md
|
||||
# Sample fix_plan.md
|
||||
create_sample_fix_plan() {
|
||||
local file=${1:-"@fix_plan.md"}
|
||||
local file=${1:-"fix_plan.md"}
|
||||
local total=${2:-10}
|
||||
local completed=${3:-3}
|
||||
|
||||
|
|
@ -203,9 +203,9 @@ EOF
|
|||
EOF
|
||||
}
|
||||
|
||||
# Sample @AGENT.md
|
||||
# Sample AGENT.md
|
||||
create_sample_agent_md() {
|
||||
local file=${1:-"@AGENT.md"}
|
||||
local file=${1:-"AGENT.md"}
|
||||
cat > "$file" << 'EOF'
|
||||
# Agent Build Instructions
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ Created the following files:
|
|||
Running tests...
|
||||
✓ All tests passed (5/5)
|
||||
|
||||
Updating @fix_plan.md...
|
||||
Updating fix_plan.md...
|
||||
Completed: Set up basic project structure
|
||||
|
||||
Ready for next task.
|
||||
|
|
@ -365,8 +365,8 @@ create_test_project() {
|
|||
|
||||
# Create Ralph files in .ralph/ subdirectory
|
||||
create_sample_prompt ".ralph/PROMPT.md"
|
||||
create_sample_fix_plan ".ralph/@fix_plan.md" 10 3
|
||||
create_sample_agent_md ".ralph/@AGENT.md"
|
||||
create_sample_fix_plan ".ralph/fix_plan.md" 10 3
|
||||
create_sample_agent_md ".ralph/AGENT.md"
|
||||
|
||||
# Create state files in .ralph/
|
||||
echo "0" > .ralph/.call_count
|
||||
|
|
|
|||
|
|
@ -95,11 +95,11 @@ Test the system.
|
|||
EOF
|
||||
}
|
||||
|
||||
# Helper: Create a mock @fix_plan.md file
|
||||
# Helper: Create a mock fix_plan.md file
|
||||
create_mock_fix_plan() {
|
||||
local total=${1:-5}
|
||||
local completed=${2:-0}
|
||||
local fix_plan_file="$RALPH_DIR/@fix_plan.md"
|
||||
local fix_plan_file="$RALPH_DIR/fix_plan.md"
|
||||
|
||||
mkdir -p "$RALPH_DIR"
|
||||
cat > "$fix_plan_file" << EOF
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ You are Ralph, an autonomous AI development agent.
|
|||
|
||||
## Current Objectives
|
||||
- Study specs/* to learn about the project specifications
|
||||
- Review @fix_plan.md for current priorities
|
||||
- Review fix_plan.md for current priorities
|
||||
|
||||
## Key Principles
|
||||
- ONE task per loop
|
||||
|
|
@ -54,7 +54,7 @@ You are Ralph, an autonomous AI development agent.
|
|||
- LIMIT testing to ~20% of your total effort
|
||||
EOF
|
||||
|
||||
cat > ".ralph/@fix_plan.md" << 'EOF'
|
||||
cat > ".ralph/fix_plan.md" << 'EOF'
|
||||
# Ralph Fix Plan
|
||||
|
||||
## High Priority
|
||||
|
|
@ -70,7 +70,7 @@ cat > ".ralph/@fix_plan.md" << 'EOF'
|
|||
- [x] Project initialization
|
||||
EOF
|
||||
|
||||
cat > ".ralph/@AGENT.md" << 'EOF'
|
||||
cat > ".ralph/AGENT.md" << 'EOF'
|
||||
# Agent Build Instructions
|
||||
|
||||
## Project Setup
|
||||
|
|
@ -128,7 +128,7 @@ You are Ralph, an autonomous AI development agent working on a Task Management A
|
|||
|
||||
## Current Objectives
|
||||
1. Study specs/* to learn about the project specifications
|
||||
2. Review @fix_plan.md for current priorities
|
||||
2. Review fix_plan.md for current priorities
|
||||
3. Implement the highest priority item using best practices
|
||||
4. Use parallel subagents for complex tasks (max 100 concurrent)
|
||||
5. Run tests after each implementation
|
||||
|
|
@ -139,7 +139,7 @@ You are Ralph, an autonomous AI development agent working on a Task Management A
|
|||
- Search the codebase before assuming something isn't implemented
|
||||
- Use subagents for expensive operations (file searching, analysis)
|
||||
- Write comprehensive tests with clear documentation
|
||||
- Update @fix_plan.md with your learnings
|
||||
- Update fix_plan.md with your learnings
|
||||
- Commit working changes with descriptive messages
|
||||
|
||||
## Testing Guidelines (CRITICAL)
|
||||
|
|
@ -166,11 +166,11 @@ You are Ralph, an autonomous AI development agent working on a Task Management A
|
|||
- App loads quickly (<2s initial load)
|
||||
|
||||
## Current Task
|
||||
Follow @fix_plan.md and choose the most important item to implement next.
|
||||
Follow fix_plan.md and choose the most important item to implement next.
|
||||
EOF
|
||||
|
||||
# Create @fix_plan.md in .ralph/
|
||||
cat > ".ralph/@fix_plan.md" << 'EOF'
|
||||
# Create fix_plan.md in .ralph/
|
||||
cat > ".ralph/fix_plan.md" << 'EOF'
|
||||
# Ralph Fix Plan
|
||||
|
||||
## High Priority
|
||||
|
|
@ -374,36 +374,36 @@ remove_ralph_setup_mock() {
|
|||
[[ "$output" -ge 1 ]]
|
||||
}
|
||||
|
||||
# Test 5: ralph-import creates @fix_plan.md
|
||||
@test "ralph-import creates @fix_plan.md with prioritized tasks" {
|
||||
# Test 5: ralph-import creates fix_plan.md
|
||||
@test "ralph-import creates fix_plan.md with prioritized tasks" {
|
||||
create_sample_prd_md "test-app.md"
|
||||
|
||||
run bash "$PROJECT_ROOT/ralph_import.sh" "test-app.md"
|
||||
|
||||
assert_success
|
||||
|
||||
# @fix_plan.md should exist in .ralph/ subfolder
|
||||
assert_file_exists "test-app/.ralph/@fix_plan.md"
|
||||
# fix_plan.md should exist in .ralph/ subfolder
|
||||
assert_file_exists "test-app/.ralph/fix_plan.md"
|
||||
|
||||
# Check structure includes priority sections
|
||||
run grep -c "High Priority" "test-app/.ralph/@fix_plan.md"
|
||||
run grep -c "High Priority" "test-app/.ralph/fix_plan.md"
|
||||
assert_success
|
||||
[[ "$output" -ge 1 ]]
|
||||
|
||||
run grep -c "Medium Priority" "test-app/.ralph/@fix_plan.md"
|
||||
run grep -c "Medium Priority" "test-app/.ralph/fix_plan.md"
|
||||
assert_success
|
||||
[[ "$output" -ge 1 ]]
|
||||
|
||||
run grep -c "Low Priority" "test-app/.ralph/@fix_plan.md"
|
||||
run grep -c "Low Priority" "test-app/.ralph/fix_plan.md"
|
||||
assert_success
|
||||
[[ "$output" -ge 1 ]]
|
||||
|
||||
run grep -c "Completed" "test-app/.ralph/@fix_plan.md"
|
||||
run grep -c "Completed" "test-app/.ralph/fix_plan.md"
|
||||
assert_success
|
||||
[[ "$output" -ge 1 ]]
|
||||
|
||||
# Check checkbox format
|
||||
run grep -E "^\- \[[ x]\]" "test-app/.ralph/@fix_plan.md"
|
||||
run grep -E "^\- \[[ x]\]" "test-app/.ralph/fix_plan.md"
|
||||
assert_success
|
||||
}
|
||||
|
||||
|
|
@ -445,7 +445,7 @@ remove_ralph_setup_mock() {
|
|||
|
||||
# Files should be in custom-named directory under .ralph/ subfolder
|
||||
assert_file_exists "my-custom-project/.ralph/PROMPT.md"
|
||||
assert_file_exists "my-custom-project/.ralph/@fix_plan.md"
|
||||
assert_file_exists "my-custom-project/.ralph/fix_plan.md"
|
||||
assert_file_exists "my-custom-project/.ralph/specs/requirements.md"
|
||||
|
||||
# Default name directory should NOT exist
|
||||
|
|
@ -616,8 +616,8 @@ remove_ralph_setup_mock() {
|
|||
|
||||
# Verify all required files in .ralph/ subfolder
|
||||
assert_file_exists "my-app/.ralph/PROMPT.md"
|
||||
assert_file_exists "my-app/.ralph/@fix_plan.md"
|
||||
assert_file_exists "my-app/.ralph/@AGENT.md"
|
||||
assert_file_exists "my-app/.ralph/fix_plan.md"
|
||||
assert_file_exists "my-app/.ralph/AGENT.md"
|
||||
assert_file_exists "my-app/.ralph/specs/requirements.md"
|
||||
|
||||
# Verify source PRD was copied
|
||||
|
|
@ -738,7 +738,7 @@ You are Ralph, an autonomous AI development agent working on a Task Management A
|
|||
|
||||
## Current Objectives
|
||||
1. Study specs/* to learn about the project specifications
|
||||
2. Review @fix_plan.md for current priorities
|
||||
2. Review fix_plan.md for current priorities
|
||||
|
||||
## Key Principles
|
||||
- ONE task per loop
|
||||
|
|
@ -747,8 +747,8 @@ You are Ralph, an autonomous AI development agent working on a Task Management A
|
|||
- LIMIT testing to ~20% of your total effort
|
||||
EOF
|
||||
|
||||
# Create @fix_plan.md in .ralph/
|
||||
cat > ".ralph/@fix_plan.md" << 'EOF'
|
||||
# Create fix_plan.md in .ralph/
|
||||
cat > ".ralph/fix_plan.md" << 'EOF'
|
||||
# Ralph Fix Plan
|
||||
|
||||
## High Priority
|
||||
|
|
@ -781,13 +781,13 @@ EOF
|
|||
# Output JSON response to stdout (mimicking --output-format json)
|
||||
cat << 'JSON_OUTPUT'
|
||||
{
|
||||
"result": "Successfully converted PRD to Ralph format. Created .ralph/PROMPT.md, .ralph/@fix_plan.md, and .ralph/specs/requirements.md",
|
||||
"result": "Successfully converted PRD to Ralph format. Created .ralph/PROMPT.md, .ralph/fix_plan.md, and .ralph/specs/requirements.md",
|
||||
"sessionId": "session-prd-convert-123",
|
||||
"metadata": {
|
||||
"files_changed": 3,
|
||||
"has_errors": false,
|
||||
"completion_status": "complete",
|
||||
"files_created": [".ralph/PROMPT.md", ".ralph/@fix_plan.md", ".ralph/specs/requirements.md"]
|
||||
"files_created": [".ralph/PROMPT.md", ".ralph/fix_plan.md", ".ralph/specs/requirements.md"]
|
||||
}
|
||||
}
|
||||
JSON_OUTPUT
|
||||
|
|
@ -814,7 +814,7 @@ cat > /dev/null
|
|||
# Ensure .ralph directory exists
|
||||
mkdir -p .ralph
|
||||
|
||||
# Only create PROMPT.md (missing @fix_plan.md and specs/requirements.md)
|
||||
# Only create PROMPT.md (missing fix_plan.md and specs/requirements.md)
|
||||
cat > .ralph/PROMPT.md << 'EOF'
|
||||
# Ralph Development Instructions
|
||||
|
||||
|
|
@ -832,7 +832,7 @@ cat << 'JSON_OUTPUT'
|
|||
"has_errors": true,
|
||||
"completion_status": "partial",
|
||||
"files_created": [".ralph/PROMPT.md"],
|
||||
"missing_files": [".ralph/@fix_plan.md", ".ralph/specs/requirements.md"]
|
||||
"missing_files": [".ralph/fix_plan.md", ".ralph/specs/requirements.md"]
|
||||
}
|
||||
}
|
||||
JSON_OUTPUT
|
||||
|
|
@ -901,7 +901,7 @@ cat > .ralph/PROMPT.md << 'EOF'
|
|||
You are Ralph, an autonomous AI development agent.
|
||||
EOF
|
||||
|
||||
cat > ".ralph/@fix_plan.md" << 'EOF'
|
||||
cat > ".ralph/fix_plan.md" << 'EOF'
|
||||
# Ralph Fix Plan
|
||||
|
||||
## High Priority
|
||||
|
|
@ -920,7 +920,7 @@ EOF
|
|||
|
||||
# Output plain text (no JSON)
|
||||
echo "Mock: Claude Code conversion completed successfully"
|
||||
echo "Created: .ralph/PROMPT.md, .ralph/@fix_plan.md, .ralph/specs/requirements.md"
|
||||
echo "Created: .ralph/PROMPT.md, .ralph/fix_plan.md, .ralph/specs/requirements.md"
|
||||
exit 0
|
||||
MOCK_CLAUDE_TEXT_EOF
|
||||
chmod +x "$MOCK_BIN_DIR/claude"
|
||||
|
|
@ -937,7 +937,7 @@ MOCK_CLAUDE_TEXT_EOF
|
|||
|
||||
# All files should be created in .ralph/ subfolder
|
||||
assert_file_exists "json-test/.ralph/PROMPT.md"
|
||||
assert_file_exists "json-test/.ralph/@fix_plan.md"
|
||||
assert_file_exists "json-test/.ralph/fix_plan.md"
|
||||
assert_file_exists "json-test/.ralph/specs/requirements.md"
|
||||
}
|
||||
|
||||
|
|
@ -983,7 +983,7 @@ MOCK_CLAUDE_TEXT_EOF
|
|||
|
||||
# All files should be created in .ralph/ subfolder
|
||||
assert_file_exists "text-test/.ralph/PROMPT.md"
|
||||
assert_file_exists "text-test/.ralph/@fix_plan.md"
|
||||
assert_file_exists "text-test/.ralph/fix_plan.md"
|
||||
assert_file_exists "text-test/.ralph/specs/requirements.md"
|
||||
}
|
||||
|
||||
|
|
@ -1059,7 +1059,7 @@ cat > .ralph/PROMPT.md << 'EOF'
|
|||
# Ralph Development Instructions
|
||||
EOF
|
||||
|
||||
cat > ".ralph/@fix_plan.md" << 'EOF'
|
||||
cat > ".ralph/fix_plan.md" << 'EOF'
|
||||
# Ralph Fix Plan
|
||||
## High Priority
|
||||
- [ ] Task 1
|
||||
|
|
@ -1128,7 +1128,7 @@ cat > .ralph/PROMPT.md << 'EOF'
|
|||
# Ralph Development Instructions
|
||||
EOF
|
||||
|
||||
cat > ".ralph/@fix_plan.md" << 'EOF'
|
||||
cat > ".ralph/fix_plan.md" << 'EOF'
|
||||
# Ralph Fix Plan
|
||||
## High Priority
|
||||
- [ ] Task 1
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ setup() {
|
|||
You are Ralph, an autonomous AI development agent.
|
||||
|
||||
## Current Objectives
|
||||
1. Follow @fix_plan.md for current priorities
|
||||
1. Follow fix_plan.md for current priorities
|
||||
2. Implement using best practices
|
||||
3. Run tests after each implementation
|
||||
EOF
|
||||
|
|
@ -169,24 +169,24 @@ teardown() {
|
|||
diff templates/PROMPT.md test-project/.ralph/PROMPT.md
|
||||
}
|
||||
|
||||
@test "setup.sh copies fix_plan.md as @fix_plan.md to .ralph/" {
|
||||
@test "setup.sh copies fix_plan.md to .ralph/" {
|
||||
run bash "$SETUP_SCRIPT" test-project
|
||||
|
||||
assert_success
|
||||
assert_file_exists "test-project/.ralph/@fix_plan.md"
|
||||
assert_file_exists "test-project/.ralph/fix_plan.md"
|
||||
|
||||
# Verify content matches source
|
||||
diff templates/fix_plan.md "test-project/.ralph/@fix_plan.md"
|
||||
diff templates/fix_plan.md "test-project/.ralph/fix_plan.md"
|
||||
}
|
||||
|
||||
@test "setup.sh copies AGENT.md as @AGENT.md to .ralph/" {
|
||||
@test "setup.sh copies AGENT.md to .ralph/" {
|
||||
run bash "$SETUP_SCRIPT" test-project
|
||||
|
||||
assert_success
|
||||
assert_file_exists "test-project/.ralph/@AGENT.md"
|
||||
assert_file_exists "test-project/.ralph/AGENT.md"
|
||||
|
||||
# Verify content matches source
|
||||
diff templates/AGENT.md "test-project/.ralph/@AGENT.md"
|
||||
diff templates/AGENT.md "test-project/.ralph/AGENT.md"
|
||||
}
|
||||
|
||||
@test "setup.sh copies specs templates to .ralph/specs/" {
|
||||
|
|
@ -332,8 +332,8 @@ teardown() {
|
|||
bash "$SETUP_SCRIPT" my-custom-app
|
||||
|
||||
assert_file_exists "my-custom-app/.ralph/PROMPT.md"
|
||||
assert_file_exists "my-custom-app/.ralph/@fix_plan.md"
|
||||
assert_file_exists "my-custom-app/.ralph/@AGENT.md"
|
||||
assert_file_exists "my-custom-app/.ralph/fix_plan.md"
|
||||
assert_file_exists "my-custom-app/.ralph/AGENT.md"
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
|
|
@ -370,8 +370,8 @@ teardown() {
|
|||
|
||||
# Verify all files in .ralph/
|
||||
assert_file_exists "my-project/.ralph/PROMPT.md"
|
||||
assert_file_exists "my-project/.ralph/@fix_plan.md"
|
||||
assert_file_exists "my-project/.ralph/@AGENT.md"
|
||||
assert_file_exists "my-project/.ralph/fix_plan.md"
|
||||
assert_file_exists "my-project/.ralph/AGENT.md"
|
||||
# README stays at root
|
||||
assert_file_exists "my-project/README.md"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ setup() {
|
|||
|
||||
# Create sample project files
|
||||
create_sample_prompt
|
||||
create_sample_fix_plan "$RALPH_DIR/@fix_plan.md" 10 3
|
||||
create_sample_fix_plan "$RALPH_DIR/fix_plan.md" 10 3
|
||||
|
||||
# Source library components
|
||||
source "${BATS_TEST_DIRNAME}/../../lib/date_utils.sh"
|
||||
|
|
@ -93,8 +93,8 @@ setup() {
|
|||
|
||||
context="Loop #${loop_count}. "
|
||||
|
||||
if [[ -f "$RALPH_DIR/@fix_plan.md" ]]; then
|
||||
local incomplete_tasks=$(grep -c "^- \[ \]" "$RALPH_DIR/@fix_plan.md" 2>/dev/null || echo "0")
|
||||
if [[ -f "$RALPH_DIR/fix_plan.md" ]]; then
|
||||
local incomplete_tasks=$(grep -c "^- \[ \]" "$RALPH_DIR/fix_plan.md" 2>/dev/null || echo "0")
|
||||
context+="Remaining tasks: ${incomplete_tasks}. "
|
||||
fi
|
||||
|
||||
|
|
@ -218,9 +218,9 @@ teardown() {
|
|||
[[ "$output" == *"Loop #5"* ]] || [[ "$output" == *"5"* ]]
|
||||
}
|
||||
|
||||
@test "build_loop_context counts remaining tasks from @fix_plan.md" {
|
||||
@test "build_loop_context counts remaining tasks from fix_plan.md" {
|
||||
# Create fix plan with 7 incomplete tasks in .ralph/ directory
|
||||
cat > "$RALPH_DIR/@fix_plan.md" << 'EOF'
|
||||
cat > "$RALPH_DIR/fix_plan.md" << 'EOF'
|
||||
# Fix Plan
|
||||
- [x] Task 1 done
|
||||
- [x] Task 2 done
|
||||
|
|
@ -287,8 +287,8 @@ EOF
|
|||
[[ ${#output} -le 600 ]]
|
||||
}
|
||||
|
||||
@test "build_loop_context handles missing @fix_plan.md gracefully" {
|
||||
rm -f "$RALPH_DIR/@fix_plan.md"
|
||||
@test "build_loop_context handles missing fix_plan.md gracefully" {
|
||||
rm -f "$RALPH_DIR/fix_plan.md"
|
||||
|
||||
run build_loop_context 1
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ teardown() {
|
|||
@test "check_existing_ralph returns 'complete' when all required files exist" {
|
||||
mkdir -p .ralph
|
||||
echo "# PROMPT" > .ralph/PROMPT.md
|
||||
echo "# Fix Plan" > .ralph/@fix_plan.md
|
||||
echo "# Agent" > .ralph/@AGENT.md
|
||||
echo "# Fix Plan" > .ralph/fix_plan.md
|
||||
echo "# Agent" > .ralph/AGENT.md
|
||||
|
||||
check_existing_ralph || true
|
||||
|
||||
|
|
@ -50,20 +50,20 @@ teardown() {
|
|||
@test "check_existing_ralph returns 'partial' when some files are missing" {
|
||||
mkdir -p .ralph
|
||||
echo "# PROMPT" > .ralph/PROMPT.md
|
||||
# Missing @fix_plan.md and @AGENT.md
|
||||
# Missing fix_plan.md and AGENT.md
|
||||
|
||||
check_existing_ralph || true
|
||||
|
||||
assert_equal "$RALPH_STATE" "partial"
|
||||
[[ " ${RALPH_MISSING_FILES[*]} " =~ ".ralph/@fix_plan.md" ]]
|
||||
[[ " ${RALPH_MISSING_FILES[*]} " =~ ".ralph/@AGENT.md" ]]
|
||||
[[ " ${RALPH_MISSING_FILES[*]} " =~ ".ralph/fix_plan.md" ]]
|
||||
[[ " ${RALPH_MISSING_FILES[*]} " =~ ".ralph/AGENT.md" ]]
|
||||
}
|
||||
|
||||
@test "is_ralph_enabled returns 0 when fully enabled" {
|
||||
mkdir -p .ralph
|
||||
echo "# PROMPT" > .ralph/PROMPT.md
|
||||
echo "# Fix Plan" > .ralph/@fix_plan.md
|
||||
echo "# Agent" > .ralph/@AGENT.md
|
||||
echo "# Fix Plan" > .ralph/fix_plan.md
|
||||
echo "# Agent" > .ralph/AGENT.md
|
||||
|
||||
run is_ralph_enabled
|
||||
assert_success
|
||||
|
|
@ -314,16 +314,16 @@ EOF
|
|||
|
||||
assert_success
|
||||
[[ -f ".ralph/PROMPT.md" ]]
|
||||
[[ -f ".ralph/@fix_plan.md" ]]
|
||||
[[ -f ".ralph/@AGENT.md" ]]
|
||||
[[ -f ".ralph/fix_plan.md" ]]
|
||||
[[ -f ".ralph/AGENT.md" ]]
|
||||
[[ -f ".ralphrc" ]]
|
||||
}
|
||||
|
||||
@test "enable_ralph_in_directory returns ALREADY_ENABLED when complete and no force" {
|
||||
mkdir -p .ralph
|
||||
echo "# PROMPT" > .ralph/PROMPT.md
|
||||
echo "# Fix Plan" > .ralph/@fix_plan.md
|
||||
echo "# Agent" > .ralph/@AGENT.md
|
||||
echo "# Fix Plan" > .ralph/fix_plan.md
|
||||
echo "# Agent" > .ralph/AGENT.md
|
||||
|
||||
export ENABLE_FORCE="false"
|
||||
|
||||
|
|
@ -335,8 +335,8 @@ EOF
|
|||
@test "enable_ralph_in_directory overwrites with force flag" {
|
||||
mkdir -p .ralph
|
||||
echo "old content" > .ralph/PROMPT.md
|
||||
echo "old fix plan" > .ralph/@fix_plan.md
|
||||
echo "old agent" > .ralph/@AGENT.md
|
||||
echo "old fix plan" > .ralph/fix_plan.md
|
||||
echo "old agent" > .ralph/AGENT.md
|
||||
|
||||
export ENABLE_FORCE="true"
|
||||
export ENABLE_PROJECT_NAME="new-project"
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ should_exit_gracefully() {
|
|||
fi
|
||||
|
||||
# 4. Check fix_plan.md for completion
|
||||
if [[ -f "$RALPH_DIR/@fix_plan.md" ]]; then
|
||||
local total_items=$(grep -c "^- \[" "$RALPH_DIR/@fix_plan.md" 2>/dev/null)
|
||||
local completed_items=$(grep -c "^- \[x\]" "$RALPH_DIR/@fix_plan.md" 2>/dev/null)
|
||||
if [[ -f "$RALPH_DIR/fix_plan.md" ]]; then
|
||||
local total_items=$(grep -c "^- \[" "$RALPH_DIR/fix_plan.md" 2>/dev/null)
|
||||
local completed_items=$(grep -c "^- \[x\]" "$RALPH_DIR/fix_plan.md" 2>/dev/null)
|
||||
|
||||
# Handle case where grep returns no matches (exit code 1)
|
||||
[[ -z "$total_items" ]] && total_items=0
|
||||
|
|
@ -176,9 +176,9 @@ EOF
|
|||
assert_equal "$result" ""
|
||||
}
|
||||
|
||||
# Test 10: Exit when @fix_plan.md all items complete
|
||||
# Test 10: Exit when fix_plan.md all items complete
|
||||
@test "should_exit_gracefully exits when all fix_plan items complete" {
|
||||
cat > "$RALPH_DIR/@fix_plan.md" << 'EOF'
|
||||
cat > "$RALPH_DIR/fix_plan.md" << 'EOF'
|
||||
# Fix Plan
|
||||
- [x] Task 1
|
||||
- [x] Task 2
|
||||
|
|
@ -189,9 +189,9 @@ EOF
|
|||
assert_equal "$result" "plan_complete"
|
||||
}
|
||||
|
||||
# Test 11: No exit when @fix_plan.md partially complete
|
||||
# Test 11: No exit when fix_plan.md partially complete
|
||||
@test "should_exit_gracefully continues when fix_plan partially complete" {
|
||||
cat > "$RALPH_DIR/@fix_plan.md" << 'EOF'
|
||||
cat > "$RALPH_DIR/fix_plan.md" << 'EOF'
|
||||
# Fix Plan
|
||||
- [x] Task 1
|
||||
- [ ] Task 2
|
||||
|
|
@ -202,9 +202,9 @@ EOF
|
|||
assert_equal "$result" ""
|
||||
}
|
||||
|
||||
# Test 12: No exit when @fix_plan.md missing
|
||||
# Test 12: No exit when fix_plan.md missing
|
||||
@test "should_exit_gracefully continues when fix_plan missing" {
|
||||
# Don't create @fix_plan.md
|
||||
# Don't create fix_plan.md
|
||||
|
||||
result=$(should_exit_gracefully || true)
|
||||
assert_equal "$result" ""
|
||||
|
|
@ -236,9 +236,9 @@ EOF
|
|||
assert_equal "$result" "test_saturation"
|
||||
}
|
||||
|
||||
# Test 16: @fix_plan.md with no checkboxes
|
||||
# Test 16: fix_plan.md with no checkboxes
|
||||
@test "should_exit_gracefully handles fix_plan with no checkboxes" {
|
||||
cat > "$RALPH_DIR/@fix_plan.md" << 'EOF'
|
||||
cat > "$RALPH_DIR/fix_plan.md" << 'EOF'
|
||||
# Fix Plan
|
||||
This is just text, no tasks yet.
|
||||
EOF
|
||||
|
|
@ -247,9 +247,9 @@ EOF
|
|||
assert_equal "$result" ""
|
||||
}
|
||||
|
||||
# Test 17: @fix_plan.md with mixed checkbox formats
|
||||
# Test 17: fix_plan.md with mixed checkbox formats
|
||||
@test "should_exit_gracefully handles mixed checkbox formats" {
|
||||
cat > "$RALPH_DIR/@fix_plan.md" << 'EOF'
|
||||
cat > "$RALPH_DIR/fix_plan.md" << 'EOF'
|
||||
# Fix Plan
|
||||
- [x] Task 1 completed
|
||||
- [ ] Task 2 pending
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ teardown() {
|
|||
assert_success
|
||||
[[ -d ".ralph" ]]
|
||||
[[ -f ".ralph/PROMPT.md" ]]
|
||||
[[ -f ".ralph/@fix_plan.md" ]]
|
||||
[[ -f ".ralph/@AGENT.md" ]]
|
||||
[[ -f ".ralph/fix_plan.md" ]]
|
||||
[[ -f ".ralph/AGENT.md" ]]
|
||||
}
|
||||
|
||||
@test "ralph enable-ci creates .ralphrc configuration" {
|
||||
|
|
@ -197,7 +197,7 @@ EOF
|
|||
|
||||
assert_success
|
||||
# Check that tasks were imported
|
||||
grep -q "authentication\|API\|database" .ralph/@fix_plan.md
|
||||
grep -q "authentication\|API\|database" .ralph/fix_plan.md
|
||||
}
|
||||
|
||||
@test "ralph enable-ci fails gracefully with missing PRD file" {
|
||||
|
|
@ -238,8 +238,8 @@ EOF
|
|||
@test "ralph enable-ci does not overwrite existing files without force" {
|
||||
mkdir -p .ralph
|
||||
echo "original prompt" > .ralph/PROMPT.md
|
||||
echo "original fix plan" > .ralph/@fix_plan.md
|
||||
echo "original agent" > .ralph/@AGENT.md
|
||||
echo "original fix plan" > .ralph/fix_plan.md
|
||||
echo "original agent" > .ralph/AGENT.md
|
||||
|
||||
run bash "$RALPH_ENABLE_CI" --from none
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ setup() {
|
|||
|
||||
# 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
|
||||
create_sample_fix_plan "$RALPH_DIR/fix_plan.md" 10 3
|
||||
|
||||
# Source library components
|
||||
source "${BATS_TEST_DIRNAME}/../../lib/date_utils.sh"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue