Skip to content

Conversation

@alexx-ftw
Copy link

@alexx-ftw alexx-ftw commented Jan 22, 2026

Summary

This PR transitions Ralph into a proper universal CLI package that can be installed globally and run from any directory. It migrates the core logic from Bash ("ralph.sh") to a cross-platform Node.js implementation ("ralph.js") and introduces flexible command-line arguments for advanced workflows.

Key Changes:

  • Universal Packaging: Added root package.json with bin mapping. Supports npm install -g ..
  • Node-only Core: Replaced ralph.sh with a normalized ralph.js entrypoint, reducing dependencies (no longer requires jq or bash).
  • Arbitrary Tool Support: Added --tool <command> to allow any AI tool beyond amp and claude.
  • Flexible Arguments: Added --tool-args <arg> to pass flags directly to the underlying tool (e.g., --print for Claude Code).
  • Custom Prompts: Added --prompt-file <path> to specify alternative instruction templates.
  • Windows Reliability:
    • Fixed global entrypoint detection by normalizing node_modules paths.
    • Implemented case-insensitive path comparison for Windows environments.
  • Improved UX: Added getHelpText() triggered by -h, --help, or running without arguments.
  • Clean Architecture: Simplified archiving logic using process.cwd() as the default base directory.

Test Plan

  • Automated tests updated and passing: node ralph.test.js
  • Verified global installation: npm install -g .
  • Verified Windows compatibility (path normalization and case-sensitivity).
  • Verified help output: ralph --help.
  • Verified arbitrary tool spawning: ralph --tool echo --tool-args "hello world" 1.

alexx-ftw and others added 5 commits January 22, 2026 19:33
Add a root package.json with a ralph bin and make the CLI run from cwd.
Document local global install usage and clarify archiving behavior.
Ignore docs/plans to keep local plan drafts out of git status.
Add support for custom tool arguments and prompt file selection to Ralph CLI.
This enables using arbitrary tool commands beyond amp/claude and selecting
custom prompt templates.

Changes:
- Add `--tool-args <arg>` flag to pass extra arguments to the tool
- Add `--prompt-file <path>` flag to specify custom prompt file
- Remove tool validation in ralph.sh to allow custom commands
- Add resolveEntrypointPath helper for global install path normalization
- Add pathsAreEqual helper for cross-platform path comparison
- Fix isEntrypoint detection for windows global installs
- Update parseArgs to return toolArgs and promptFile
- Update runLoop to use toolArgs and resolvedPromptFile
- Add comprehensive tests for new CLI flags and path helpers

Co-Authored-By: Claude <noreply@anthropic.com>
Add a help message that is displayed when the CLI is invoked with no
arguments, or with -h/--help. This makes the tool more user-friendly
and follows standard CLI conventions.

Changes:
- Add `getHelpText()` helper in ralph.js
- Update ralph.js entrypoint to check for empty arguments or help flags
- Update ralph.sh to support -h/--help and empty arguments
- Add test case for getHelpText
- Update existing CLI tests to pass arguments and avoid help message

Co-Authored-By: Claude <noreply@anthropic.com>
Consolidate the CLI implementation into a single Node.js script. This
simplifies maintenance and ensures consistent behavior across platforms.
Updated documentation to reflect the removal of ralph.sh and the use of
ralph.js as the primary entrypoint.

Changes:
- Delete ralph.sh
- Update README.md with node execution instructions
- Update AGENTS.md with node and global CLI commands
- Remove jq and bash-specific requirements from prerequisites

Co-Authored-By: Claude <noreply@anthropic.com>
@alexx-ftw alexx-ftw marked this pull request as draft January 22, 2026 23:49
@alexx-ftw alexx-ftw changed the title Add global CLI packaging feat: universal CLI packaging with arbitrary tools and Windows support Jan 23, 2026
@alexx-ftw alexx-ftw marked this pull request as ready for review January 23, 2026 00:09
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.

1 participant