From fe94cbd02b46906184fcb78b584615740cd93d99 Mon Sep 17 00:00:00 2001 From: Test User Date: Mon, 2 Feb 2026 09:34:38 -0700 Subject: [PATCH] fix(import): add --print flag to prevent ralph-import hanging Without --print, Claude CLI starts an interactive session that hangs when stdin comes from a file/pipe. This caused ralph-import to hang indefinitely when converting PRDs. Changes: - Add --print flag for non-interactive (piped) input mode - Add --strict-mcp-config to skip loading user MCP servers (faster startup) Credit: @merlinrabens (PR #103) --- ralph_import.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ralph_import.sh b/ralph_import.sh index 91de224..e827af0 100755 --- a/ralph_import.sh +++ b/ralph_import.sh @@ -429,16 +429,18 @@ PROMPTEOF if [[ "$use_modern_cli" == "true" ]]; then # Modern CLI invocation with JSON output and controlled tool permissions - # --allowedTools permits file operations without user prompts - # Array expansion preserves quoting for each tool argument - if $CLAUDE_CODE_CMD --output-format "$CLAUDE_OUTPUT_FORMAT" --allowedTools "${CLAUDE_ALLOWED_TOOLS[@]}" < "$CONVERSION_PROMPT_FILE" > "$CONVERSION_OUTPUT_FILE" 2> "$stderr_file"; then + # --print: Required for piped input (prevents interactive session hang) + # --allowedTools: Permits file operations without user prompts + # --strict-mcp-config: Skip loading user MCP servers (faster startup) + if $CLAUDE_CODE_CMD --print --strict-mcp-config --output-format "$CLAUDE_OUTPUT_FORMAT" --allowedTools "${CLAUDE_ALLOWED_TOOLS[@]}" < "$CONVERSION_PROMPT_FILE" > "$CONVERSION_OUTPUT_FILE" 2> "$stderr_file"; then cli_exit_code=0 else cli_exit_code=$? fi else # Standard CLI invocation (backward compatible) - if $CLAUDE_CODE_CMD < "$CONVERSION_PROMPT_FILE" > "$CONVERSION_OUTPUT_FILE" 2> "$stderr_file"; then + # --print: Required for piped input (prevents interactive session hang) + if $CLAUDE_CODE_CMD --print < "$CONVERSION_PROMPT_FILE" > "$CONVERSION_OUTPUT_FILE" 2> "$stderr_file"; then cli_exit_code=0 else cli_exit_code=$?