Skip to content

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

Merged
frankbria merged 3 commits into
mainfrom
fix/136-setup-ralphrc-permissions
Jan 29, 2026
Merged

fix(setup): create .ralphrc with consistent tool permissions#137
frankbria merged 3 commits into
mainfrom
fix/136-setup-ralphrc-permissions

Conversation

@frankbria

@frankbria frankbria commented Jan 28, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #136 - ralph-setup now creates a .ralphrc file with the same tool permissions as ralph-enable, ensuring consistent behavior between both project initialization paths.

Changes:

  • Updated default ALLOWED_TOOLS in ralph_loop.sh from Write,Bash(git *),Read to Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)
  • Modified setup.sh to generate .ralphrc configuration file
  • Added 8 new TDD tests for .ralphrc creation and ALLOWED_TOOLS defaults
  • Updated documentation in README.md and CLAUDE.md

Root cause: The default PROMPT.md template instructs the model to run tests, but the previous default permissions (Write,Bash(git *),Read) didn't include:

  • Edit - Required for efficient file modifications
  • Bash(npm *) - Required for running npm test
  • Bash(pytest) - Required for running Python tests

Test plan

  • All 440 tests pass (8 new tests added)
  • Verify ralph-setup my-project creates .ralphrc with correct ALLOWED_TOOLS
  • Verify default ALLOWED_TOOLS in ralph_loop.sh includes Edit and test tools
  • Verify documentation updated in README.md and CLAUDE.md

Breaking changes

None - this is additive. Existing projects with custom .ralphrc files will continue to work. The new default is more permissive but still restricted to safe operations.

Summary by CodeRabbit

  • New Features

    • Project setup now generates and persists a project configuration file (.ralphrc) by default.
    • Default CLI tool permissions expanded to include code editing, npm package management, and test execution.
    • New setup commands added: an interactive enable wizard and a non-interactive enable CI command.
  • Documentation

    • README and release notes updated for v0.11.2 to describe the enable wizard, .ralphrc behavior, and expanded permissions.
  • Tests

    • New integration and unit tests verifying .ralphrc creation, contents, and the expanded default permissions.

✏️ Tip: You can customize this high-level summary in your review settings.

- 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)
@coderabbitai

coderabbitai Bot commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

The PR expands the default CLAUDE_ALLOWED_TOOLS to include Edit, Bash(npm *), and Bash(pytest); makes ralph-setup generate a .ralphrc (sourcing enable_core.sh when available or falling back to inline content) so ralph-setup and ralph-enable produce identical .ralphrc; and updates docs and tests to reflect these defaults and added behavior.

Changes

Cohort / File(s) Summary
Documentation & release notes
CLAUDE.md, README.md
Bumped version to v0.11.2, updated test counts/status, documented Setup Permissions Fix, added Enable Wizard/ralph-enable docs, and described .ralphrc and expanded default CLAUDE_ALLOWED_TOOLS.
CLI / loop logic
ralph_loop.sh
Default CLAUDE_ALLOWED_TOOLS changed to Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest) and the conditional that forwards --allowed-tools now compares against this new default.
Setup / config generation
setup.sh
Adds LIB_DIR resolution, stricter template error handling (exit on missing templates), and generation of .ralphrc by sourcing enable_core.shgenerate_ralphrc when present or writing an inline fallback, ensuring .ralphrc is created during setup.
Integration tests
tests/integration/test_project_setup.bats
New tests verifying .ralphrc creation, presence of expanded ALLOWED_TOOLS (including Edit, npm, pytest), project name in .ralphrc, and that .ralphrc is git-tracked and committed.
Unit tests
tests/unit/test_cli_modern.bats, tests/unit/test_cli_parsing.bats
Added/updated tests asserting the new default includes Edit, Bash(npm *), and Bash(pytest) and that forwarding logic treats the expanded list as the default.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ralph-setup
  participant Filesystem
  participant enable_core.sh
  participant Git

  User->>ralph-setup: run setup (create project)
  ralph-setup->>Filesystem: locate templates (../templates or ~/.ralph/templates)
  alt templates missing
    ralph-setup->>User: echo error and exit 1
  else templates found
    ralph-setup->>ralph-setup: set LIB_DIR
    ralph-setup->>Filesystem: check LIB_DIR/enable_core.sh
    alt enable_core.sh exists
      ralph-setup->>enable_core.sh: source (generate_ralphrc)
      enable_core.sh--)ralph-setup: emit .ralphrc content (ALLOWED_TOOLS includes Edit, npm, pytest)
    else fallback
      ralph-setup->>Filesystem: write inline .ralphrc (matching content)
    end
    ralph-setup->>Filesystem: create project/.ralphrc
    ralph-setup->>Git: git add & commit .ralphrc
    Git--)ralph-setup: commit recorded
    ralph-setup->>User: setup complete
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I dug a tiny config chest,
.ralphrc snug within its nest.
Edit, npm, pytest all set to play,
Setup and enable now hop the same way.
Tests cheer — behold the passing quest!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding .ralphrc generation to setup with consistent tool permissions aligned with the enable command.
Linked Issues check ✅ Passed All objectives from #136 are met: .ralphrc is now generated by ralph-setup with consistent ALLOWED_TOOLS including Write, Read, Edit, Bash(git *), Bash(npm *), and Bash(pytest), and ralph-setup now matches ralph-enable behavior.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #136: .ralphrc generation in setup, ALLOWED_TOOLS defaults update, test additions, and documentation updates reflecting v0.11.2 version bump.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/136-setup-ralphrc-permissions

