fix(setup): create .ralphrc with consistent tool permissions (#137)

* fix(setup): create .ralphrc with consistent tool permissions (#136)

- Update default ALLOWED_TOOLS in ralph_loop.sh to include Edit,
  Bash(npm *), and Bash(pytest) for test execution capability
- Make setup.sh generate .ralphrc file using same permissions as
  ralph-enable, ensuring consistency between initialization paths
- Add 8 new TDD tests for .ralphrc creation and ALLOWED_TOOLS defaults
- Update documentation in README.md and CLAUDE.md

This fixes the mismatch where PROMPT.md instructs the model to run
tests, but the default permissions didn't allow it. Now both
ralph-setup and ralph-enable create projects with identical tool
permissions.

Test count: 440 (up from 424)

* fix: address PR review feedback

- Update version badges from v0.10.1 to v0.11.2 (README.md)
- Update test count badges from 310 to 440 (README.md, CLAUDE.md)
- Fix .ralphrc generator label: use sed to replace "ralph enable"
  with "ralph-setup" when using generate_ralphrc() from library
- Add v0.11.2 changelog entry to CLAUDE.md

* docs(readme): comprehensive update for v0.11.2

- Reorganize Recent Improvements with v0.11.x versions prominent
- Add ralph-enable wizard section with full documentation
- Add .ralphrc configuration section with example
- Update Quick Start to show ralph-enable as Option A (recommended)
- Update test counts to 440 across 15 files
- Collapse v0.9.x versions into expandable details section
- Add new features to What's Working Now section
- Link to issue #138 for automated badge updates
- Update Command Reference with new commands

---------

Co-authored-by: Test User <test@example.com>
This commit is contained in:
Frank Bria 2026-01-28 21:10:02 -07:00 committed by GitHub
parent 33739e0fb2
commit dbb27d89e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 269 additions and 107 deletions

View file

@ -15,10 +15,13 @@ cd "$PROJECT_NAME"
# Determine templates directory location (checked AFTER cd into project)
# Check local ../templates first, then global ~/.ralph/templates
TEMPLATES_DIR=""
LIB_DIR=""
if [[ -d "../templates" ]]; then
TEMPLATES_DIR="../templates"
LIB_DIR="../lib"
elif [[ -d "$HOME/.ralph/templates" ]]; then
TEMPLATES_DIR="$HOME/.ralph/templates"
LIB_DIR="$HOME/.ralph/lib"
else
echo "❌ Error: Templates directory not found."
echo " Expected at: ../templates or ~/.ralph/templates"
@ -44,6 +47,51 @@ 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
# Generate .ralphrc configuration file
# Source enable_core.sh if available for generate_ralphrc(), otherwise create inline
if [[ -f "$LIB_DIR/enable_core.sh" ]]; then
# Temporarily disable colors for cleaner output
export ENABLE_USE_COLORS=false
source "$LIB_DIR/enable_core.sh"
# Generate .ralphrc and fix the generator label (library says "ralph enable")
generate_ralphrc "$PROJECT_NAME" "generic" "local" | sed 's/Generated by: ralph enable/Generated by: ralph-setup/' > .ralphrc
else
# Fallback: create minimal .ralphrc inline (same content as generate_ralphrc)
cat > .ralphrc << RALPHRCEOF
# .ralphrc - Ralph project configuration
# Generated by: ralph-setup
# Documentation: https://github.com/frankbria/ralph-claude-code
# Project identification
PROJECT_NAME="${PROJECT_NAME}"
PROJECT_TYPE="generic"
# Loop settings
MAX_CALLS_PER_HOUR=100
CLAUDE_TIMEOUT_MINUTES=15
CLAUDE_OUTPUT_FORMAT="json"
# Tool permissions
# Comma-separated list of allowed tools
ALLOWED_TOOLS="Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)"
# Session management
SESSION_CONTINUITY=true
SESSION_EXPIRY_HOURS=24
# Task sources (for ralph enable --sync)
# Options: local, beads, github (comma-separated for multiple)
TASK_SOURCES="local"
GITHUB_TASK_LABEL="ralph-task"
BEADS_FILTER="status:open"
# Circuit breaker thresholds
CB_NO_PROGRESS_THRESHOLD=3
CB_SAME_ERROR_THRESHOLD=5
CB_OUTPUT_DECLINE_THRESHOLD=70
RALPHRCEOF
fi
# Initialize git
git init
echo "# $PROJECT_NAME" > README.md