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

@ -489,3 +489,57 @@ teardown() {
# The script properly quotes variables, so spaces should be handled correctly
[[ $status -eq 0 ]]
}
# =============================================================================
# Test: .ralphrc Generation (Issue #136)
# =============================================================================
@test "setup.sh creates .ralphrc file" {
run bash "$SETUP_SCRIPT" test-project
assert_success
assert_file_exists "test-project/.ralphrc"
}
@test "setup.sh .ralphrc contains ALLOWED_TOOLS with Edit" {
bash "$SETUP_SCRIPT" test-project
# .ralphrc should include Edit tool
grep -q "Edit" test-project/.ralphrc
}
@test "setup.sh .ralphrc contains ALLOWED_TOOLS with test execution capabilities" {
bash "$SETUP_SCRIPT" test-project
# .ralphrc should include Bash(npm *) or Bash(pytest) for test execution
grep -qE 'Bash\(npm \*\)|Bash\(pytest\)' test-project/.ralphrc
}
@test "setup.sh .ralphrc ALLOWED_TOOLS matches ralph-enable defaults" {
bash "$SETUP_SCRIPT" test-project
# The expected ALLOWED_TOOLS value that ralph-enable uses
local expected_tools='ALLOWED_TOOLS="Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)"'
# Check that .ralphrc contains the expected ALLOWED_TOOLS line
# Use grep -F for literal string matching (avoids regex interpretation of *)
grep -qF "$expected_tools" test-project/.ralphrc
}
@test "setup.sh .ralphrc is committed in initial git commit" {
bash "$SETUP_SCRIPT" test-project
cd test-project
# Verify .ralphrc is tracked by git (not in untracked files)
run command git ls-files .ralphrc
assert_success
assert_equal "$output" ".ralphrc"
}
@test "setup.sh .ralphrc contains project name" {
bash "$SETUP_SCRIPT" my-custom-project
# .ralphrc should reference the project name
grep -q "my-custom-project" my-custom-project/.ralphrc
}