Comment @coderabbitai help to get the list of available commands and usage tips.

@macroscopeapp

macroscopeapp Bot commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

Create a .ralphrc during setup with default allowed tools 'Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)' and update ralph_loop.sh defaults to match

Add .ralphrc generation in setup.sh with consistent tool permissions and align CLI defaults in ralph_loop.sh; update docs and tests for v0.11.2 and 440 tests.

📍Where to Start

Start with .generate_ralphrc logic in setup.sh, then review default tool handling in setup_tmux_session within ralph_loop.sh.


Macroscope summarized 5cb4c50.

Comment thread setup.sh

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Critical

Issue on line in setup.sh:7:

PROJECT_NAME from user input is interpolated unsanitized into the heredoc. When .ralphrc is later sourced, malicious input like test"; rm -rf ~; # executes arbitrary commands. Consider validating PROJECT_NAME at line 7 to reject characters like ", ;, `, $, or newlines.

-PROJECT_NAME=${1:-"my-project"}
+PROJECT_NAME=${1:-"my-project"}
+
+# Validate PROJECT_NAME to prevent command injection when .ralphrc is sourced
+if [[ ! "$PROJECT_NAME" =~ ^[a-zA-Z0-9_-]+$ ]]; then
+    echo "❌ Error: PROJECT_NAME must contain only alphanumeric characters, hyphens, and underscores."
+    exit 1
+fi

🚀 Want me to fix this? Reply ex: "fix it for me".

@github-actions

Copy link
Copy Markdown

Code Review: fix(setup): create .ralphrc with consistent tool permissions

Overview

This PR addresses issue #136 by ensuring ralph-setup creates a .ralphrc file with the same tool permissions as ralph-enable. The changes are well-structured and maintain consistency across both project initialization paths.

✅ Strengths

1. Code Quality

  • Follows existing codebase patterns and conventions
  • Properly reuses generate_ralphrc() from lib/enable_core.sh with sensible fallback
  • Fallback implementation in setup.sh (lines 59-91) mirrors generate_ralphrc() exactly
  • Temporarily disables colors with export ENABLE_USE_COLORS=false for cleaner output

2. Documentation Updates

  • Both README.md and CLAUDE.md updated with new default ALLOWED_TOOLS
  • Changes are minimal and focused
  • README adds clear v0.11.2 changelog entry

3. Test Coverage

  • 8 new TDD tests added for .ralphrc creation (tests 498-545 in test_project_setup.bats)
  • 4 new tests for ALLOWED_TOOLS defaults in test_cli_modern.bats (lines 174-190)
  • Tests verify: file creation, Edit tool presence, test execution tools, matching ralph-enable defaults, git commit inclusion

4. Backward Compatibility

  • No breaking changes - additive only
  • Existing projects with custom .ralphrc files continue to work
  • The new default is more permissive but still restricted to safe operations

⚠️ Minor Concerns

1. Redundant Variable Assignment
In setup.sh line 65 (fallback block):

PROJECT_NAME="${PROJECT_NAME}"

This is redundant since PROJECT_NAME is already defined. While not a bug, it could be simplified to:

PROJECT_NAME="$PROJECT_NAME"

Or better yet, reference the existing script variable directly without reassignment.

2. Duplicate Hardcoded Value
The ALLOWED_TOOLS default appears in multiple locations:

  • ralph_loop.sh:46 - Script default
  • setup.sh:75 - Fallback inline
  • lib/enable_core.sh:689 - generate_ralphrc()

While all three locations were correctly updated in this PR, future maintainers must remember to update all three simultaneously. Consider extracting to a shared constant or document this dependency explicitly.

🔒 Security Assessment

Good security posture:

  • Added tools (Edit, Bash(npm *), Bash(pytest)) are safe for development workflows
  • Pattern-based Bash permissions (Bash(npm *), Bash(pytest)) restrict execution to specific command families
  • No unrestricted Bash access granted
  • Git operations already permitted (Bash(git *))

Recommendation: Document in CLAUDE.md or README that users can further restrict these permissions in their .ralphrc for additional security in production environments.

📊 Performance Considerations

No performance impact. The changes are:

  • Static file generation during setup
  • No runtime overhead in the loop
  • Configuration loading was already implemented

🧪 Test Coverage Summary

All 8 new tests are well-designed and cover:

  • ✅ File creation
  • ✅ Edit tool inclusion
  • ✅ Test execution tools (npm, pytest)
  • ✅ Matching ralph-enable defaults
  • ✅ Git commit inclusion
  • ✅ Project name preservation

Test implementation uses proper grep -qF for literal string matching, avoiding regex interpretation issues.

✅ Conclusion

Approval: ✅ WITH MINOR SUGGESTIONS

This PR successfully addresses issue #136 with high-quality implementation. The changes are:

  • Well-tested (8 new TDD tests)
  • Properly documented
  • Backward compatible
  • Following repository conventions

Recommended before merge:

  1. Consider removing redundant PROJECT_NAME="${PROJECT_NAME}" in setup.sh line 65 (optional)
  2. Consider adding comment in ralph_loop.sh or CLAUDE.md noting the three locations where ALLOWED_TOOLS default is defined to aid future maintenance

Overall Assessment: This is a solid, well-executed fix that improves consistency between ralph-setup and ralph-enable while maintaining backward compatibility and adding appropriate test coverage.

@github-actions

Copy link
Copy Markdown

Review posted successfully to PR #137.

New%20session%20-%202026-01-28T23%3A03%3A31.049Z
opencode session  |  github run

@claude

claude Bot commented Jan 28, 2026

Copy link
Copy Markdown

Code Review - PR 137

Summary

This PR successfully addresses issue 136 by ensuring ralph-setup creates a .ralphrc configuration file with consistent tool permissions matching ralph-enable. The implementation is well-tested and properly documented.

Positive Highlights

1. Root Cause Analysis
The PR description clearly identifies the problem: the default PROMPT.md instructs the model to run tests, but the old default permissions (Write,Bash(git *),Read) lacked the necessary tools:

  • Missing Edit for efficient file modifications
  • Missing Bash(npm *) for running npm tests
  • Missing Bash(pytest) for Python test execution

2. Implementation Quality

  • DRY Principle: Reuses generate_ralphrc() from lib/enable_core.sh when available (setup.sh:52-56)
  • Graceful Fallback: Provides inline .ralphrc generation if library unavailable (setup.sh:58-92)
  • Consistency: Both code paths produce identical .ralphrc content
  • Git Integration: .ralphrc correctly included in initial commit via git add . (setup.sh:97)

3. Test Coverage
Added 8 comprehensive TDD tests covering:

  • File creation verification (test line 497-502)
  • Edit tool presence (504-509)
  • Test execution capabilities (511-516)
  • Exact match with ralph-enable defaults (518-527)
  • Git commit integration (529-538)
  • Project name configuration (540-545)

All tests use proper assertions and isolation patterns.

4. Documentation Updates

  • Updated CLAUDE.md default ALLOWED_TOOLS (line 208)
  • Updated README.md CLI help text (line 695)
  • Added .ralphrc to project structure diagram (README.md:470)
  • Added version note in roadmap section (README.md:134-136)

5. Consistency Across Codebase

  • Updated ralph_loop.sh default (line 46)
  • Updated setup_tmux_session() comparison (line 220)
  • Updated test helpers in test_cli_parsing.bats (lines 380, 406, 463)
  • Updated CLI modern tests (test_cli_modern.bats:174-189)

Observations and Recommendations

1. Template Content Duplication (Minor)
The inline fallback in setup.sh (lines 59-91) duplicates the template from generate_ralphrc() in lib/enable_core.sh (lines 673-705).

Recommendation: This is acceptable for robustness (setup.sh can work standalone), but consider adding a comment referencing lib/enable_core.sh:generate_ralphrc() for maintenance visibility.

2. Error Handling
The code properly handles the case where lib/enable_core.sh is unavailable and falls back gracefully. No issues found.

3. Color Export Handling
Line 54 (export ENABLE_USE_COLORS=false) properly suppresses color codes for clean .ralphrc output. Good defensive programming.

Security Considerations

No security concerns. The changes only affect default tool permissions (more permissive but still safe), configuration file generation (no user input injection), and template copying (existing safe patterns).

Performance Considerations

No performance impact. The .ralphrc generation adds negligible overhead during project setup.

Breaking Changes

None - This is additive. Existing projects with custom .ralphrc files will continue to work unchanged.

Test Pass Rate

The PR reports all 440 tests passing (8 new tests added). This maintains the project's 100% test pass rate quality standard per CLAUDE.md.

Compliance with CLAUDE.md Standards

  • Testing Requirements: 100% pass rate, integration tests added
  • Git Workflow: Conventional commit format used
  • Documentation: CLAUDE.md, README.md, and inline comments updated
  • Template Maintenance: Templates kept current

Final Recommendation

APPROVED

This PR is well-implemented, thoroughly tested, and properly documented. It successfully resolves the permission mismatch between ralph-setup and ralph-enable.


Review conducted using repository CLAUDE.md guidelines and conventions.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@README.md`:
- Around line 134-137: Top-level README version and test badges conflict with
the changelog entry: update any badges or header lines that still reference
"v0.10.1" and "310 tests" so they match the new release "v0.11.2" and the
correct test count shown in the changelog; locate and edit the header/version
badge and the test count/badge strings in README.md (search for "v0.10.1" and
"310 tests") and replace them with "v0.11.2" and the updated tests number so all
references are consistent.

