Skip to content

Commit 9ee1672

Browse files
Kasper Jungeclaude
authored andcommitted
docs: document shell completion and update codebase map so users discover tab-complete and contributors see current module layout
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ea90f69 commit 9ee1672

3 files changed

Lines changed: 41 additions & 4 deletions

File tree

docs/cli.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,42 @@ ralph --help # Show help
6868
| Option | Short | Description |
6969
|---|---|---|
7070
| `--version` | `-V` | Show version and exit |
71+
| `--install-completion` | | Install tab completion for your current shell |
72+
| `--show-completion` | | Print the completion script (for manual setup) |
7173
| `--help` | | Show help and exit |
7274

75+
### Shell completion
76+
77+
Ralphify supports tab completion for commands, options, and prompt names. Install it once and it persists across sessions:
78+
79+
=== "Bash"
80+
81+
```bash
82+
ralph --install-completion bash
83+
```
84+
85+
=== "Zsh"
86+
87+
```bash
88+
ralph --install-completion zsh
89+
```
90+
91+
=== "Fish"
92+
93+
```bash
94+
ralph --install-completion fish
95+
```
96+
97+
After installing, restart your shell (or `source` your profile). Then you can tab-complete:
98+
99+
```bash
100+
ralph r<TAB> # → ralph run
101+
ralph run --t<TAB> # → ralph run --timeout
102+
ralph new c<TAB> # → ralph new check
103+
```
104+
105+
If you prefer to install manually, use `--show-completion` to print the script and add it to your shell config yourself.
106+
73107
### `ralph init`
74108

75109
Initialize a project with `ralph.toml` and `PROMPT.md`.

docs/contributing/codebase-map.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ src/ralphify/ # All source code
2626
├── prompts.py # Named prompt discovery and resolution
2727
├── resolver.py # Template placeholder resolution (shared by contexts + instructions)
2828
├── detector.py # Auto-detect project type from manifest files
29+
├── _run_types.py # RunConfig, RunState, RunStatus — shared data types for the engine
2930
├── _runner.py # Execute shell commands with timeout and capture output
3031
├── _frontmatter.py # Parse YAML frontmatter from markdown primitives, discover primitives
3132
├── _templates.py # Scaffold templates for init and new commands
@@ -118,10 +119,11 @@ The CLI uses a `ConsoleEmitter` (defined in `_console_emitter.py`) that renders
118119

119120
## Key files to understand first
120121

121-
1. **`engine.py`** — The core run loop. Understands `RunConfig`, `RunState`, and `EventEmitter`. This is where iteration logic lives.
122-
2. **`cli.py`** — All CLI commands and prompt resolution. Delegates to `engine.run_loop()` for the actual loop. Scaffold templates live in `_templates.py`. Terminal event rendering lives in `_console_emitter.py`.
123-
3. **`_frontmatter.py`** — The primitive discovery system. Understanding `discover_primitives()` and `parse_frontmatter()` is essential for working on checks/contexts/instructions/prompts.
124-
4. **`resolver.py`** — Template placeholder logic shared by contexts and instructions. Small file but critical — changes here affect both.
122+
1. **`engine.py`** — The core run loop. Uses `RunConfig` and `RunState` (from `_run_types.py`) and `EventEmitter`. This is where iteration logic lives.
123+
2. **`_run_types.py`**`RunConfig`, `RunState`, and `RunStatus`. These are the shared data types used by the engine, CLI, manager, and UI. Separated so modules that only need the types don't pull in execution logic.
124+
3. **`cli.py`** — All CLI commands and prompt resolution. Delegates to `engine.run_loop()` for the actual loop. Scaffold templates live in `_templates.py`. Terminal event rendering lives in `_console_emitter.py`.
125+
4. **`_frontmatter.py`** — The primitive discovery system. Understanding `discover_primitives()` and `parse_frontmatter()` is essential for working on checks/contexts/instructions/prompts.
126+
5. **`resolver.py`** — Template placeholder logic shared by contexts and instructions. Small file but critical — changes here affect both.
125127

126128
## Traps and gotchas
127129

docs/quick-reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ See [Configuration & CLI](cli.md#ralphtoml) for details.
3636
| `ralph new instruction <name>` | Scaffold a new instruction |
3737
| `ralph new prompt <name>` | Scaffold a new named prompt |
3838
| `ralph ui` | Launch the [web dashboard](dashboard.md) |
39+
| `ralph --install-completion` | Install [shell tab completion](cli.md#shell-completion) |
3940

4041
### `ralph run` options
4142

0 commit comments

Comments
 (0)