codex-ralph 0.3.0 → 0.3.2

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
@@ -8,13 +8,35 @@ Minimal Ralph Wiggum Loop runner that feeds a sprint requirement into Codex, one
8
8
  npx codex-ralph --sprint=path/to/Sprint_0001.md --max-iterations=1
9
9
  ```
10
10
 
11
+ ## Telegram progress notifications
12
+
13
+ If you set Telegram credentials, the loop will send progress messages:
14
+
15
+ ```
16
+ CODEX_RALPH_TG_KEY=123456:bot-token
17
+ CODEX_RALPH_TG_CHAT=123456789
18
+ ```
19
+
20
+ Provide these as environment variables (e.g., when invoking `npx`). Each session generates a UUID and includes it in progress messages.
21
+
22
+ Message format:
23
+
24
+ ```
25
+ 🧭 ~<session-uuid>~
26
+ 📌 <current requirement title>
27
+ 🎯 <current index> of <total requirements>
28
+ ```
29
+
11
30
  ## Sprint format (Markdown)
12
31
 
13
32
  Each requirement is a level-2 heading with a checkbox. The loop picks the first unchecked item.
14
33
 
15
34
  ```markdown
16
35
  ## [ ] Requirement description
36
+
17
37
  Description: Free-form task details.
38
+
39
+ Acceptance criteria: Free-form acceptance criteria.
18
40
  ```
19
41
 
20
42
  ## Behavior
@@ -11,6 +11,32 @@ ROOT_DIR="$(cd "$(dirname "$SCRIPT_PATH")/.." && pwd)"
11
11
  SPRINT_FILE=""
12
12
  MAX_ITERATIONS=0
13
13
  NOTES_FILE=""
14
+ SESSION_UUID=""
15
+
16
+ session_uuid() {
17
+ if [[ -n "${SESSION_UUID}" ]]; then
18
+ echo "${SESSION_UUID}"
19
+ return
20
+ fi
21
+ SESSION_UUID="$(python3 - <<PY
22
+ import uuid
23
+ print(uuid.uuid4())
24
+ PY
25
+ )"
26
+ echo "${SESSION_UUID}"
27
+ }
28
+
29
+ send_telegram() {
30
+ local message="$1"
31
+ if [[ -z "${CODEX_RALPH_TG_KEY:-}" || -z "${CODEX_RALPH_TG_CHAT:-}" ]]; then
32
+ return
33
+ fi
34
+ curl -sS -o /dev/null -X POST \
35
+ "https://api.telegram.org/bot${CODEX_RALPH_TG_KEY}/sendMessage" \
36
+ -d "chat_id=${CODEX_RALPH_TG_CHAT}" \
37
+ --data-urlencode "text=${message}" \
38
+ || true
39
+ }
14
40
 
15
41
  usage() {
16
42
  cat <<USAGE
@@ -23,6 +49,8 @@ Options:
23
49
  USAGE
24
50
  }
25
51
 
52
+ session_uuid >/dev/null
53
+
26
54
  for arg in "$@"; do
27
55
  case "$arg" in
28
56
  --sprint=*)
@@ -87,6 +115,33 @@ print(sum(1 for m in items if m.strip() != "x"))
87
115
  PY
88
116
  }
89
117
 
118
+ total_count() {
119
+ python3 - <<PY
120
+ from pathlib import Path
121
+ import re
122
+
123
+ path = Path("$SPRINT_FILE")
124
+ text = path.read_text(encoding="utf-8")
125
+ items = re.findall(r"^## \[( |x|X)\] ", text, flags=re.M)
126
+ print(len(items))
127
+ PY
128
+ }
129
+
130
+ current_index() {
131
+ python3 - <<PY
132
+ from pathlib import Path
133
+ import re
134
+
135
+ path = Path("$SPRINT_FILE")
136
+ text = path.read_text(encoding="utf-8")
137
+ items = re.findall(r"^## \[( |x|X)\] ", text, flags=re.M)
138
+ remaining = sum(1 for m in items if m.strip() != "x")
139
+ total = len(items)
140
+ current = total - remaining + 1 if remaining > 0 else total
141
+ print(current)
142
+ PY
143
+ }
144
+
90
145
  next_description() {
91
146
  python3 - <<PY
92
147
  from pathlib import Path
@@ -133,6 +188,8 @@ iteration=1
133
188
  while true; do
134
189
  remaining="$(remaining_count)"
135
190
  if [[ "$remaining" == "0" ]]; then
191
+ total="$(total_count)"
192
+ send_telegram "🧭 ~${SESSION_UUID}~"$'\n'"✅ All requirements completed"$'\n'"🎯 ${total} of ${total}"
136
193
  echo "All sprint requirements complete."
137
194
  echo "<promise>DONE</promise>"
138
195
  exit 0
@@ -144,6 +201,9 @@ while true; do
144
201
  fi
145
202
 
146
203
  desc="$(next_description)"
204
+ total="$(total_count)"
205
+ current="$(current_index)"
206
+ send_telegram "🧭 ~${SESSION_UUID}~"$'\n'"📌 ${desc}"$'\n'"🎯 ${current} of ${total}"
147
207
  echo "Iteration $iteration - next requirement: $desc"
148
208
 
149
209
  prompt_tmp="$(mktemp)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-ralph",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Ralph Loop sprint runner for Codex.",
5
5
  "bin": {
6
6
  "ralph-loop": "agent/ralph-loop.sh"