In `@setup.sh`:
- Around line 50-57: The generated .ralphrc header currently identifies the
generator as "ralph enable"; update the call site or generation to allow
overriding that label: either set an env var (e.g.,
RALPH_GENERATOR="ralph-setup") before invoking generate_ralphrc or pass an extra
argument to generate_ralphrc indicating the generator name, or post-process the
produced .ralphrc to replace the "Generated by: ralph enable" line with
"Generated by: ralph-setup"; change the invocation in setup.sh (the
generate_ralphrc call that writes to .ralphrc) and/or update generate_ralphrc
implementation to accept and honor a generator name parameter so setup-generated
files reflect "ralph-setup".

Comment thread README.md Outdated
Comment thread setup.sh
- 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
@claude

claude Bot commented Jan 29, 2026

Copy link
Copy Markdown

Follow-up Review - PR 137

Summary

Excellent work addressing the review feedback! The second commit (f20779a) successfully resolved both concerns raised by CodeRabbit and other reviewers.

Changes Verified ✅

1. Version Badge Consistency (Previously flagged by CodeRabbit)

  • ✅ README.md badges updated: v0.10.1 → v0.11.2, 310 tests → 440 tests (lines 5-6)
  • ✅ CLAUDE.md header updated: v0.11.1 → v0.11.2, 424 tests → 440 tests (line 9)
  • ✅ README.md "Project Status" section updated (lines 19, 21)
  • ✅ Changelog entry added to CLAUDE.md (lines 439-444)

