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

@ -171,6 +171,24 @@ teardown() {
[[ "$output" == *"Read"* ]]
}
@test "CLAUDE_ALLOWED_TOOLS default includes Edit tool (issue #136)" {
# Verify the default includes Edit for file editing
run grep 'CLAUDE_ALLOWED_TOOLS=.*:-' "${BATS_TEST_DIRNAME}/../../ralph_loop.sh"
# The default should include Edit
[[ "$output" == *"Edit"* ]]
}
@test "CLAUDE_ALLOWED_TOOLS default includes test execution tools (issue #136)" {
# Verify the default includes test execution capabilities
run grep 'CLAUDE_ALLOWED_TOOLS=.*:-' "${BATS_TEST_DIRNAME}/../../ralph_loop.sh"
# Should include Bash(npm *) for npm test
[[ "$output" == *'Bash(npm *)'* ]]
# Should include Bash(pytest) for Python tests
[[ "$output" == *'Bash(pytest)'* ]]
}
@test "CLAUDE_USE_CONTINUE defaults to true" {
# Verify by checking the default in ralph_loop.sh via grep
run grep 'CLAUDE_USE_CONTINUE=' "${BATS_TEST_DIRNAME}/../../ralph_loop.sh"

View file

@ -377,7 +377,7 @@ build_ralph_cmd_for_test() {
local CLAUDE_OUTPUT_FORMAT="${3:-json}"
local VERBOSE_PROGRESS="${4:-false}"
local CLAUDE_TIMEOUT_MINUTES="${5:-15}"
local CLAUDE_ALLOWED_TOOLS="${6:-Write,Bash(git *),Read}"
local CLAUDE_ALLOWED_TOOLS="${6:-Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)}"
local CLAUDE_USE_CONTINUE="${7:-true}"
local CLAUDE_SESSION_EXPIRY_HOURS="${8:-24}"
local RALPH_DIR=".ralph"
@ -403,7 +403,7 @@ build_ralph_cmd_for_test() {
ralph_cmd="$ralph_cmd --timeout $CLAUDE_TIMEOUT_MINUTES"
fi
# Forward --allowed-tools if non-default
if [[ "$CLAUDE_ALLOWED_TOOLS" != "Write,Bash(git *),Read" ]]; then
if [[ "$CLAUDE_ALLOWED_TOOLS" != "Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)" ]]; then
ralph_cmd="$ralph_cmd --allowed-tools '$CLAUDE_ALLOWED_TOOLS'"
fi
# Forward --no-continue if session continuity disabled
@ -460,7 +460,7 @@ build_ralph_cmd_for_test() {
}
@test "monitor does not forward default parameters" {
local result=$(build_ralph_cmd_for_test 100 ".ralph/PROMPT.md" "json" "false" "15" "Write,Bash(git *),Read" "true" "24")
local result=$(build_ralph_cmd_for_test 100 ".ralph/PROMPT.md" "json" "false" "15" "Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)" "true" "24")
# Should only be "ralph" with no extra flags
[[ "$result" == "ralph" ]]
}