You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(repl): --backend flag to force a specific input backend
Lets you exercise the readline (or plain) code path without
uninstalling the prompt_toolkit extra:
robotcode repl --backend=readline
Values: auto (default cascade), prompt-toolkit, readline, plain.
Also available as `ROBOTCODE_REPL_BACKEND`.
When the requested backend isn't importable on the current Python,
startup aborts with a clear error and a `pip install` hint — there
is no silent fallback, so the explicit choice is always honoured
(or visibly refused).
`--plain` stays as a shorthand for `--backend=plain`; combining it
with a non-`plain` `--backend` value is rejected as a usage error.
Copy file name to clipboardExpand all lines: docs/03_reference/repl.md
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,9 +83,22 @@ Log To Console answer is ${x}
83
83
84
84
The prompt is a real line editor — arrow-keys for cursor movement, `Ctrl-R` for reverse history search, Tab for Robot-aware completion. On Unix and on Windows with Python 3.13+ this is wired up out of the box via Python's stdlib `readline`; on older Windows Pythons you only get plain `input()` unless you install `pyreadline3`.
85
85
86
-
### Disabling all enhancements (AI agents, automation)
86
+
### Picking a specific input backend
87
87
88
-
Pass `--plain` (or set `ROBOTCODE_REPL_PLAIN=1`) to bypass every layer above and fall back to a bare `input()` prompt. That means no history, no completion, no candidate popup, no auto-suggest, no syntax highlighting — just a plain line read. Use this for AI-agent invocations or automation pipelines where ANSI escape sequences and completion popups would corrupt stdin/stdout capture.
88
+
The REPL auto-picks the best available input backend on startup (`prompt_toolkit` → `readline` → bare `input()`). Pass `--backend` (or set `ROBOTCODE_REPL_BACKEND`) to force a specific one:
89
+
90
+
| Value | Effect |
91
+
| ----- | ------ |
92
+
|`auto` (default) | Run the fallback cascade. |
93
+
|`prompt-toolkit`| Use the prompt_toolkit backend. Requires the `[prompt-toolkit]` extra. |
94
+
|`readline`| Use the readline backend even when prompt_toolkit is installed. Useful for testing the readline code path or for users who prefer it. |
95
+
|`plain`| Bypass every editor layer and fall back to a bare `input()` prompt. |
96
+
97
+
Requesting a backend that isn't importable on the current Python aborts startup with a clear error and a `pip install` hint — there is no silent fallback, so the explicit choice is always honoured (or visibly refused).
98
+
99
+
#### Disabling all enhancements (AI agents, automation)
100
+
101
+
`--plain` (or `ROBOTCODE_REPL_PLAIN=1`) is a shorthand for `--backend=plain`. It bypasses every layer above and falls back to a bare `input()` prompt — no history, no completion, no candidate popup, no auto-suggest, no syntax highlighting. Use this for AI-agent invocations or automation pipelines where ANSI escape sequences and completion popups would corrupt stdin/stdout capture.
@@ -94,7 +107,7 @@ Log To Console hello from agent
94
107
EOF
95
108
```
96
109
97
-
`--plain`and `--no-history`can be combined safely (plain mode has no history file anyway).
110
+
Combining `--plain`with a non-`plain``--backend` value is rejected as a usage error; combining it with `--no-history`is fine (plain mode has no history file anyway).
0 commit comments