2. Generator Label Fix (Previously flagged by CodeRabbit)

  • ✅ setup.sh now uses sed to replace "ralph enable" with "ralph-setup" in generated .ralphrc (line 56)
  • Implementation: generate_ralphrc ... | sed 's/Generated by: ralph enable/Generated by: ralph-setup/'
  • This ensures accurate attribution without modifying the shared library function

Code Quality Assessment

Strengths:

  1. Elegant sed solution: The sed post-processing approach maintains DRY principles while customizing output
  2. Comprehensive testing: All 440 tests passing with 8 new tests specifically for .ralphrc creation
  3. Backward compatibility: Existing projects unaffected
  4. Documentation alignment: All version references now consistent across README.md and CLAUDE.md

Implementation Pattern:
The two-path approach (library + fallback) is well-executed:

  • Primary path: Reuses generate_ralphrc() from lib/enable_core.sh with sed correction (lines 50-56)
  • Fallback path: Inline generation maintains identical content (lines 58-92)
  • Both produce consistent .ralphrc files with correct ALLOWED_TOOLS

Security & Best Practices ✅

Tool Permissions Expansion:

  • Old default: Write,Bash(git *),Read
  • New default: Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)

This change is appropriate because:

  • ✅ Edit tool: Essential for efficient file modifications (safer than Write for updates)
  • ✅ Bash(npm *): Required for npm test execution as instructed in PROMPT.md template
  • ✅ Bash(pytest): Required for Python test execution
  • ✅ Still restrictive: No unrestricted Bash access, only pattern-matched commands

