ralph-codex 0.1.0 → 0.1.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/CHANGELOG.md CHANGED
@@ -2,5 +2,11 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.2] - 2026-01-22
6
+ - Improved README with setup, defaults, Docker guidance, and troubleshooting.
7
+
8
+ ## [0.1.1] - 2026-01-22
9
+ - Added shell completion command (bash/zsh/fish) with dynamic suggestions.
10
+
5
11
  ## [0.1.0] - 2026-01-21
6
12
  - Initial release.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # ralph-codex
2
2
 
3
+ ![ralph-codex](docs/ralph-codex.jpg)
4
+
3
5
  Codex-first Ralph-style planning and run loops.
4
6
 
5
7
  ## What it does
@@ -9,12 +11,34 @@ Codex-first Ralph-style planning and run loops.
9
11
  - Optional Docker mode for reproducible runs.
10
12
  - Colorized Codex output in TTY for easier scanning (disable with `NO_COLOR=1`).
11
13
 
14
+ ## How it works
15
+
16
+ - `plan` asks for success criteria, runs Codex, and writes `tasks.md`.
17
+ - `run` executes tasks until `LOOP_COMPLETE`, updating `.ralph/` state and logs.
18
+ - `revise` adds new tasks from feedback without touching existing items.
19
+ - `view` and `reset` help you inspect and reset task status.
20
+
21
+ ![Ralph Codex workflow](docs/ralph-codex-workflow.png)
22
+
12
23
  ## Requirements
13
24
 
14
25
  - Node.js >= 18
15
26
  - Codex CLI installed and authenticated (`codex` available in PATH)
16
27
  - Docker (optional, only for Docker mode)
17
28
 
29
+ ## Codex CLI setup
30
+
31
+ Install and verify:
32
+
33
+ ```bash
34
+ npm install -g @openai/codex
35
+ codex --help
36
+ ```
37
+
38
+ Authenticate using the Codex CLI and/or create a profile in `~/.codex/config.toml`.
39
+ Follow the auth guide at https://developers.openai.com/codex/auth.
40
+ If you use profiles, pass `--profile` or set `codex.profile` in `ralph.config.yml`.
41
+
18
42
  ## Install
19
43
 
20
44
  ```bash
@@ -34,6 +58,45 @@ ralph-codex view
34
58
  ralph-codex reset
35
59
  ```
36
60
 
61
+ ## Demo (sample output)
62
+
63
+ ```text
64
+ $ ralph-codex plan "Add screenshot flow"
65
+ ... (interactive prompts) ...
66
+ tasks.md written
67
+ $ ralph-codex run
68
+ ... (loop output) ...
69
+ LOOP_COMPLETE
70
+ ```
71
+
72
+ ## Cookbook
73
+
74
+ ### Basic flow
75
+
76
+ ```bash
77
+ ralph-codex init
78
+ ralph-codex plan "Add screenshot flow for /demo" --output tasks.md
79
+ ralph-codex run --max-iterations 10
80
+ ```
81
+
82
+ ### Docker flow
83
+
84
+ ```bash
85
+ ralph-codex docker
86
+ # Ensure docker.codex_install is set in ralph.config.yml
87
+ ralph-codex plan "Add screenshot flow for /demo"
88
+ ralph-codex run
89
+ ```
90
+
91
+ ### Low-touch automation (still interactive)
92
+
93
+ Use a prefilled config and pass flags to minimize prompts. This CLI still expects a TTY.
94
+
95
+ ```bash
96
+ ralph-codex plan "Add screenshot flow" --full-auto --reasoning low
97
+ ralph-codex run --full-auto --reasoning low
98
+ ```
99
+
37
100
  ## Command reference
38
101
 
39
102
  Use `--help` with any command to see its available options.
@@ -90,7 +153,7 @@ Useful options:
90
153
 
91
154
  ### revise
92
155
 
93
- Add new tasks from feedback without changing existing tasks (alias: `refine`).
156
+ Add new tasks from feedback without changing existing tasks.
94
157
 
95
158
  ```bash
96
159
  ralph-codex revise "<feedback>" [--tasks <path>] [--run]
@@ -172,6 +235,7 @@ run:
172
235
  max_iterations: 15
173
236
  max_iteration_seconds: null
174
237
  max_total_seconds: null
238
+ completion_promise: LOOP_COMPLETE
175
239
  ```
176
240
 
177
241
  Codex settings quick guide:
@@ -185,6 +249,20 @@ Enable `plan.auto_detect_success_criteria` to add detected checks based on repo
185
249
 
186
250
  CLI flags always override config values.
187
251
 
252
+ ## Defaults
253
+
254
+ Defaults are from the template `ralph.config.yml`.
255
+
256
+ | Setting | Default | Details |
257
+ | --- | --- | --- |
258
+ | `plan.tasks_path` | `tasks.md` | Output path for generated tasks. |
259
+ | `plan.auto_detect_success_criteria` | `false` | Detect and suggest checks from the repo. |
260
+ | `run.tasks_path` | `tasks.md` | Input path for tasks during runs. |
261
+ | `run.max_iterations` | `15` | Max loop iterations before stopping. |
262
+ | `run.completion_promise` | `LOOP_COMPLETE` | Completion token printed by the loop. |
263
+ | `docker.enabled` | `false` | Enable Docker execution. |
264
+ | `docker.use_for_plan` | `false` | Run planning inside Docker too. |
265
+
188
266
  ## Docker mode
189
267
 
190
268
  1. Run `ralph-codex docker` to pick a base image.
@@ -192,6 +270,20 @@ CLI flags always override config values.
192
270
  3. Run `ralph-codex plan` and `ralph-codex run` as usual. Enable `docker.use_for_plan`
193
271
  if you want planning to happen inside Docker as well.
194
272
 
273
+ Why Docker (especially with `danger-full-access`):
274
+ - Isolation: lets you grant broad permissions inside the container without exposing your host.
275
+ - Reproducibility: consistent OS/package stack across runs and teammates.
276
+ - Safer cleanup: delete the container/image to reset state.
277
+
278
+ Why `danger-full-access`:
279
+ - Fewer approval prompts for tooling that needs broad filesystem or network access.
280
+ - Works better for complex build/test flows that span many paths.
281
+ - Faster iterations when you trust the environment (best paired with Docker).
282
+
283
+ > **Warning**: Avoid `danger-full-access` on your host unless you fully trust the prompts,
284
+ > scripts, and dependencies. It grants broad access to your machine and can write
285
+ > outside the repo. Prefer Docker when you need this mode.
286
+
195
287
  `Dockerfile.ralph` is generated automatically when Docker is enabled.
