@canivel/ralph 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,8 +10,8 @@ Ralph is a minimal, file-based agent loop for autonomous coding. Each iteration
10
10
 
11
11
  - **First-run agent selection** - Prompted to choose your default agent on first use
12
12
  - **`ralph config` command** - Reconfigure your default agent anytime
13
- - **Improved Claude support** - Direct spawning with proper TTY handling for PRD generation
14
- - **Better Windows compatibility** - Fixed shell quoting issues
13
+ - **Improved Claude support** - Uses stdin mode (`-p -`) for reliable prompt passing
14
+ - **Better Windows compatibility** - Fixed shell quoting and Python detection
15
15
  - **Global config storage** - Settings persist in `~/.ralph/config.json`
16
16
 
17
17
  ## How It Works
@@ -172,8 +172,8 @@ ralph config
172
172
  After running `ralph install`, you can customize behavior in `.agents/ralph/config.sh`:
173
173
 
174
174
  ```bash
175
- # Override agent command
176
- AGENT_CMD="claude -p --dangerously-skip-permissions \"\$(cat {prompt})\""
175
+ # Override agent command (Claude uses stdin mode by default)
176
+ # AGENT_CMD="claude --dangerously-skip-permissions -p -"
177
177
 
178
178
  # Build settings
179
179
  NO_COMMIT=false
@@ -230,9 +230,13 @@ AGENT_OPENCODE_CMD="opencode run --attach http://localhost:4096 \"\$(cat {prompt
230
230
 
231
231
  ### Custom Agent Commands
232
232
 
233
- Use `{prompt}` placeholder when the agent needs a file path instead of stdin:
233
+ Agents are passed prompts via stdin by default. Use `{prompt}` placeholder when the agent needs a file path instead:
234
234
 
235
235
  ```bash
236
+ # Stdin mode (default for claude, codex)
237
+ AGENT_CMD="my-agent -"
238
+
239
+ # File path mode (for agents that require a file)
236
240
  AGENT_CMD="my-agent --file {prompt}"
237
241
  ```
238
242
 
package/bin/ralph CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  const { spawnSync } = require("child_process");
3
3
  const fs = require("fs");
4
4
  const os = require("os");
@@ -140,14 +140,15 @@ async function promptForDefaultAgent(currentDefault) {
140
140
  }
141
141
 
142
142
  async function ensureFirstRunConfig() {
143
- // Skip if not interactive TTY
144
- if (!process.stdout.isTTY || !process.stdin.isTTY) return null;
145
-
143
+ // Always check config first - return configured agent if available
146
144
  const config = loadGlobalConfig();
147
145
  if (config.defaultAgent) {
148
146
  return config.defaultAgent;
149
147
  }
150
148
 
149
+ // Skip prompting if not interactive TTY
150
+ if (!process.stdout.isTTY || !process.stdin.isTTY) return null;
151
+
151
152
  // First run - prompt for agent selection
152
153
  const agent = await promptForDefaultAgent("claude");
153
154
  if (agent) {
@@ -752,7 +753,7 @@ async function main() {
752
753
  env.PRD_PATH = resolvedPrdPath;
753
754
  }
754
755
 
755
- const result = spawnSync(loopPath, loopArgs, {
756
+ const result = spawnSync("bash", [loopPath, ...loopArgs], {
756
757
  stdio: "inherit",
757
758
  env,
758
759
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canivel/ralph",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Minimal, file-based agent loop for autonomous coding. Fork with improved Claude support and first-run configuration.",
5
5
  "bin": {
6
6
  "ralph": "bin/ralph"