Test Coverage Analysis ✅

New tests in test_project_setup.bats (lines 497-545) validate:

  1. .ralphrc file creation
  2. Edit tool presence in ALLOWED_TOOLS
  3. Test execution tool presence (npm/pytest)
  4. Exact match with ralph-enable defaults
  5. Git commit integration
  6. Project name preservation

Test methodology uses proper bash assertions:

  • grep -qF for literal string matching (avoiding regex edge cases with *)
  • assert_file_exists for file verification
  • git ls-files for commit validation

Alignment with CLAUDE.md Standards ✅

This PR meets all repository quality requirements:

  • Testing: 100% pass rate maintained (440/440 tests)
  • Documentation: CLAUDE.md, README.md, and inline comments updated
  • Git workflow: Conventional commit messages used
  • Breaking changes: None - fully backward compatible
  • Template maintenance: .ralphrc generation aligned across setup paths

Final Assessment

Status: APPROVED ✅

All previous review concerns have been addressed:

  1. ✅ Version badges corrected across all files
  2. ✅ Generator label fixed with elegant sed solution
  3. ✅ Comprehensive test coverage added
  4. ✅ Documentation fully updated
  5. ✅ No security concerns
  6. ✅ Backward compatible

The PR successfully resolves issue 136 and maintains the high quality standards of the Ralph codebase. The second commit demonstrates excellent responsiveness to code review feedback.

Recommendation: Ready to merge.


Review conducted following repository CLAUDE.md guidelines and conventions.

@github-actions

Copy link
Copy Markdown

Code Review

This PR successfully addresses issue #136 with a well-tested implementation. The changes maintain consistency between and while adding comprehensive test coverage.

✅ Strengths

  • Comprehensive tests: 8 new TDD tests thoroughly validate .ralphrc creation
  • Documentation updates: CLAUDE.md and README.md properly updated
  • Backward compatibility: No breaking changes, additive only
  • DRY principle: Properly reuses with graceful fallback

🔒 Security Consideration

The variable is interpolated directly into the generated file at setup.sh:66 and lib/enable_core.sh:679:

PROJECT_NAME="${PROJECT_NAME}"

While not currently exploitable in this codebase (PROJECT_NAME is only used in safe string contexts like README generation), this pattern could become a vulnerability if future code uses PROJECT_NAME in or command substitution contexts.

Recommendation: Add input validation in setup.sh after line 7:

# Validate PROJECT_NAME to prevent command injection when .ralphrc is sourced
if [[ ! "$PROJECT_NAME" =~ ^[a-zA-Z0-9_-]+$ ]]; then
    echo "❌ Error: PROJECT_NAME must contain only alphanumeric characters, hyphens, and underscores"
    exit 1
fi

This defensive measure follows security best practices and aligns with the repository's focus on safety and reliability.

Conclusion

APPROVED WITH MINOR SUGGESTION

The implementation is solid and well-tested. The input validation suggestion is optional but recommended for enhanced security posture.

@github-actions

Copy link
Copy Markdown

Comment posted successfully: #137 (comment)

New%20session%20-%202026-01-29T04%3A00%3A44.466Z
opencode session  |  github run

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
README.md (5)

39-39: Update stale test count reference.

Line 39 still references "310 passing tests" but the project now has 440 tests as indicated by the badges and Project Status section.

📝 Proposed fix
-- 310 passing tests across 11 test files
+- 440 passing tests across 11 test files

542-543: Update stale test count references.

Lines 542-543 still reference "308 tests" but should reflect the current count of 440 tests.

📝 Proposed fix
 Current test status:
-- **308 tests** across 11 test files
-- **100% pass rate** (308/308 passing)
+- **440 tests** across 11 test files
+- **100% pass rate** (440/440 passing)
 - Comprehensive unit and integration tests

644-644: Update stale test count reference.

Line 644 still references "308 tests" but should reflect the current count of 440 tests.

📝 Proposed fix
-npm test  # All 308 tests must pass
+npm test  # All 440 tests must pass

728-728: Update stale version reference in roadmap section.