196
288
 
197
289
  ## Files created
@@ -205,12 +297,24 @@ CLI flags always override config values.
205
297
  Codex output is colorized when stdout is a TTY. Plan uses spinners and run shows a task
206
298
  progress bar when interactive. Set `NO_COLOR=1` to disable color styling.
207
299
 
300
+ ## Exit codes
301
+
302
+ - `0` success.
303
+ - `1` invalid usage or runtime error.
304
+
208
305
  ## Troubleshooting
209
306
 
210
307
  - `codex: command not found` -> install Codex CLI and ensure it is in PATH.
308
+ - Auth errors (401/403) -> authenticate Codex CLI or select a valid profile.
309
+ - `Missing tasks.md` -> run `ralph-codex plan` first or pass `--tasks`.
211
310
  - Docker errors -> start Docker Desktop/Colima and retry.
212
- - Plan/run fail to read config -> verify `ralph.config.yml` path or pass `--config`.
311
+ - Config read errors -> verify `ralph.config.yml` path or pass `--config`.
312
+
313
+ ## Changelog and license
314
+
315
+ - Changelog: `CHANGELOG.md`
316
+ - License: `LICENSE` (MIT)
213
317
 
214
- ## License
318
+ ## Privacy
215
319
 
216
- MIT
320
+ ralph-codex does not add its own telemetry. It sends prompts and context to the Codex CLI you configure; follow your Codex policies and settings.
@@ -23,7 +23,8 @@ const showHelp = () => {
23
23
  ` ${colors.green("revise")} Add new tasks from feedback (alias: refine)\n` +
24
24
  ` ${colors.green("view")} Show tasks, criteria, and config summaries\n` +
25
25
  ` ${colors.green("reset")} Reset all tasks in tasks.md to [ ]\n` +
26
- ` ${colors.green("docker")} Pick a Docker base image via Codex and update config\n\n` +
26
+ ` ${colors.green("docker")} Pick a Docker base image via Codex and update config\n` +
27
+ ` ${colors.green("completion")} Print shell completion script (bash|zsh|fish)\n\n` +
27
28
  `${colors.yellow("Examples:")}\n` +
28
29
  ` ralph-codex init\n` +
29
30
  ` ralph-codex plan "Add screenshot flow"\n` +
@@ -31,6 +32,7 @@ const showHelp = () => {
31
32
  ` ralph-codex revise "Improve copy"\n` +
32
33
  ` ralph-codex view tasks --only pending\n` +
33
34
  ` ralph-codex reset\n\n` +
35
+ ` ralph-codex completion zsh\n\n` +
34
36
  `${colors.gray('Tip: run "ralph-codex <command> --help" for command options.')}\n\n`
35
37
  );
36
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ralph-codex",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Codex-first Ralph-style planning and run loops",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,832 @@
1
+ const argv = process.argv.slice(2);
2
+ let shell = null;
3
+ let showHelp = false;
4
+
5
+ for (const arg of argv) {
6
+ if (arg === "--help" || arg === "-h" || arg === "help") {
7
+ showHelp = true;
8
+ continue;
9
+ }
10
+ if (!shell && !arg.startsWith("-")) {
11
+ shell = arg;
12
+ }
13
+ }
14
+
15
+ function printHelp() {
16
+ process.stdout.write(
17
+ "Usage: ralph-codex completion <bash|zsh|fish>\n\n" +
18
+ "Examples:\n" +
19
+ " ralph-codex completion bash\n" +
20
+ " ralph-codex completion zsh\n" +
21
+ " ralph-codex completion fish\n",
22
+ );
23
+ }
24
+
25
+ if (showHelp || !shell) {
26
+ printHelp();
27
+ process.exit(showHelp ? 0 : 1);
28
+ }
29
+
30
+ function bashCompletion() {
31
+ return `# ralph-codex completions for bash
32
+ _ralph_codex_codex_home() {
33
+ if [[ -n "$CODEX_HOME" ]]; then
34
+ printf "%s" "$CODEX_HOME"
35
+ else
36
+ printf "%s" "$HOME/.codex"
37
+ fi
38
+ }
39
+
40
+ _ralph_codex_config_path() {
41
+ if [[ -n "$RALPH_CONFIG" ]]; then
42
+ printf "%s" "$RALPH_CONFIG"
43
+ elif [[ -n "$RALPH_CONFIG_PATH" ]]; then
44
+ printf "%s" "$RALPH_CONFIG_PATH"
45
+ elif [[ -n "$RALPH_CODEX_CONFIG" ]]; then
46
+ printf "%s" "$RALPH_CODEX_CONFIG"
47
+ else
48
+ printf "%s" "ralph.config.yml"
49
+ fi
50
+ }
51
+
52
+ _ralph_codex_yaml_values() {
53
+ local key="$1"
54
+ local config="$(_ralph_codex_config_path)"
55
+ if [[ -f "$config" ]]; then
56
+ sed -nE "s/^[[:space:]]*$key[[:space:]]*:[[:space:]]*([^#]+).*/\\\\1/p" "$config" \\
57
+ | sed -E "s/[\\\"']//g" \\
58
+ | awk 'NF{gsub(/[[:space:]]+$/, "", $0); print}'
59
+ fi
60
+ }
61
+
62
+ _ralph_codex_tasks_paths() {
63
+ _ralph_codex_yaml_values "tasks_path"
64
+ }
65
+
66
+ _ralph_codex_completion_promises() {
67
+ _ralph_codex_yaml_values "completion_promise"
68
+ }
69
+
70
+ _ralph_codex_profiles_raw() {
71
+ local config="$(_ralph_codex_codex_home)/config.toml"
72
+ if [[ -f "$config" ]]; then
73
+ sed -nE 's/^\\[profiles\\.("?[^"]+"?|[^]]+)\\].*$/\\1/p' "$config" | sed -E 's/^"//; s/"$//'
74
+ fi
75
+ }
76
+
77
+ _ralph_codex_models_raw() {
78
+ local cache="$(_ralph_codex_codex_home)/models_cache.json"
79
+ if [[ -f "$cache" ]]; then
80
+ grep -oE '"slug"[[:space:]]*:[[:space:]]*"[^"]+"' "$cache" | sed -E 's/.*"([^"]+)"/\\1/'
81
+ fi
82
+ }
83
+
84
+ _ralph_codex_unique_words() {
85
+ awk '!seen[$0]++'
86
+ }
87
+
88
+ _ralph_codex_join_words() {
89
+ tr '\\n' ' ' | sed 's/ */ /g'
90
+ }
91
+
92
+ _ralph_codex_model_list() {
93
+ local static="gpt-5.2-codex gpt-5.1-codex-mini gpt-5.1-codex-max gpt-5.2 gpt-5.1 gpt-5.1-codex gpt-5-codex gpt-5-codex-mini gpt-5"
94
+ local dynamic
95
+ dynamic="$(_ralph_codex_models_raw)"
96
+ if [[ -n "$dynamic" ]]; then
97
+ { printf "%s\\n" $dynamic; printf "%s\\n" $static; } | _ralph_codex_unique_words | _ralph_codex_join_words
98
+ else
99
+ printf "%s" "$static"
100
+ fi
101
+ }
102
+
103
+ _ralph_codex_profile_list() {
104
+ local dynamic
105
+ dynamic="$(_ralph_codex_profiles_raw)"
106
+ if [[ -n "$dynamic" ]]; then
107
+ printf "%s\\n" $dynamic | _ralph_codex_unique_words | _ralph_codex_join_words
108
+ fi
109
+ }
110
+
111
+ _ralph_codex_tasks_list() {
112
+ local dynamic
113
+ dynamic="$(_ralph_codex_tasks_paths)"
114
+ if [[ -n "$dynamic" ]]; then
115
+ { printf "%s\\n" tasks.md; printf "%s\\n" $dynamic; } | _ralph_codex_unique_words | _ralph_codex_join_words
116
+ else
117
+ printf "%s" "tasks.md"
118
+ fi
119
+ }
120
+
121
+ _ralph_codex_completion_promise_list() {
122
+ local dynamic
123
+ dynamic="$(_ralph_codex_completion_promises)"
124
+ if [[ -n "$dynamic" ]]; then
125
+ { printf "%s\\n" LOOP_COMPLETE; printf "%s\\n" $dynamic; } | _ralph_codex_unique_words | _ralph_codex_join_words
126
+ else
127
+ printf "%s" "LOOP_COMPLETE"
128
+ fi
129
+ }
130
+
131
+ _ralph_codex() {
132
+ local cur prev cmd
133
+ cur="\\${COMP_WORDS[COMP_CWORD]}"
134
+ prev="\\${COMP_WORDS[COMP_CWORD-1]}"
135
+ cmd="\\${COMP_WORDS[1]}"
136
+
137
+ local commands="init plan run revise refine view reset docker completion help"
138
+ local root_opts="--help -h --version -v"
139
+
140
+ if [[ $COMP_CWORD -eq 1 ]]; then
141
+ if [[ "$cur" == -* ]]; then
142
+ COMPREPLY=( $(compgen -W "$root_opts" -- "$cur") )
143
+ else
144
+ COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
145
+ fi
146
+ return 0
147
+ fi
148
+
149
+ case "$cmd" in
150
+ init)
151
+ case "$prev" in
152
+ --config)
153
+ local configs
154
+ configs="$(_ralph_codex_config_path)"
155
+ COMPREPLY=( $(compgen -W "$configs" -- "$cur") $(compgen -f -- "$cur") )
156
+ return 0
157
+ ;;
158
+ esac
159
+ local opts="--force --config --no-gitignore"
160
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
161
+ return 0
162
+ ;;
163
+ plan)
164
+ case "$prev" in
165
+ --config)
166
+ local configs
167
+ configs="$(_ralph_codex_config_path)"
168
+ COMPREPLY=( $(compgen -W "$configs" -- "$cur") $(compgen -f -- "$cur") )
169
+ return 0
170
+ ;;
171
+ --tasks|--output)
172
+ local tasks
173
+ tasks="$(_ralph_codex_tasks_list)"
174
+ COMPREPLY=( $(compgen -W "$tasks" -- "$cur") $(compgen -f -- "$cur") )
175
+ return 0
176
+ ;;
177
+ --sandbox)
178
+ COMPREPLY=( $(compgen -W "read-only workspace-write danger-full-access" -- "$cur") )
179
+ return 0
180
+ ;;
181
+ --ask-for-approval)
182
+ COMPREPLY=( $(compgen -W "untrusted on-failure on-request never" -- "$cur") )
183
+ return 0
184
+ ;;
185
+ --reasoning)
186
+ COMPREPLY=( $(compgen -W "low medium high xhigh" -- "$cur") )
187
+ return 0
188
+ ;;
189
+ --model|-m)
190
+ local models
191
+ models="$(_ralph_codex_model_list)"
192
+ COMPREPLY=( $(compgen -W "$models" -- "$cur") )
193
+ return 0
194
+ ;;
195
+ --profile|-p)
196
+ local profiles
197
+ profiles="$(_ralph_codex_profile_list)"
198
+ COMPREPLY=( $(compgen -W "$profiles" -- "$cur") )
199
+ return 0
200
+ ;;
201
+ esac
202
+ local opts="--output --tasks --max-iterations --config --model -m --profile -p --sandbox --no-sandbox --ask-for-approval --full-auto --reasoning --detect-success-criteria --no-detect-success-criteria --help -h"
203
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
204
+ return 0
205
+ ;;
206
+ run)
207
+ case "$prev" in
208
+ --config)
209
+ local configs
210
+ configs="$(_ralph_codex_config_path)"
211
+ COMPREPLY=( $(compgen -W "$configs" -- "$cur") $(compgen -f -- "$cur") )
212
+ return 0
213
+ ;;
214
+ --tasks|--input)
215
+ local tasks
216
+ tasks="$(_ralph_codex_tasks_list)"
217
+ COMPREPLY=( $(compgen -W "$tasks" -- "$cur") $(compgen -f -- "$cur") )
218
+ return 0
219
+ ;;
220
+ --sandbox)
221
+ COMPREPLY=( $(compgen -W "read-only workspace-write danger-full-access" -- "$cur") )
222
+ return 0
223
+ ;;
224
+ --ask-for-approval)
225
+ COMPREPLY=( $(compgen -W "untrusted on-failure on-request never" -- "$cur") )
226
+ return 0
227
+ ;;
228
+ --reasoning)
229
+ COMPREPLY=( $(compgen -W "low medium high xhigh" -- "$cur") )
230
+ return 0
231
+ ;;
232
+ --model|-m)
233
+ local models
234
+ models="$(_ralph_codex_model_list)"
235
+ COMPREPLY=( $(compgen -W "$models" -- "$cur") )
236
+ return 0
237
+ ;;
238
+ --profile|-p)
239
+ local profiles
240
+ profiles="$(_ralph_codex_profile_list)"
241
+ COMPREPLY=( $(compgen -W "$profiles" -- "$cur") )
242
+ return 0
243
+ ;;
244
+ --completion-promise)
245
+ local promises
246
+ promises="$(_ralph_codex_completion_promise_list)"
247
+ COMPREPLY=( $(compgen -W "$promises" -- "$cur") )
248
+ return 0
249
+ ;;
250
+ esac
251
+ local opts="--input --tasks --max-iterations --max-iteration-seconds --max-total-seconds --quiet -q --completion-promise --stop-on-error --no-log-stream --tail-log --tail-scratchpad --no-tail --config --model -m --profile -p --sandbox --no-sandbox --ask-for-approval --full-auto --reasoning --help -h"
252
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
253
+ return 0
254
+ ;;
255
+ revise|refine)
256
+ case "$prev" in
257
+ --config)
258
+ local configs
259
+ configs="$(_ralph_codex_config_path)"
260
+ COMPREPLY=( $(compgen -W "$configs" -- "$cur") $(compgen -f -- "$cur") )
261
+ return 0
262
+ ;;
263
+ --tasks)
264
+ local tasks
265
+ tasks="$(_ralph_codex_tasks_list)"
266
+ COMPREPLY=( $(compgen -W "$tasks" -- "$cur") $(compgen -f -- "$cur") )
267
+ return 0
268
+ ;;
269
+ --sandbox)
270
+ COMPREPLY=( $(compgen -W "read-only workspace-write danger-full-access" -- "$cur") )
271
+ return 0
272
+ ;;
273
+ --ask-for-approval)
274
+ COMPREPLY=( $(compgen -W "untrusted on-failure on-request never" -- "$cur") )
275
+ return 0
276
+ ;;
277
+ --reasoning)
278
+ COMPREPLY=( $(compgen -W "low medium high xhigh" -- "$cur") )
279
+ return 0
280
+ ;;
281
+ --model|-m)
282
+ local models
283
+ models="$(_ralph_codex_model_list)"
284
+ COMPREPLY=( $(compgen -W "$models" -- "$cur") )
285
+ return 0
286
+ ;;
287
+ --profile|-p)
288
+ local profiles
289
+ profiles="$(_ralph_codex_profile_list)"
290
+ COMPREPLY=( $(compgen -W "$profiles" -- "$cur") )
291
+ return 0
292
+ ;;
293
+ esac
294
+ local opts="--tasks --config --model -m --profile -p --sandbox --no-sandbox --ask-for-approval --full-auto --reasoning --run --help -h"
295
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
296
+ return 0
297
+ ;;
298
+ view)
299
+ case "$prev" in
300
+ --tasks)
301
+ local tasks
302
+ tasks="$(_ralph_codex_tasks_list)"
303
+ COMPREPLY=( $(compgen -W "$tasks" -- "$cur") $(compgen -f -- "$cur") )
304
+ return 0
305
+ ;;
306
+ --config)
307
+ local configs
308
+ configs="$(_ralph_codex_config_path)"
309
+ COMPREPLY=( $(compgen -W "$configs" -- "$cur") $(compgen -f -- "$cur") )
310
+ return 0
311
+ ;;
312
+ --format)
313
+ COMPREPLY=( $(compgen -W "table list json" -- "$cur") )
314
+ return 0
315
+ ;;
316
+ --only)
317
+ COMPREPLY=( $(compgen -W "pending blocked done" -- "$cur") )
318
+ return 0
319
+ ;;
320
+ esac
321
+ if [[ $COMP_CWORD -eq 2 && "$cur" != -* ]]; then
322
+ COMPREPLY=( $(compgen -W "tasks criteria config" -- "$cur") )
323
+ return 0
324
+ fi
325
+ local opts="--tasks --config --format --limit --only --watch -w --help -h"
326
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
327
+ return 0
328
+ ;;
329
+ reset)
330
+ case "$prev" in
331
+ --tasks)
332
+ local tasks
333
+ tasks="$(_ralph_codex_tasks_list)"
334
+ COMPREPLY=( $(compgen -W "$tasks" -- "$cur") $(compgen -f -- "$cur") )
335
+ return 0
336
+ ;;
337
+ --config)
338
+ local configs
339
+ configs="$(_ralph_codex_config_path)"
340
+ COMPREPLY=( $(compgen -W "$configs" -- "$cur") $(compgen -f -- "$cur") )
341
+ return 0
342
+ ;;
343
+ esac
344
+ local opts="--tasks --config --help -h"
345
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
346
+ return 0
347
+ ;;
348
+ docker)
349
+ case "$prev" in
350
+ --config)
351
+ local configs
352
+ configs="$(_ralph_codex_config_path)"
353
+ COMPREPLY=( $(compgen -W "$configs" -- "$cur") $(compgen -f -- "$cur") )
354
+ return 0
355
+ ;;
356
+ esac
357
+ local opts="--config"
358
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
359
+ return 0
360
+ ;;
361
+ completion)
362
+ if [[ "$prev" == "completion" ]]; then
363
+ if [[ "$cur" == -* ]]; then
364
+ COMPREPLY=( $(compgen -W "--help -h" -- "$cur") )
365
+ else
366
+ COMPREPLY=( $(compgen -W "bash zsh fish" -- "$cur") )
367
+ fi
368
+ return 0
369
+ fi
370
+ local opts="bash zsh fish --help -h"
371
+ COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
372
+ return 0
373
+ ;;
374
+ esac
375
+ }
376
+ complete -F _ralph_codex ralph-codex
377
+ `;
378
+ }
379
+
380
+ function zshCompletion() {
381
+ return `#compdef ralph-codex
382
+
383
+ _ralph_codex_codex_home() {
384
+ if [[ -n "$CODEX_HOME" ]]; then
385
+ print -r -- "$CODEX_HOME"
386
+ else
387
+ print -r -- "$HOME/.codex"
388
+ fi
389
+ }
390
+
391
+ _ralph_codex_config_path() {
392
+ if [[ -n "$RALPH_CONFIG" ]]; then
393
+ print -r -- "$RALPH_CONFIG"
394
+ elif [[ -n "$RALPH_CONFIG_PATH" ]]; then
395
+ print -r -- "$RALPH_CONFIG_PATH"
396
+ elif [[ -n "$RALPH_CODEX_CONFIG" ]]; then
397
+ print -r -- "$RALPH_CODEX_CONFIG"
398
+ else
399
+ print -r -- "ralph.config.yml"
400
+ fi
401
+ }
402
+
403
+ _ralph_codex_yaml_values() {
404
+ local key="$1"
405
+ local config="$(_ralph_codex_config_path)"
406
+ if [[ -f "$config" ]]; then
407
+ sed -nE "s/^[[:space:]]*$key[[:space:]]*:[[:space:]]*([^#]+).*/\\\\1/p" "$config" \\
408
+ | sed -E "s/[\\\"']//g" \\
409
+ | awk 'NF{gsub(/[[:space:]]+$/, "", $0); print}'
410
+ fi
411
+ }
412
+
413
+ _ralph_codex_models_raw() {
414
+ local cache="$(_ralph_codex_codex_home)/models_cache.json"
415
+ if [[ -f "$cache" ]]; then
416
+ grep -oE '"slug"[[:space:]]*:[[:space:]]*"[^"]+"' "$cache" | sed -E 's/.*"([^"]+)"/\\1/'
417
+ fi
418
+ }
419
+
420
+ _ralph_codex_profiles_raw() {
421
+ local config="$(_ralph_codex_codex_home)/config.toml"
422
+ if [[ -f "$config" ]]; then
423
+ sed -nE 's/^\\[profiles\\.("?[^"]+"?|[^]]+)\\].*$/\\1/p' "$config" | sed -E 's/^"//; s/"$//'
424
+ fi
425
+ }
426
+
427
+ _ralph_codex_models_list() {
428
+ local -a static dynamic combined
429
+ static=(gpt-5.2-codex gpt-5.1-codex-mini gpt-5.1-codex-max gpt-5.2 gpt-5.1 gpt-5.1-codex gpt-5-codex gpt-5-codex-mini gpt-5)
430
+ dynamic=(\${(f)"$(_ralph_codex_models_raw)"})
431
+ combined=($dynamic $static)
432
+ print -l -- \${(u)combined}
433
+ }
434
+
435
+ _ralph_codex_profiles_list() {
436
+ local -a dynamic
437
+ dynamic=(\${(f)"$(_ralph_codex_profiles_raw)"})
438
+ if (( \${#dynamic[@]} )); then
439
+ print -l -- \${(u)dynamic}
440
+ fi
441
+ }
442
+
443
+ _ralph_codex_tasks_list() {
444
+ local -a values
445
+ values=(tasks.md \${(f)"$(_ralph_codex_yaml_values tasks_path)"})
446
+ print -l -- \${(u)values}
447
+ }
448
+
449
+ _ralph_codex_completion_promises_list() {
450
+ local -a values
451
+ values=(LOOP_COMPLETE \${(f)"$(_ralph_codex_yaml_values completion_promise)"})
452
+ print -l -- \${(u)values}
453
+ }
454
+
455
+ _ralph_codex_models() {
456
+ local -a values
457
+ values=(\${(f)"$(_ralph_codex_models_list)"})
458
+ _values 'model' $values
459
+ }
460
+
461
+ _ralph_codex_profiles() {
462
+ local -a values
463
+ values=(\${(f)"$(_ralph_codex_profiles_list)"})
464
+ _values 'profile' $values
465
+ }
466
+
467
+ _ralph_codex_tasks() {
468
+ local -a values
469
+ values=(\${(f)"$(_ralph_codex_tasks_list)"})
470
+ _alternative \\
471
+ "values:tasks:_values 'tasks' $values" \\
472
+ "files:files:_files"
473
+ }
474
+
475
+ _ralph_codex_configs() {
476
+ local -a values
477
+ values=(\${(f)"$(_ralph_codex_config_path)"})
478
+ _alternative \\
479
+ "values:config:_values 'config' $values" \\
480
+ "files:files:_files"
481
+ }
482
+
483
+ _ralph_codex_completion_promises() {
484
+ local -a values
485
+ values=(\${(f)"$(_ralph_codex_completion_promises_list)"})
486
+ _values 'completion' $values
487
+ }
488
+
489
+ _ralph_codex() {
490
+ local -a commands
491
+ commands=(
492
+ 'init:Create ralph.config.yml and update .gitignore'
493
+ 'plan:Generate tasks.md with one round of questions'
494
+ 'run:Execute the loop until completion'
495
+ 'revise:Add new tasks from feedback'
496
+ 'refine:Alias for revise'
497
+ 'view:Show tasks, criteria, or config summaries'
498
+ 'reset:Reset all tasks to [ ]'
499
+ 'docker:Pick a Docker base image via Codex'
500
+ 'completion:Print shell completion script'
501
+ 'help:Show help'
502
+ )
503
+
504
+ local state
505
+ _arguments -C \\
506
+ '(-h --help)'{-h,--help}'[Show help]' \\
507
+ '(-v --version)'{-v,--version}'[Show version]' \\
508
+ '1:command:->command' \\
509
+ '*::arg:->args'
510
+
511
+ case $state in
512
+ command)
513
+ _describe 'command' commands
514
+ ;;
515
+ args)
516
+ case $words[2] in
517
+ init)
518
+ _arguments \\
519
+ '--force[Overwrite existing config]' \\
520
+ '--config[Path to ralph.config.yml]:file:_ralph_codex_configs' \\
521
+ '--no-gitignore[Do not update .gitignore]' \\
522
+ '*::args:'
523
+ ;;
524
+ plan)
525
+ _arguments \\
526
+ '--output[Write tasks to a custom file]:path:_ralph_codex_tasks' \\
527
+ '--tasks[Write tasks to a custom file]:path:_ralph_codex_tasks' \\
528
+ '--max-iterations[Max planning iterations]:number:' \\
529
+ '--config[Path to ralph.config.yml]:file:_ralph_codex_configs' \\
530
+ '(-m --model)'{-m,--model}'[Codex model]:model:_ralph_codex_models' \\
531
+ '(-p --profile)'{-p,--profile}'[Codex CLI profile]:profile:_ralph_codex_profiles' \\
532
+ '--sandbox[Sandbox mode]:mode:(read-only workspace-write danger-full-access)' \\
533
+ '--no-sandbox[Use danger-full-access]' \\
534
+ '--ask-for-approval[Approval policy]:mode:(untrusted on-failure on-request never)' \\
535
+ '--full-auto[workspace-write + on-request]' \\
536
+ '--reasoning[Reasoning effort]:effort:(low medium high xhigh)' \\
537
+ '--detect-success-criteria[Add auto-detected checks]' \\
538
+ '--no-detect-success-criteria[Disable auto-detect]' \\
539
+ '(-h --help)'{-h,--help}'[Show help]' \\
540
+ '*:idea:'
541
+ ;;
542
+ run)
543
+ _arguments \\
544
+ '--input[Read tasks from a custom file]:path:_ralph_codex_tasks' \\
545
+ '--tasks[Read tasks from a custom file]:path:_ralph_codex_tasks' \\
546
+ '--max-iterations[Max iterations]:number:' \\
547
+ '--max-iteration-seconds[Soft per-iteration limit]:number:' \\
548
+ '--max-total-seconds[Hard total limit]:number:' \\
549
+ '(-q --quiet)'{-q,--quiet}'[Reduce output]' \\
550
+ '--completion-promise[Completion token]:text:_ralph_codex_completion_promises' \\
551
+ '--stop-on-error[Stop on first error]' \\
552
+ '--no-log-stream[Disable log streaming]' \\
553
+ '--tail-log[Stream .ralph/loop-log.md]' \\
554
+ '--tail-scratchpad[Stream .ralph/summary.md]' \\
555
+ '--no-tail[Disable log + scratchpad streaming]' \\
556
+ '--config[Path to ralph.config.yml]:file:_ralph_codex_configs' \\
557
+ '(-m --model)'{-m,--model}'[Codex model]:model:_ralph_codex_models' \\
558
+ '(-p --profile)'{-p,--profile}'[Codex CLI profile]:profile:_ralph_codex_profiles' \\
559
+ '--sandbox[Sandbox mode]:mode:(read-only workspace-write danger-full-access)' \\
560
+ '--no-sandbox[Use danger-full-access]' \\
561
+ '--ask-for-approval[Approval policy]:mode:(untrusted on-failure on-request never)' \\
562
+ '--full-auto[workspace-write + on-request]' \\
563
+ '--reasoning[Reasoning effort]:effort:(low medium high xhigh)' \\
564
+ '(-h --help)'{-h,--help}'[Show help]' \\
565
+ '*::args:'
566
+ ;;
567
+ revise|refine)
568
+ _arguments \\
569
+ '--tasks[Tasks file to update]:path:_ralph_codex_tasks' \\
570
+ '--config[Path to ralph.config.yml]:file:_ralph_codex_configs' \\
571
+ '(-m --model)'{-m,--model}'[Codex model]:model:_ralph_codex_models' \\
572
+ '(-p --profile)'{-p,--profile}'[Codex CLI profile]:profile:_ralph_codex_profiles' \\
573
+ '--sandbox[Sandbox mode]:mode:(read-only workspace-write danger-full-access)' \\
574
+ '--no-sandbox[Use danger-full-access]' \\
575
+ '--ask-for-approval[Approval policy]:mode:(untrusted on-failure on-request never)' \\
576
+ '--full-auto[workspace-write + on-request]' \\
577
+ '--reasoning[Reasoning effort]:effort:(low medium high xhigh)' \\
578
+ '--run[Run after approving changes]' \\
579
+ '(-h --help)'{-h,--help}'[Show help]' \\
580
+ '*:feedback:'
581
+ ;;
582
+ view)
583
+ _arguments \\
584
+ '1::section:(tasks criteria config)' \\
585
+ '--tasks[Tasks file (default: tasks.md)]:path:_ralph_codex_tasks' \\
586
+ '--config[Config path]:file:_ralph_codex_configs' \\
587
+ '--format[Output format]:format:(table list json)' \\
588
+ '--limit[Limit task rows]:number:' \\
589
+ '--only[Task filter]:filter:(pending blocked done)' \\
590
+ '(-w --watch)'{-w,--watch}'[Watch for changes]' \\
591
+ '(-h --help)'{-h,--help}'[Show help]' \\
592
+ '*::args:'
593
+ ;;
594
+ reset)
595
+ _arguments \\
596
+ '--tasks[Tasks file to reset]:path:_ralph_codex_tasks' \\
597
+ '--config[Path to ralph.config.yml]:file:_ralph_codex_configs' \\
598
+ '(-h --help)'{-h,--help}'[Show help]' \\
599
+ '*::args:'
600
+ ;;
601
+ docker)
602
+ _arguments \\
603
+ '--config[Path to ralph.config.yml]:file:_ralph_codex_configs' \\
604
+ '*::args:'
605
+ ;;
606
+ completion)
607
+ _arguments \\
608
+ '1::shell:(bash zsh fish)' \\
609
+ '(-h --help)'{-h,--help}'[Show help]' \\
610
+ '*::args:'
611
+ ;;
612
+ help)
613
+ _arguments '*::args:'
614
+ ;;
615
+ esac
616
+ ;;
617
+ esac
618
+ }
619
+
620
+ compdef _ralph_codex ralph-codex
621
+ `;
622
+ }
623
+
624
+ function fishCompletion() {
625
+ return `# ralph-codex completions for fish
626
+ function __ralph_codex_home
627
+ if set -q CODEX_HOME
628
+ echo $CODEX_HOME
629
+ else
630
+ echo $HOME/.codex
631
+ end
632
+ end
633
+
634
+ function __ralph_codex_config_path
635
+ if set -q RALPH_CONFIG
636
+ echo $RALPH_CONFIG
637
+ else if set -q RALPH_CONFIG_PATH
638
+ echo $RALPH_CONFIG_PATH
639
+ else if set -q RALPH_CODEX_CONFIG
640
+ echo $RALPH_CODEX_CONFIG
641
+ else
642
+ echo ralph.config.yml
643
+ end
644
+ end
645
+
646
+ function __ralph_codex_yaml_values
647
+ set -l key $argv[1]
648
+ set -l config (__ralph_codex_config_path)
649
+ if test -f "$config"
650
+ command sed -nE "s/^[[:space:]]*$key[[:space:]]*:[[:space:]]*([^#]+).*/\\\\1/p" "$config" \\
651
+ | command sed -E "s/[\\\"']//g" \\
652
+ | command awk 'NF{gsub(/[[:space:]]+$/, ""); print}'
653
+ end
654
+ end
655
+
656
+ function __ralph_codex_profiles_raw
657
+ set -l config (__ralph_codex_home)/config.toml
658
+ if test -f "$config"
659
+ command sed -nE 's/^\\[profiles\\.("?[^"]+"?|[^]]+)\\].*$/\\1/p' "$config" | command sed -E 's/^"//; s/"$//'
660
+ end
661
+ end
662
+
663
+ function __ralph_codex_models_raw
664
+ set -l cache (__ralph_codex_home)/models_cache.json
665
+ if test -f "$cache"
666
+ command grep -oE '"slug"[[:space:]]*:[[:space:]]*"[^"]+"' "$cache" | command sed -E 's/.*"([^"]+)"/\\1/'
667
+ end
668
+ end
669
+
670
+ function __ralph_codex_models
671
+ set -l static gpt-5.2-codex gpt-5.1-codex-mini gpt-5.1-codex-max gpt-5.2 gpt-5.1 gpt-5.1-codex gpt-5-codex gpt-5-codex-mini gpt-5
672
+ set -l dynamic (__ralph_codex_models_raw)
673
+ set -l out
674
+ for v in $dynamic $static
675
+ if test -n "$v"
676
+ if not contains -- $v $out
677
+ set -a out $v
678
+ end
679
+ end
680
+ end
681
+ printf "%s\\n" $out
682
+ end
683
+
684
+ function __ralph_codex_profiles
685
+ set -l dynamic (__ralph_codex_profiles_raw)
686
+ set -l out
687
+ for v in $dynamic
688
+ if test -n "$v"
689
+ if not contains -- $v $out
690
+ set -a out $v
691
+ end
692
+ end
693
+ end
694
+ printf "%s\\n" $out
695
+ end
696
+
697
+ function __ralph_codex_tasks
698
+ set -l values tasks.md (__ralph_codex_yaml_values tasks_path)
699
+ set -l out
700
+ for v in $values
701
+ if test -n "$v"
702
+ if not contains -- $v $out
703
+ set -a out $v
704
+ end
705
+ end
706
+ end
707
+ printf "%s\\n" $out
708
+ __fish_complete_path
709
+ end
710
+
711
+ function __ralph_codex_configs
712
+ set -l values (__ralph_codex_config_path)
713
+ set -l out
714
+ for v in $values
715
+ if test -n "$v"
716
+ if not contains -- $v $out
717
+ set -a out $v
718
+ end
719
+ end
720
+ end
721
+ printf "%s\\n" $out
722
+ __fish_complete_path
723
+ end
724
+
725
+ function __ralph_codex_completion_promises
726
+ set -l values LOOP_COMPLETE (__ralph_codex_yaml_values completion_promise)
727
+ set -l out
728
+ for v in $values
729
+ if test -n "$v"
730
+ if not contains -- $v $out
731
+ set -a out $v
732
+ end
733
+ end
734
+ end
735
+ printf "%s\\n" $out
736
+ end
737
+
738
+ complete -c ralph-codex -n '__fish_use_subcommand' -f -a 'init plan run revise refine view reset docker completion help' -d 'Commands'
739
+ complete -c ralph-codex -n '__fish_use_subcommand' -s h -l help -d 'Show help'
740
+ complete -c ralph-codex -n '__fish_use_subcommand' -s v -l version -d 'Show version'
741
+
742
+ complete -c ralph-codex -n '__fish_seen_subcommand_from init' -l force -d 'Overwrite existing config'
743
+ complete -c ralph-codex -n '__fish_seen_subcommand_from init' -l config -r -a '(__ralph_codex_configs)' -d 'Path to ralph.config.yml'
744
+ complete -c ralph-codex -n '__fish_seen_subcommand_from init' -l no-gitignore -d 'Do not update .gitignore'
745
+
746
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l output -r -a '(__ralph_codex_tasks)' -d 'Write tasks to a custom file'
747
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l tasks -r -a '(__ralph_codex_tasks)' -d 'Write tasks to a custom file'
748
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l max-iterations -r -d 'Max planning iterations'
749
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l config -r -a '(__ralph_codex_configs)' -d 'Path to ralph.config.yml'
750
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -s m -l model -r -a '(__ralph_codex_models)' -d 'Codex model'
751
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -s p -l profile -r -a '(__ralph_codex_profiles)' -d 'Codex CLI profile'
752
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l sandbox -r -a 'read-only workspace-write danger-full-access' -d 'Sandbox mode'
753
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l no-sandbox -d 'Use danger-full-access'
754
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l ask-for-approval -r -a 'untrusted on-failure on-request never' -d 'Approval policy'
755
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l full-auto -d 'workspace-write + on-request'
756
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l reasoning -r -a 'low medium high xhigh' -d 'Reasoning effort'
757
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l detect-success-criteria -d 'Add auto-detected checks'
758
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -l no-detect-success-criteria -d 'Disable auto-detect'
759
+ complete -c ralph-codex -n '__fish_seen_subcommand_from plan' -s h -l help -d 'Show help'
760
+
761
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l input -r -a '(__ralph_codex_tasks)' -d 'Read tasks from a custom file'
762
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l tasks -r -a '(__ralph_codex_tasks)' -d 'Read tasks from a custom file'
763
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l max-iterations -r -d 'Max iterations'
764
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l max-iteration-seconds -r -d 'Soft per-iteration limit'
765
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l max-total-seconds -r -d 'Hard total limit'
766
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -s q -l quiet -d 'Reduce output'
767
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l completion-promise -r -a '(__ralph_codex_completion_promises)' -d 'Completion token'
768
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l stop-on-error -d 'Stop on first error'
769
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l no-log-stream -d 'Disable log streaming'
770
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l tail-log -d 'Stream .ralph/loop-log.md'
771
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l tail-scratchpad -d 'Stream .ralph/summary.md'
772
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l no-tail -d 'Disable log + scratchpad streaming'
773
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l config -r -a '(__ralph_codex_configs)' -d 'Path to ralph.config.yml'
774
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -s m -l model -r -a '(__ralph_codex_models)' -d 'Codex model'
775
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -s p -l profile -r -a '(__ralph_codex_profiles)' -d 'Codex CLI profile'
776
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l sandbox -r -a 'read-only workspace-write danger-full-access' -d 'Sandbox mode'
777
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l no-sandbox -d 'Use danger-full-access'
778
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l ask-for-approval -r -a 'untrusted on-failure on-request never' -d 'Approval policy'
779
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l full-auto -d 'workspace-write + on-request'
780
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -l reasoning -r -a 'low medium high xhigh' -d 'Reasoning effort'
781
+ complete -c ralph-codex -n '__fish_seen_subcommand_from run' -s h -l help -d 'Show help'
782
+
783
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -l tasks -r -a '(__ralph_codex_tasks)' -d 'Tasks file to update'
784
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -l config -r -a '(__ralph_codex_configs)' -d 'Path to ralph.config.yml'
785
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -s m -l model -r -a '(__ralph_codex_models)' -d 'Codex model'
786
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -s p -l profile -r -a '(__ralph_codex_profiles)' -d 'Codex CLI profile'
787
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -l sandbox -r -a 'read-only workspace-write danger-full-access' -d 'Sandbox mode'
788
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -l no-sandbox -d 'Use danger-full-access'
789
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -l ask-for-approval -r -a 'untrusted on-failure on-request never' -d 'Approval policy'
790
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -l full-auto -d 'workspace-write + on-request'
791
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -l reasoning -r -a 'low medium high xhigh' -d 'Reasoning effort'
792
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -l run -d 'Run after approving changes'
793
+ complete -c ralph-codex -n '__fish_seen_subcommand_from revise refine' -s h -l help -d 'Show help'
794
+
795
+ complete -c ralph-codex -n '__fish_seen_subcommand_from view; and __fish_is_nth_token 3' -f -a 'tasks criteria config' -d 'Section'
796
+ complete -c ralph-codex -n '__fish_seen_subcommand_from view' -l tasks -r -a '(__ralph_codex_tasks)' -d 'Tasks file'
797
+ complete -c ralph-codex -n '__fish_seen_subcommand_from view' -l config -r -a '(__ralph_codex_configs)' -d 'Config path'
798
+ complete -c ralph-codex -n '__fish_seen_subcommand_from view' -l format -r -a 'table list json' -d 'Output format'
799
+ complete -c ralph-codex -n '__fish_seen_subcommand_from view' -l limit -r -d 'Limit task rows'
800
+ complete -c ralph-codex -n '__fish_seen_subcommand_from view' -l only -r -a 'pending blocked done' -d 'Task filter'
801
+ complete -c ralph-codex -n '__fish_seen_subcommand_from view' -s w -l watch -d 'Watch for changes'
802
+ complete -c ralph-codex -n '__fish_seen_subcommand_from view' -s h -l help -d 'Show help'
803
+
804
+ complete -c ralph-codex -n '__fish_seen_subcommand_from reset' -l tasks -r -a '(__ralph_codex_tasks)' -d 'Tasks file to reset'
805
+ complete -c ralph-codex -n '__fish_seen_subcommand_from reset' -l config -r -a '(__ralph_codex_configs)' -d 'Path to ralph.config.yml'
806
+ complete -c ralph-codex -n '__fish_seen_subcommand_from reset' -s h -l help -d 'Show help'
807
+
808
+ complete -c ralph-codex -n '__fish_seen_subcommand_from docker' -l config -r -a '(__ralph_codex_configs)' -d 'Path to ralph.config.yml'
809
+
810
+ complete -c ralph-codex -n '__fish_seen_subcommand_from completion; and __fish_is_nth_token 3' -f -a 'bash zsh fish' -d 'Shell'
811
+ complete -c ralph-codex -n '__fish_seen_subcommand_from completion' -s h -l help -d 'Show help'
812
+ `;
813
+ }
814
+
815
+ let output = "";
816
+ switch (shell) {
817
+ case "bash":
818
+ output = bashCompletion();
819
+ break;
820
+ case "zsh":
821
+ output = zshCompletion();
822
+ break;
823
+ case "fish":
824
+ output = fishCompletion();
825
+ break;
826
+ default:
827
+ console.error(`Unknown shell: ${shell}`);
828
+ printHelp();
829
+ process.exit(1);
830
+ }
831
+
832
+ process.stdout.write(output);
@@ -122,12 +122,12 @@ function runCodex(prompt, codexConfig) {
122
122
 
123
123
  function buildPrompt(nodeVersion) {
124
124
  const nodeLine = nodeVersion ? `Node version: ${nodeVersion}` : "Node 20+";
125
- return `Encuentra la mejor imagen base de Docker para este proyecto.
126
- Considera que necesita ejecutar npm scripts, módulos nativos y evitar Alpine.
125
+ return `Find the best Docker base image for this project.
126
+ Consider that it needs to run npm scripts, native modules, and should avoid Alpine.
127
127
  ${nodeLine}
128
128
 
129
- Responde SOLO con una línea en este formato:
130
- BASE_IMAGE: <imagen>`;
129
+ Respond with a single line in this format:
130
+ BASE_IMAGE: <image>`;
131
131
  }
132
132
 
133
133
  async function main() {
@@ -675,6 +675,7 @@ Context scan (read-only):
675
675
  pyproject.toml, requirements.txt, go.mod, Cargo.toml, pom.xml, build.gradle, Makefile,
676
676
  .nvmrc, Dockerfile, etc. Only inspect files that exist.
677
677
  - Use this context to infer file locations, tooling, and sensible commands.
678
+ - You may use read-only commands like ls, rg, and cat to inspect files.
678
679
 
679
680
  Requirements:
680
681
  - If there are open questions, ask them first and do not write ${tasksPath}.
@@ -693,13 +694,18 @@ Requirements:
693
694
  - Tasks must be atomic, ordered, and verifiable. Include exact file paths,
694
695
  commands to run (if any), and expected outcomes. Avoid vague verbs like "handle" or "improve".
695
696
  - Keep scope minimal: avoid refactors unless required by the idea or to unblock tasks.
697
+ - Use this exact section order and headings in ${tasksPath}:
698
+ 1) # Tasks
699
+ 2) ## Assumptions (only if needed)
700
+ 3) ## Success criteria
701
+ 4) ## Required tools
696
702
  ${successCriteriaBlock}
697
703
  - Include a "Required tools" section using this exact format:
698
704
  - \`- apt: <comma-separated packages or none>\`
699
705
  - \`- npm: <comma-separated packages or none>\`
700
706
  - \`- pip: <comma-separated packages or none>\`
701
707
  - Do not edit any files other than ${tasksPath}.
702
- - Do not run commands, tests, or start dev servers during planning.
708
+ - Do not run write commands, tests, installs, or start dev servers during planning.
703
709
 
704
710
  When done, output exactly: LOOP_COMPLETE
705
711
  `;
@@ -356,6 +356,8 @@ ${result.output}
356
356
  Constraints:
357
357
  - Only edit ${dockerConfig.dockerfile}
358
358
  - Do not change other files
359
+ - Keep the existing base image unless the error requires changing it
360
+ - Do not add new dependencies unless required by the error
359
361
  - Do not ask questions
360
362
  - Output exactly: LOOP_COMPLETE
361
363
  `;