REPL Mode
When you run your app with no arguments, Repl starts an interactive session. The same routes your CLI uses are available interactively — no separate implementation.
Starting a session
Section titled “Starting a session”$ myapp>The > prompt signals REPL mode. Type any command from your graph:
> client listAliceBob
> client 42 show --json{ "id": 42, "name": "ACME" }
> exitScoped navigation
Section titled “Scoped navigation”app.Context(...) creates sub-scopes. You can enter a scope and run commands relative to it:
> client[client]> listAliceBob
[client]> 42[client/42]> showId: 42, Name: ACME
[client/42]> ..[client]> ..>- Enter a scope by typing its name (or a scoped value like
42). - Go up with
... - The prompt shows your current position.
Ambient commands
Section titled “Ambient commands”These are always available in REPL mode regardless of your command graph:
| Command | Description |
|---|---|
help | List commands in current scope |
help <route> | Describe a specific command |
exit | End the session |
clear | Clear the screen |
.. | Go up one scope level |
History and completion
Section titled “History and completion”- Up/Down arrows navigate command history.
- Tab triggers autocomplete for routes and parameters (requires
UseDefaultInteractive()). - History is in-memory by default and does not persist across sessions. Inject a custom
IHistoryProviderto add persistence (file, database, or any backing store).
Customizing the prompt
Section titled “Customizing the prompt”app.WithBanner(""" Welcome to MyApp REPL. Type 'help' to list commands. """);Driving from scripts
Section titled “Driving from scripts”REPL mode can be driven by a script using --answer:* options — useful for demos and deterministic testing:
myapp --answer:1=Alice --answer:2=alice@example.comThe --answer:N flag pre-fills interactive prompts in order.
Next step
Section titled “Next step”→ MCP Mode