Line 728 shows "Current Status: v0.9.9" but should reflect v0.11.2 given the changes in this PR.

📝 Proposed fix
-### Current Status: v0.9.9
+### Current Status: v0.11.2

735-735: Update stale test count reference.

Line 735 still references "308 comprehensive tests" but should reflect the current count of 440 tests.

📝 Proposed fix
-- 308 comprehensive tests (100% pass rate)
+- 440 comprehensive tests (100% pass rate)
 - tmux integration and live monitoring

- 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
@frankbria frankbria merged commit dbb27d8 into main Jan 29, 2026
4 of 6 checks passed
@frankbria frankbria deleted the fix/136-setup-ralphrc-permissions branch January 29, 2026 04:10
@github-actions

Copy link
Copy Markdown

fatal: couldn't find remote ref fix/136-setup-ralphrc-permissions

opencode session  |  github run

@claude

claude Bot commented Jan 29, 2026

Copy link
Copy Markdown

Code Review - PR 137 (Follow-up)

I've reviewed the changes in this PR addressing issue 136. Previous reviews have already provided excellent coverage, so I'll focus on confirming the resolution and noting a few additional observations.

Summary

This PR successfully resolves the inconsistency between ralph-setup and ralph-enable by ensuring both commands create identical .ralphrc files with consistent tool permissions.

Changes Verified ✅

1. Core Implementation (setup.sh:50-92)

  • Properly reuses generate_ralphrc() from lib/enable_core.sh when available
  • Includes elegant sed post-processing to fix generator attribution (line 56)
  • Provides robust fallback implementation for standalone operation
  • Both paths produce identical .ralphrc content

2. Default Tool Permissions Updated

  • Old: Write,Bash(git *),Read
  • New: Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)
  • Updated consistently across:
    • ralph_loop.sh:46 (script default)
    • setup.sh:75 (fallback inline)
    • lib/enable_core.sh:689 (via generate_ralphrc)

3. Test Coverage

  • 8 new comprehensive tests in test_project_setup.bats (lines 497-545)
  • 4 additional tests in test_cli_modern.bats (lines 174-189)
  • Tests validate: file creation, Edit tool presence, test execution tools, exact match with ralph-enable, git commit integration, project name preservation
  • All 440 tests passing (100% pass rate maintained)

4. Documentation

  • CLAUDE.md: Version updated to v0.11.2, test count updated, changelog entry added
  • README.md: Comprehensive updates including badges, version references, configuration examples, project structure diagram

Observations

1. Intentional Design Pattern
The dual-path approach (library + fallback) is well-executed:

  • Primary path uses shared library for DRY principle
  • Fallback ensures setup.sh can operate independently
  • Both produce consistent output

2. Security Posture
The expanded default permissions are appropriate:

  • Edit tool enables efficient file modifications
  • Bash(npm *) and Bash(pytest) enable test execution as documented in PROMPT.md template
  • Pattern-based permissions maintain security (no unrestricted Bash access)
  • All tools are safe for development workflows

3. Maintenance Consideration
The ALLOWED_TOOLS default now exists in three locations:

  • ralph_loop.sh:46
  • setup.sh:75 (fallback)
  • lib/enable_core.sh:689

While all three were correctly updated in this PR, future changes require updating all three. This is documented but worth noting for future contributors.

Compliance with CLAUDE.md Standards ✅

  • Testing: 100% pass rate maintained (440/440 tests)
  • Git Workflow: Conventional commit format used
  • Documentation: CLAUDE.md and README.md comprehensively updated
  • Breaking Changes: None - fully backward compatible
  • Template Maintenance: .ralphrc generation aligned across all paths

Previous Review Comments

I've reviewed the existing comments from:

  • CodeRabbit (comprehensive automated review)
  • GitHub Actions (multiple automated reviews)
  • Macroscope (summary review)

All identified issues from previous reviews have been addressed in commit f20779a:

  • Version badge consistency fixed
  • Generator label corrected with sed solution
  • Documentation fully updated

Final Assessment

Status: APPROVED ✅

This is a well-executed fix that:

  1. Solves the root cause identified in issue 136
  2. Maintains backward compatibility
  3. Adds comprehensive test coverage
  4. Updates all documentation
  5. Follows repository conventions and quality standards

The implementation demonstrates good software engineering practices with proper error handling, fallback mechanisms, and thorough testing.

Recommendation: Ready to merge.


Review conducted following repository CLAUDE.md guidelines and conventions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ralph-setup creates no ralphrc causing different permissions

1 participant