Commit graph

132 commits

Author SHA1 Message Date
Frank Bria
c7e7a1c6a3
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>
2026-01-26 15:40:27 -07:00
Frank Bria
05c57207f3
fix(wizard): redirect prompts to stderr for clean command substitution (#130)
When wizard prompt functions (prompt_text, prompt_number, select_option,
select_with_default) were used with command substitution, ANSI-colored
prompts were captured along with user responses, corrupting .ralphrc
values like: PROJECT_NAME="[0;36mProject name[0m [value]: value"

Fix:
- Redirect all display output (colored prompts, validation messages) to
  stderr using >&2, matching the pattern already used by select_multiple()
- Keep only the actual response/result on stdout for command substitution

Changes:
- lib/wizard_utils.sh: Add >&2 to prompt_text (lines 84-87),
  prompt_number (lines 118-121, 131-151), confirm (lines 44, 60),
  select_option (lines 190-215), select_with_default (lines 330-364)
- tests/unit/test_wizard_utils.bats: Add 20 new tests for stdout/stderr
  separation and clean command substitution results
- CLAUDE.md: Update test count to 420

Test count: 420 (up from 396)

Co-authored-by: Test User <test@example.com>
2026-01-26 14:47:06 -07:00
Frank Bria
910f794fcc
feat(enable): add ralph-enable wizard for existing projects (v0.11.0) (#124)
* feat(enable): add ralph-enable wizard for existing projects (v0.11.0)

Add interactive wizard and CI version for enabling Ralph in existing projects.

New commands:
- ralph-enable: Interactive 5-phase wizard for humans
- ralph-enable-ci: Non-interactive version with JSON output for CI/automation

New library components:
- lib/enable_core.sh: Shared logic for idempotency, project detection, templates
- lib/wizard_utils.sh: Interactive prompt utilities
- lib/task_sources.sh: Task import from beads, GitHub Issues, PRD documents

Features:
- Auto-detects project type (TypeScript, Python, Rust, Go)
- Auto-detects framework (Next.js, FastAPI, Django, Express)
- Imports tasks from beads, GitHub Issues, or PRD documents
- Generates .ralphrc project configuration file
- Idempotent: safe to run multiple times, respects existing files
- Exit codes: 0 (success), 1 (error), 2 (already enabled)

Updated:
- install.sh: Added new commands to global installation
- ralph_loop.sh: Loads .ralphrc configuration at startup

Tests: 75 new tests (30 enable_core + 23 task_sources + 22 integration)
Total: 396 tests passing (100% pass rate)

Closes #85, #121, #64, #87, #99

* fix(enable): address code review feedback

Fixes from PR #124 review:

1. sed -i portability (ralph_enable.sh:456)
   - Use portable sed + mv pattern instead of GNU-only sed -i

2. sed regex portability (lib/task_sources.sh)
   - Replace \s with POSIX [[:space:]] character class
   - Add sed -E flag for extended regex

3. jq availability check (ralph_enable_ci.sh:177)
   - Add check for jq when --json flag is used

4. Unused filter parameter (lib/task_sources.sh:44)
   - Pass filter to bd list --filter command

5. Word-splitting in select_multiple (ralph_enable.sh:322)
   - Return comma-separated indices instead of space-separated text
   - Update caller to parse indices correctly

6. Missing || true for check_existing_ralph (ralph_enable.sh:185)
   - Prevent set -e from exiting on non-zero return

7. select_multiple stdout corruption (lib/wizard_utils.sh)
   - Redirect interactive output to stderr
   - Only final result goes to stdout

8. Color variables not exported (lib/wizard_utils.sh:12)
   - Export WIZARD_* color variables for subshells

9. select_option infinite loop (lib/wizard_utils.sh:179)
   - Add guard for empty options array

* fix(tests): add missing mocks and exports for new enable feature

- Add RESPONSE_ANALYSIS_FILE export to test_session_continuity.bats setup
- Add mock ralph_enable.sh and ralph_enable_ci.sh to test_installation.bats
- Add mock lib files: enable_core.sh, wizard_utils.sh, task_sources.sh, timeout_utils.sh

All 396 tests now pass.

* fix(config): fix critical issues from PR review

1. .ralphrc Configuration Loading Fix:
   - Captured env var state BEFORE setting defaults with _env_* variables
   - load_ralphrc now only restores values explicitly set by environment
   - .ralphrc settings are now properly applied (not overwritten by defaults)

2. sed Command Injection Fix:
   - Replaced sed with awk for .ralphrc updates in ralph_enable.sh
   - awk -v pattern safely handles user input without shell injection risk

3. Shell Injection Fix in safe_create_file():
   - Replaced echo with printf '%s\n' for safer content handling
   - Prevents issues with backslashes, -n, and special characters

4. Specific Error Codes:
   - Added ENABLE_INVALID_ARGS=3 for argument errors
   - Added ENABLE_FILE_NOT_FOUND=4 for missing files
   - Added ENABLE_DEPENDENCY_MISSING=5 for missing deps (e.g., jq)
   - Added ENABLE_PERMISSION_DENIED=6 for permission errors
   - Updated ralph_enable.sh and ralph_enable_ci.sh to use specific codes

5. Added tests for .ralphrc loading pattern verification

Test count: 398 (up from 396)

* fix(enable): make --force flag actually overwrite existing files

The --force flag was accepted but safe_create_file() always skipped
existing files regardless of ENABLE_FORCE value.

Changes:
- safe_create_file() now checks ENABLE_FORCE environment variable
- When ENABLE_FORCE="true", overwrites existing files instead of skipping
- Added proper logging for overwrite operations

Added tests:
- Verify enable_ralph_in_directory actually changes file contents with --force
- Test safe_create_file overwrites when ENABLE_FORCE is true
- Test safe_create_file skips when ENABLE_FORCE is false

Test count: 400 (up from 398)

---------

Co-authored-by: Test User <test@example.com>
2026-01-25 14:37:25 -07:00
Test User
019b8c738a Merge main into fix/test-prd-import-version-handler
Resolved conflicts by keeping both:
- Updated comments mentioning .ralph/ subfolder (from main)
- Added --version handler to mock scripts (from PR #107)
2026-01-21 22:04:59 -07:00
Test User
f6791e431c chore(git): stop tracking .claude/settings.local.json
File was already in .gitignore but still being tracked.
Removed from index to respect gitignore entry.
2026-01-21 21:54:12 -07:00
Test User
d63f300c09 fix(session): clear exit signals on session reset (issue #91)
Root cause: Stale completion indicators in .exit_signals and .response_analysis
files persisted across sessions, causing premature exit when combined with
normal completion indicator increments.

Changes:
- Enhanced reset_session() to clear .exit_signals file (resets to empty structure)
- Enhanced reset_session() to remove .response_analysis file
- Session reset now comprehensively clears all exit-related state

Added 2 new tests:
- reset_session clears exit_signals file to prevent premature exit
- reset_session prevents issue #91 scenario (stale completion indicators)

Test count: 321 (up from 319)

Fixes #91
2026-01-21 21:53:08 -07:00
Test User
761db2f67d Merge main and apply code review fixes
Merged origin/main into PR branch and applied review feedback:

Review fixes:
- Guard against empty result_obj if jq fails (Macroscope)
- Prioritize result object's session_id over init message (CodeRabbit)
- Add regression test for arrays with session_id only in result element

Resolved conflicts:
- CLAUDE.md: Updated test count to 319

All 319 tests pass.
2026-01-21 21:42:29 -07:00
Test User
da1aed34c6 fix(analyzer,monitor): EXIT_SIGNAL detection and monitor paths (v0.10.1)
Fixes #113 - EXIT_SIGNAL not detected in JSON output format
Fixes #117 - ralph_monitor.sh uses wrong paths after v0.10.0 migration

Bug fixes:
- Parse EXIT_SIGNAL from .result field when Claude CLI returns JSON format
- Add safety circuit breaker: force exit after 5 consecutive completion indicators
- Fix checkbox parsing for indented markdown with POSIX [[:space:]]* pattern
- Update ralph_monitor.sh paths: status.json, logs/ralph.log, progress.json

Files changed:
- lib/response_analyzer.sh: Extract RALPH_STATUS from embedded .result text
- ralph_loop.sh: Safety circuit breaker + indented checkbox patterns
- ralph_monitor.sh: All paths updated for .ralph/ subfolder
- create_files.sh: Indented checkbox pattern consistency
- README.md: v0.10.1 changelog, version bump, test count update
- CLAUDE.md: Version bump to v0.10.1

All 310 tests pass.
2026-01-21 21:31:50 -07:00
zerone0x
5ce9bc81d7 fix(analyzer): handle Claude CLI JSON array output format
Claude Code CLI outputs a JSON array instead of a single object:
[{type: "system", ...}, {type: "assistant", ...}, {type: "result", ...}]

This caused parse_json_response to fail with "jq: invalid JSON text"
because it assumed the top-level JSON was an object.

Changes:
- Detect if JSON is an array before parsing
- Extract the "result" type message from the array
- Preserve session_id from init message for continuity
- Normalize to object format for existing parsing logic
- Clean up temporary file after processing

Fixes #112

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-21 22:56:53 +08:00
Frank Bria
9b19d70e35
feat(structure): migrate Ralph files to .ralph/ subfolder (#109)
* feat(structure): migrate Ralph files to .ralph/ subfolder

BREAKING CHANGE: Ralph configuration files now live in .ralph/ subfolder

This refactoring moves all Ralph-specific files into a hidden .ralph/
directory while keeping src/ at the project root. This improves
compatibility with existing tooling and keeps the project root clean.

Changes:
- Move PROMPT.md, @fix_plan.md, @AGENT.md to .ralph/
- Move specs/, logs/, docs/generated/, examples/ to .ralph/
- Move state files (.response_analysis, .circuit_breaker_state, etc.) to .ralph/
- Keep src/ at project root (unchanged)
- Add RALPH_DIR=".ralph" configuration variable
- Add ralph-migrate command for existing projects
- Create migrate_to_ralph_folder.sh migration script
- Update all path references in scripts and tests
- Update documentation (README.md, CLAUDE.md)

New project structure:
  project/
  ├── .ralph/           # Ralph configuration
  │   ├── PROMPT.md
  │   ├── @fix_plan.md
  │   ├── @AGENT.md
  │   ├── specs/
  │   ├── logs/
  │   └── docs/generated/
  └── src/              # Source code (unchanged)

Migration: Run `ralph-migrate` in existing projects to upgrade.

All 310 tests pass (100% pass rate).

* chore: add .claude/settings.local.json to .gitignore

* fix: address code review feedback for .ralph/ subfolder structure

Fixes multiple path-related issues identified in code review:

Test fixes:
- Fix create_sample_prompt to use $RALPH_DIR/PROMPT.md in test_session_continuity.bats
- Fix result_file path to use $RALPH_DIR/.json_parse_result in test_json_parsing.bats
- Fix @fix_plan.md and .response_analysis paths in test_cli_modern.bats
- Update templates directory missing test to account for global fallback

Template fix:
- Fix @fix_plan.md reference in templates/PROMPT.md to use .ralph/ prefix

Script fixes:
- Fix PROMPT_FILE comparison in ralph_loop.sh to use $RALPH_DIR/PROMPT.md
- Fix examples migration logic in migrate_to_ralph_folder.sh (remove premature mkdir)
- Move templates directory check AFTER cd in setup.sh (was checking wrong location)
- Add template directory validation with fallback to global templates

All 310 tests pass.

* Update migrate_to_ralph_folder.sh

Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>

* fix: address code review feedback for .ralph/ subfolder structure

Code Review Fixes:
- Fix test_json_parsing.bats: all result_file and session file paths now use $RALPH_DIR prefix
- Fix ralph_loop.sh help text: paths now show .ralph/.ralph_session, .ralph/.call_count, etc.
- Fix migrate_to_ralph_folder.sh:
  - Proper error handling for date command (separate local declaration)
  - Use cp -a source/. dest/ pattern to preserve dotfiles and attributes
  - Remove 2>/dev/null suppression to surface copy errors
- Update create_files.sh to use .ralph/ structure for embedded scripts
- Update .gitignore with all .ralph/ state file paths
- Add old structure detection in ralph_loop.sh with helpful migration message

Version Update:
- Bump to v0.10.0 (breaking change: structural reorganization)
- Update README.md and CLAUDE.md with new version and release notes
- Add ralph-migrate documentation to Key Commands section

All 310 tests pass.

---------

Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
2026-01-20 23:22:30 -07:00
Frank Bria
0e95f67318
Add timeout command support for macOS (#108)
* feat(timeout): add cross-platform timeout support for macOS

Add portable timeout wrapper that automatically detects and uses the
appropriate timeout command based on the platform:
- Linux: Uses standard GNU `timeout` from coreutils
- macOS: Uses `gtimeout` from Homebrew coreutils

Changes:
- Add lib/timeout_utils.sh with detect_timeout_command() and
  portable_timeout() functions
- Update ralph_loop.sh to source timeout_utils.sh and use
  portable_timeout for Claude Code execution
- Update install.sh to check for coreutils on macOS and provide
  installation instructions
- Update test mocks to include gtimeout and portable_timeout
- Update README.md with macOS coreutils installation instructions
- Update CLAUDE.md with timeout_utils.sh documentation

Users on macOS now need to install coreutils: brew install coreutils

* Update model reference in opencode-review workflow

* Update model name in opencode-review workflow

* Update model version in opencode-review workflow

* Update model version in opencode-review workflow

* Update lib/timeout_utils.sh

Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>

* Update opencode-review.yml

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
2026-01-20 18:40:21 -07:00
Marty
558b1518b5 fix(tests): add --version handler to mock claude commands in prd_import tests
Mock claude commands in test_prd_import.bats were hanging on test 240
because they started with 'cat > /dev/null' which blocks waiting for stdin.
When ralph_import.sh calls 'claude --version' during dependency check,
no stdin is provided, causing indefinite hang.

Changes:
- Added --version flag handler to all 7 mock claude command generators
- Handler returns "Claude Code CLI version 2.0.80" and exits before stdin read
- Fixes hang in test 240 and ensures all 33 prd_import tests pass

This fix allows the quickstart installation to complete successfully
without test stalls.

Fixes #N/A (discovered during quickstart installation)
2026-01-20 21:34:00 +00:00
Test User
509a9699a8 fix(workflow) Patch opencode bug in GitHub Actions timeout 2026-01-13 19:44:08 -07:00
Test User
dd694ece49 docs(readme): update for v0.9.9 with EXIT_SIGNAL gate and uninstall script
Major updates:
- Version bumped to v0.9.9
- Test count updated to 308 (from 276)
- Added v0.9.9 release notes: EXIT_SIGNAL gate fix, uninstall script, session expiration
- New "Uninstalling Ralph" section with dedicated uninstall.sh
- Updated "Intelligent Exit Detection" with dual-condition check explanation
- Added EXIT_SIGNAL decision table to Configuration section
- New troubleshooting entries: "Premature Exit" and "Session Expired"
- Updated test coverage breakdown (164 unit + 144 integration)
- Added "Clean Uninstall" to Features list
- Updated Command Reference with ./uninstall.sh
2026-01-12 22:11:19 -07:00
Frank Bria
aca3670cc7
fix(loop): respect Claude's EXIT_SIGNAL when checking completion indicators (#90)
* fix(loop): respect Claude's EXIT_SIGNAL when checking completion indicators

The should_exit_gracefully() function was exiting prematurely based solely
on completion_indicators heuristics, ignoring Claude's explicit EXIT_SIGNAL
in the RALPH_STATUS block. This caused premature exits during productive
iterations when Claude reported work in progress.

Changes:
- ralph_loop.sh: Added dual-condition check requiring BOTH completion
  indicators >= 2 AND exit_signal == true before exiting
- response_analyzer.sh: Added explicit_exit_signal_found flag to prevent
  natural language heuristics from overriding Claude's explicit intent
- Added 14 new tests (10 unit + 4 integration) covering EXIT_SIGNAL behavior

Decision matrix:
| indicators >= 2 | EXIT_SIGNAL | Result |
|-----------------|-------------|--------|
| true            | true        | Exit   |
| true            | false       | Continue |
| true            | missing     | Continue (defaults to false) |
| false           | true        | Continue (threshold not met) |

Fixes premature exit bug during productive development iterations.

* Update lib/response_analyzer.sh

Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>

* test(exit): add STATUS=COMPLETE vs EXIT_SIGNAL=false conflict test

docs(exit): update CLAUDE.md with EXIT_SIGNAL gate documentation

- Added test for STATUS=COMPLETE with EXIT_SIGNAL=false conflict
  (EXIT_SIGNAL takes precedence, allowing phase completion without loop exit)
- Updated "Intelligent Exit Detection" section with dual-condition explanation
- Added "Completion Indicators with EXIT_SIGNAL Gate" section with decision table
- Documented conflict resolution behavior and implementation details

---------

Co-authored-by: Test User <test@example.com>
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
2026-01-12 22:07:24 -07:00
Zander
3e8d3fdcde
feat: add dedicated uninstall.sh script (#45)
* feat: add dedicated uninstall.sh script

Add a standalone uninstall script that provides:
- Safety confirmation prompt before removal (skip with -y/--yes)
- Installation check to verify Ralph is installed
- Removal plan display showing exactly what will be removed
- Consistent styling matching install.sh (colors, logging)
- Help option (-h/--help) for usage information
- Preserves project directories created with ralph-setup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add function documentation to uninstall.sh

Address CodeRabbit review comments:
- Add documentation comments to all functions (log, check_installation,
  show_removal_plan, confirm_uninstall, remove_commands, remove_ralph_home, main)
- Improve check_installation to detect partial installations by checking
  all Ralph commands, not just the main ralph command

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: use safe arithmetic to avoid set -e failure

Replace ((removed++)) with removed=$((removed + 1)) to prevent
script termination when removed is 0, as post-increment returns
exit code 1 when the expression value is 0 under set -e.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:46:57 -07:00
Frank Bria
3dc3479c27
feat(session): implement session expiration with configurable timeout (#84)
* Reapply "feat(session): implement session expiration with configurable timeout (#83)"

This reverts commit 1ba55a4b9c.

* fix(session): address code review feedback

- Fix integer overflow: return -1 from get_session_file_age_hours on stat
  failure instead of 0, preventing false expiration
- Handle stat failure in init_claude_session with WARN log
- Add comprehensive documentation for return values and expiration strategy
- Add 6 behavioral integration tests that verify actual functionality
- Add inline comments explaining 24-hour default rationale

Test count: 286 → 292 (100% pass rate)

* fix(test): use grep-based verification to fix CI failures

Tests that sourced ralph_loop.sh with --help flag failed in GitHub
Actions due to BATS environment differences. Changed behavioral tests
to grep-based code verification that checks implementation patterns
exist without executing the script.

* fix(test): guard main with BASH_SOURCE for safe sourcing

- Add BASH_SOURCE check to only execute main when script is run directly
- Update tests to source script without --help flag
- Convert grep-based verification tests back to functional tests
- Fixes CI failures caused by script execution during sourcing

---------

Co-authored-by: Test User <test@example.com>
2026-01-10 19:40:38 -07:00
Test User
1ba55a4b9c Revert "feat(session): implement session expiration with configurable timeout (#83)"
This reverts commit 9110e3d3ad.
2026-01-10 19:11:15 -07:00
Frank Bria
9110e3d3ad
feat(session): implement session expiration with configurable timeout (#83)
- Add CLAUDE_SESSION_EXPIRY_HOURS configuration variable (default: 24)
- Add get_session_file_age_hours() helper with cross-platform stat support
- Modify init_claude_session() to check session age and remove expired sessions
- Add --session-expiry CLI flag to configure expiration (positive integers only)
- Update help text with new option and example
- Add 10 new tests for session expiration (TDD approach)

Closes #51

Test count: 276 → 286 (100% pass rate)

Co-authored-by: Test User <test@example.com>
2026-01-10 19:10:29 -07:00
Test User
81fac49933 docs(status): mark #27 badges complete 2026-01-10 18:47:34 -07:00
Test User
369e118a27 docs(readme): add CI and license badges
- Add GitHub Actions CI badge (dynamic, links to workflow)
- Add MIT License badge (links to LICENSE file)
- Add GitHub Issues badge (dynamic count)
- Keep Awesome Claude Code and X follow badges
- Remove redundant status badge, keep version and tests
2026-01-10 18:47:02 -07:00
Test User
253c8888aa docs(status): mark #24 and #26 complete 2026-01-10 18:44:49 -07:00
Test User
0ff60124fd docs(readme): add link to TESTING.md guide 2026-01-10 18:44:23 -07:00
Test User
94cb7493db docs(status): mark CONTRIBUTING.md guide complete 2026-01-10 18:22:37 -07:00
Test User
d0cb80f670 docs: add comprehensive contributor guide
- Create CONTRIBUTING.md with 8 sections covering the full contributor
  journey: Getting Started, Development Workflow, Code Style, Testing,
  PR Process, Code Review, Quality Standards, and Community Guidelines
- Include workflow diagram, quality gates table, and test commands reference
- Update README.md to reference CONTRIBUTING.md, consolidating duplicate
  contributor information into the dedicated guide
2026-01-10 17:03:12 -07:00
Test User
4679b16448 docs: add comprehensive testing guide
Add TESTING.md with complete documentation for the Ralph test suite:
- Quick start commands for running tests
- Test organization and directory structure
- BATS syntax guide with examples from the codebase
- Test helper API documentation (assertions, mocks, fixtures)
- Coverage requirements and kcov limitations
- CI/CD integration with GitHub Actions pipeline
- Troubleshooting guide for common issues
- Appendices with quick reference and patterns

Covers all 276 tests across 11 test files.
2026-01-10 16:58:29 -07:00
Test User
e28d20b856 docs: remove community issues from phase structure
Reverted changes to issues not created by frankbria:
- #44, #54, #64, #65 removed from phase assignments
- Restored original issue titles on GitHub
- Removed phase labels from community issues
- Updated open issue counts (40 → 36)
2026-01-10 15:09:17 -07:00
Test User
bada82e4e2 docs(status): update IMPLEMENTATION_STATUS.md with phased structure
- Update test counts (75 -> 276) and all test file details
- Convert from Week-based to Phase-based structure (Phases 1-6)
- Add all GitHub issues organized by phase and priority
- Update version history with v0.9.0-v0.9.8 changes
- Add summary statistics and open issues by priority
- Collapse closed issues into expandable section
2026-01-10 15:02:08 -07:00
Test User
8123e8f249 docs(plan): restructure IMPLEMENTATION_PLAN.md with phased development
- Reorganize document: Current Phase -> Planned -> Completed (at bottom)
- Integrate all GitHub issues into phased structure (Phases 1-6)
- Add Phase 5 (GitHub Issue Integration) issues #69-73
- Add Phase 6 (Sandbox Environments) issues #49, #74-80
- Minimize completed work in collapsible section
- Add priority legend and implementation order
- Update test coverage summary
- Close #63 (fix IMPLEMENTATION_PLAN)
2026-01-10 14:55:09 -07:00
Test User
d0208c4f6a docs(readme): update for v0.9.3-v0.9.8 changes
- Add version history entries for v0.9.3 through v0.9.8
- Add Session Continuity feature to features list
- Add new Session Continuity configuration section
- Add --reset-session flag to command reference
- Add new test file references (session, import, setup, installation)
2026-01-10 13:30:08 -07:00
Frank Bria
1c72010a93
Merge pull request #67 from frankbria/feature/import-modern-cli
feat(import): modernize ralph_import.sh with JSON output parsing
2026-01-10 13:19:51 -07:00
Test User
852088101d docs(import): add function docblocks and fix path handling bug
- Add detailed docblocks for detect_response_format, parse_conversion_response,
  and check_claude_version functions
- Declare global PARSED_* variables near top of script with documentation
- Fix bug where convert_prd was called with subdirectory path after cd
  (now uses basename since file is copied to project root)

All 276 tests pass.
2026-01-10 12:22:04 -07:00
Test User
1c9059b902 fix(import): address additional code review feedback
- Convert CLAUDE_ALLOWED_TOOLS to bash array for proper quoting
- Use array expansion "${CLAUDE_ALLOWED_TOOLS[@]}" in CLI invocation
- Default empty version components to 0 (handles "2.1" style versions)
- Add stderr_file cleanup in JSON error path
- Add type validation for PARSED_FILES_CREATED before array iteration
- Check for empty file names in JSON array iteration
- Fix stale test counts in README.md (165 → 276, 8 → 11 test files)
2026-01-10 11:38:43 -07:00
macroscopeapp[bot]
bcc3db9474
Append PRD source content to conversion prompt in convert_prd function (#68)
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
2026-01-10 18:35:33 +00:00
Test User
6dde9cbd26 fix(import): address code review feedback
- Fix check_claude_version() to use numeric semantic version comparison
- Fix detect_response_format() to read first non-whitespace character
- Wire PARSED_RESULT into success message output
- Wire PARSED_FILES_CREATED into file verification logic
- Add --allowedTools flag to CLI invocation using CLAUDE_ALLOWED_TOOLS
- Separate stderr to avoid corrupting JSON output file
- Clean up stderr file on completion and error
- Update README.md version badges to v0.9.8 and 276 tests
- Update roadmap section with current test coverage breakdown
2026-01-10 11:24:30 -07:00
Test User
4b1ca9bcc7 feat(import): modernize ralph_import.sh with JSON output parsing
- Add --output-format json flag for structured Claude CLI responses
- Implement detect_response_format() for JSON vs text detection
- Implement parse_conversion_response() for extracting JSON fields
- Add check_claude_version() for modern CLI feature detection
- Enhance error handling with structured JSON error messages
- Improve file verification with JSON-derived status information
- Maintain backward compatibility with automatic text fallback
- Add 11 new TDD tests for modern CLI features (tests 23-33)
- Update README.md with Modern CLI Features section
- Update CLAUDE.md with v0.9.8 release notes

Test count: 276 (up from 265)
2026-01-10 11:12:13 -07:00
Frank Bria
6ace046ef8
Merge pull request #66 from frankbria/feature/session-continuity
feat(session): add session lifecycle management with auto-reset triggers
2026-01-10 10:54:11 -07:00
Test User
cafaacdc0c fix(session): address code review feedback for session management
- Fix SC2155: separate declare from assign in get_session_id(),
  log_session_transition(), init_session_tracking()
- Use jq for safe JSON generation in reset_session() and init_session_tracking()
  instead of heredocs (prevents special character issues)
- Add corruption tolerance to log_session_transition() with JSON validation
  and fallback to empty array on parse failures
- Add generate_session_id() to create unique session IDs (ralph-<epoch>-<random>)
- Add update_session_last_used() helper called on each loop iteration
- init_session_tracking() now generates unique session_id and sets last_used
- Add session files to .gitignore (.ralph_session, .ralph_session_history,
  .claude_session_id)

All 265 tests pass.
2026-01-10 10:48:19 -07:00
Test User
274f496f77 fix(session): address code review feedback
- Add init_session_tracking() call in main() before loop starts
- Use literal escape codes for color in --reset-session output
- Remove conditional in reset_session() to always create file
- Remove unused old_session_id variable
- Remove duplicate SESSION_EXPIRATION_SECONDS (keep in response_analyzer.sh)
- Add clarifying comments for RALPH_SESSION_FILE vs CLAUDE_SESSION_FILE

All 265 tests pass.
2026-01-10 10:37:06 -07:00
Test User
d3310d1f3f feat(session): add session lifecycle management with auto-reset triggers
- Add session management functions: get_session_id(), reset_session(),
  log_session_transition(), init_session_tracking()
- Session auto-reset on: circuit breaker open, manual interrupt,
  project completion, manual circuit reset
- Add --reset-session CLI flag for manual session reset
- Add session history tracking (.ralph_session_history, last 50 entries)
- New config: RALPH_SESSION_FILE, RALPH_SESSION_HISTORY_FILE
- Add 26 comprehensive tests for session continuity (TDD)
- All 265 tests pass (up from 239)
- Update CLAUDE.md with v0.9.7 release notes
2026-01-10 10:27:42 -07:00
Frank Bria
3a474b4317
Merge pull request #62 from frankbria/feature/json-output-parsing
feat(analyzer): add Claude CLI JSON format support and session management
2026-01-09 18:03:03 -07:00
Test User
a2e7e9385c fix(analyzer): address code review feedback
- Fix BSD date parsing to handle milliseconds in ISO timestamps
  (e.g., 2026-01-09T10:30:00.123+00:00)
- Document error_count mapping behavior when only has_errors=true is present
- Remove unused has_session_id_field variable
- Add debug logging for session persistence (controlled by VERBOSE_PROGRESS)
- Standardize session filename to .claude_session_id across all files

All 239 tests passing.
2026-01-09 17:59:08 -07:00
Test User
fdff095c18 feat(analyzer): add Claude CLI JSON format support and session management
- Extend parse_json_response() to support both flat and Claude CLI formats
  - Extract result, sessionId, and metadata fields
  - Support metadata.files_changed, metadata.has_errors, completion_status
  - Parse progress_indicators array for confidence boosting
- Add session management functions for continuity tracking:
  - store_session_id(): Persist session with ISO timestamp
  - get_last_session_id(): Retrieve stored session ID
  - should_resume_session(): Check session validity (24-hour expiration)
- Add get_epoch_seconds() to date_utils.sh for cross-platform epoch time
- Auto-persist sessionId to .session_id file during response analysis
- Add 16 new TDD tests for Claude CLI format and session management
- Update documentation for v0.9.6 (239 tests total)

Test count: 239 (up from 223)
2026-01-09 17:46:02 -07:00
Frank Bria
3d91d92691
Merge pull request #61 from frankbria/feature/prd-import-tests
test(import): add 22 comprehensive tests for ralph_import.sh
2026-01-09 16:34:03 -07:00
Test User
b06d979b0b test(import): add 22 comprehensive tests for ralph_import.sh
Add integration tests for PRD to Ralph format conversion:
- File format support tests (.md, .txt, .json)
- Output file creation tests (PROMPT.md, @fix_plan.md, specs/requirements.md)
- Project naming tests (custom names, auto-detection from filename)
- Error handling tests (missing files, dependencies, conversion failures)
- Help and usage tests
- Full workflow integration tests
- Edge case handling (hyphens, uppercase, subdirectory paths)

Test infrastructure:
- Mock ralph-setup command using PATH manipulation
- Mock Claude Code CLI for isolated conversion testing
- Added create_sample_prd_txt() fixture helper

Test count: 223 (up from 201)
2026-01-09 16:13:23 -07:00
Frank Bria
27df19716e
Merge pull request #60 from frankbria/feature/project-setup-tests
test(setup): add 36 comprehensive tests for setup.sh
2026-01-09 16:04:29 -07:00
Test User
a6587aa189 fix(test): improve test reliability and remove tautologies
- Remove unused 'load mocks' (mocks.bash not needed)
- Use GIT_AUTHOR_*/GIT_COMMITTER_* env vars instead of git config --global
- Prefix git commands with 'command' to bypass shell function overrides
- Fix tautological assertions in edge case tests:
  - Rename test to "succeeds when run in existing directory (idempotent)"
  - Assert success ($status -eq 0) instead of always-true condition
2026-01-09 15:47:41 -07:00
Test User
c68e484f7d test(setup): add 36 comprehensive tests for setup.sh
Add integration tests validating project initialization:
- Directory creation (project dir, subdirectories)
- Template copying (PROMPT.md, @fix_plan.md, @AGENT.md, specs)
- Git initialization (repo, commit, message)
- README creation and content
- Custom/default project names
- Working directory behavior
- Error handling (missing templates)
- Output message validation

Test count: 201 (up from 165)
2026-01-09 15:01:53 -07:00
Frank Bria
4a83b879c2
Merge pull request #59 from frankbria/feature/installation-tests
test(install): add comprehensive installation tests
2026-01-09 14:31:45 -07:00
frankbria
3503b9b27b fix: address code review feedback
README.md:
- Update version badge to v0.9.3
- Update test count to 165 in all locations
- Update test coverage breakdown (111 unit + 54 integration)

test_installation.bats:
- Add missing mock setup.sh in setup() function
- Fix dependency test to mock all three deps (jq, git, node/npx)
- Remove unused source_install_functions helper function
2026-01-09 14:20:58 -07:00