bmalph 2.7.3 → 2.7.5

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.
Files changed (41) hide show
  1. package/README.md +68 -30
  2. package/dist/commands/doctor-checks.js +5 -4
  3. package/dist/commands/doctor-checks.js.map +1 -1
  4. package/dist/commands/run.js +4 -0
  5. package/dist/commands/run.js.map +1 -1
  6. package/dist/commands/status.js +12 -3
  7. package/dist/commands/status.js.map +1 -1
  8. package/dist/installer.js +101 -48
  9. package/dist/installer.js.map +1 -1
  10. package/dist/platform/cursor-runtime-checks.js +81 -0
  11. package/dist/platform/cursor-runtime-checks.js.map +1 -0
  12. package/dist/platform/cursor.js +4 -3
  13. package/dist/platform/cursor.js.map +1 -1
  14. package/dist/platform/detect.js +28 -5
  15. package/dist/platform/detect.js.map +1 -1
  16. package/dist/platform/instructions-snippet.js +18 -0
  17. package/dist/platform/instructions-snippet.js.map +1 -1
  18. package/dist/platform/resolve.js +23 -5
  19. package/dist/platform/resolve.js.map +1 -1
  20. package/dist/run/ralph-process.js +84 -15
  21. package/dist/run/ralph-process.js.map +1 -1
  22. package/dist/transition/artifact-scan.js +15 -3
  23. package/dist/transition/artifact-scan.js.map +1 -1
  24. package/dist/transition/fix-plan.js +4 -4
  25. package/dist/transition/fix-plan.js.map +1 -1
  26. package/dist/transition/orchestration.js +45 -13
  27. package/dist/transition/orchestration.js.map +1 -1
  28. package/dist/transition/preflight.js +9 -1
  29. package/dist/transition/preflight.js.map +1 -1
  30. package/dist/transition/story-id.js +46 -0
  31. package/dist/transition/story-id.js.map +1 -0
  32. package/dist/transition/story-parsing.js +3 -4
  33. package/dist/transition/story-parsing.js.map +1 -1
  34. package/package.json +1 -1
  35. package/ralph/RALPH-REFERENCE.md +27 -3
  36. package/ralph/drivers/claude-code.sh +44 -2
  37. package/ralph/drivers/codex.sh +10 -1
  38. package/ralph/drivers/copilot.sh +5 -0
  39. package/ralph/drivers/cursor.sh +50 -29
  40. package/ralph/lib/response_analyzer.sh +440 -111
  41. package/ralph/ralph_loop.sh +73 -61
@@ -1,11 +1,7 @@
1
1
  #!/bin/bash
2
- # Cursor CLI driver for Ralph (EXPERIMENTAL)
3
- # Provides platform-specific CLI invocation logic for Cursor CLI.
4
- #
5
- # Known limitations:
6
- # - CLI is in beta — binary name and flags may change
7
- # - NDJSON stream format assumes {type: "text", content: "..."} events
8
- # - Session ID capture from output not yet validated
2
+ # Cursor CLI driver for Ralph
3
+ # Uses the documented cursor-agent contract for background execution and
4
+ # switches to stream-json only for live display paths.
9
5
 
10
6
  driver_name() {
11
7
  echo "cursor"
@@ -42,7 +38,6 @@ driver_check_available() {
42
38
  command -v "$cli_binary" &>/dev/null
43
39
  }
44
40
 
45
- # Cursor CLI tool names
46
41
  driver_valid_tools() {
47
42
  VALID_TOOL_PATTERNS=(
48
43
  "file_edit"
@@ -53,10 +48,6 @@ driver_valid_tools() {
53
48
  )
54
49
  }
55
50
 
56
- # Build Cursor CLI command
57
- # Context is prepended to the prompt (same pattern as Codex/Copilot drivers).
58
- # Uses --print for headless mode, --force for autonomous execution,
59
- # --output-format stream-json for NDJSON streaming.
60
51
  driver_build_command() {
61
52
  local prompt_file=$1
62
53
  local loop_context=$2
@@ -76,21 +67,12 @@ driver_build_command() {
76
67
  CLAUDE_CMD_ARGS+=("$cli_binary")
77
68
  fi
78
69
 
79
- # Headless mode
80
- CLAUDE_CMD_ARGS+=("--print")
70
+ CLAUDE_CMD_ARGS+=("-p" "--force" "--output-format" "json")
81
71
 
82
- # Autonomous execution
83
- CLAUDE_CMD_ARGS+=("--force")
84
-
85
- # NDJSON streaming output
86
- CLAUDE_CMD_ARGS+=("--output-format" "stream-json")
87
-
88
- # Session resume — gated on CLAUDE_USE_CONTINUE to respect --no-continue flag
89
72
  if [[ "$CLAUDE_USE_CONTINUE" == "true" && -n "$session_id" ]]; then
90
73
  CLAUDE_CMD_ARGS+=("--resume" "$session_id")
91
74
  fi
92
75
 
93
- # Build prompt with context prepended
94
76
  local prompt_content
95
77
  if driver_running_on_windows; then
96
78
  prompt_content=$(driver_build_windows_bootstrap_prompt "$loop_context" "$prompt_file")
@@ -107,12 +89,43 @@ $prompt_content"
107
89
  }
108
90
 
109
91
  driver_supports_sessions() {
110
- return 0 # true — Cursor supports --resume
92
+ return 0
93
+ }
94
+
95
+ driver_supports_live_output() {
96
+ return 0
97
+ }
98
+
99
+ driver_prepare_live_command() {
100
+ LIVE_CMD_ARGS=()
101
+ local skip_next=false
102
+
103
+ for arg in "${CLAUDE_CMD_ARGS[@]}"; do
104
+ if [[ "$skip_next" == "true" ]]; then
105
+ LIVE_CMD_ARGS+=("stream-json")
106
+ skip_next=false
107
+ elif [[ "$arg" == "--output-format" ]]; then
108
+ LIVE_CMD_ARGS+=("$arg")
109
+ skip_next=true
110
+ else
111
+ LIVE_CMD_ARGS+=("$arg")
112
+ fi
113
+ done
114
+
115
+ if [[ "$skip_next" == "true" ]]; then
116
+ return 1
117
+ fi
111
118
  }
112
119
 
113
- # Cursor CLI outputs NDJSON events
114
120
  driver_stream_filter() {
115
- echo 'select(.type == "text") | .content // empty'
121
+ echo '
122
+ if .type == "assistant" then
123
+ [(.message.content[]? | select(.type == "text") | .text)] | join("\n")
124
+ elif .type == "tool_call" then
125
+ "\n\n⚡ [" + (.tool_call.name // .name // "tool_call") + "]\n"
126
+ else
127
+ empty
128
+ end'
116
129
  }
117
130
 
118
131
  driver_running_on_windows() {
@@ -205,10 +218,18 @@ driver_localappdata_cli_binary() {
205
218
  local_app_data=$(cygpath -u "$local_app_data")
206
219
  fi
207
220
 
208
- local candidate="$local_app_data/cursor-agent/agent.cmd"
209
- if [[ -f "$candidate" ]]; then
210
- echo "$candidate"
211
- fi
221
+ local candidates=(
222
+ "$local_app_data/cursor-agent/cursor-agent.cmd"
223
+ "$local_app_data/cursor-agent/agent.cmd"
224
+ )
225
+
226
+ local candidate
227
+ for candidate in "${candidates[@]}"; do
228
+ if [[ -f "$candidate" ]]; then
229
+ echo "$candidate"
230
+ return 0
231
+ fi
232
+ done
212
233
  }
213
234
 
214
235
  driver_wrapper_path() {