Skip to main content

ralph_workflow/cli/init/
extended_help.rs

1/// Handle the `--extended-help` / `--man` flag.
2///
3/// Displays comprehensive help including shell completion, all presets,
4/// troubleshooting information, and the difference between Work Guides and Agent Prompts.
5pub fn handle_extended_help() {
6    println!(
7        r#"RALPH EXTENDED HELP
8===============================================================================
9
10Ralph is a PROMPT-driven multi-agent orchestrator for git repos. It runs a
11developer agent for code implementation, then a reviewer agent for quality
12assurance and fixes (default), automatically staging and committing the final result.
13
14===============================================================================
15GETTING STARTED
16===============================================================================
17
18  1. Initialize config:
19       ralph --init                      # Smart init (infers what you need)
20
21  2. Create a PROMPT.md from a Work Guide:
22       ralph --init feature-spec         # Or: bug-fix, refactor, quick, etc.
23
24  3. Edit PROMPT.md with your task details
25
26  4. Run Ralph:
27       ralph "fix: my bug description"   # Commit message for the final commit
28
29===============================================================================
30WORK GUIDES VS AGENT PROMPTS
31===============================================================================
32
33  Ralph has two types of templates - understanding the difference is key:
34
35  1. WORK GUIDES (for PROMPT.md - YOUR task descriptions)
36     -------------------------------------------------
37     These are templates for describing YOUR work to the AI.
38     You fill them in with your specific task requirements.
39
40     Examples: quick, bug-fix, feature-spec, refactor, test, docs
41
42     Commands:
43       ralph --init <work-guide>      Create PROMPT.md from a Work Guide
44       ralph --list-work-guides       Show all available Work Guides
45
46  2. AGENT PROMPTS (backend AI behavior configuration)
47     -------------------------------------------------
48     These configure HOW the AI agents behave (internal system prompts).
49     You probably don't need to touch these unless customizing agent behavior.
50
51     Commands:
52       ralph --init-system-prompts    Create default Agent Prompts
53       ralph --list                   Show Agent Prompt templates
54       ralph --show <name>            Show a specific Agent Prompt
55
56===============================================================================
57PRESET MODES
58===============================================================================
59
60  Pick how thorough the AI should be:
61
62    -Q  Quick:      1 dev iteration  + 1 review   (typos, small fixes)
63    -U  Rapid:      2 dev iterations + 1 review   (minor changes)
64    -S  Standard:   5 dev iterations + 2 reviews  (default for most tasks)
65    -T  Thorough:  10 dev iterations + 5 reviews  (complex features)
66    -L  Long:      15 dev iterations + 10 reviews (most thorough)
67
68  Custom iterations:
69    ralph -D 3 -R 2 "feat: feature"   # 3 dev iterations, 2 review cycles
70    ralph -D 10 -R 0 "feat: no review"  # Skip review phase entirely
71
72===============================================================================
73COMMON OPTIONS
74===============================================================================
75
76  Iterations:
77    -D N, --developer-iters N   Set developer iterations
78    -R N, --reviewer-reviews N  Set review cycles (0 = skip review)
79
80  Agents:
81    -a AGENT, --developer-agent AGENT   Pick developer agent
82    -r AGENT, --reviewer-agent AGENT    Pick reviewer agent
83
84  Verbosity:
85    -q, --quiet          Quiet mode (minimal output)
86    -f, --full           Full output (no truncation)
87    -v N, --verbosity N  Set verbosity (0-4)
88
89  Other:
90    -d, --diagnose       Show system info and agent status
91
92===============================================================================
93ADVANCED OPTIONS
94===============================================================================
95
96  These options are hidden from the main --help to reduce clutter.
97
98  Initialization:
99    --force-overwrite            Overwrite PROMPT.md without prompting
100    -i, --interactive            Prompt for PROMPT.md if missing
101
102  Git Control:
103    --with-rebase                Enable automatic rebase to main branch (disabled by default)
104    --rebase-only                Only rebase, then exit (no pipeline)
105    --git-user-name <name>       Override git user name for commits
106    --git-user-email <email>     Override git user email for commits
107
108  Recovery:
109    --resume                     Resume from last checkpoint
110    --dry-run                    Validate setup without running agents
111
112  Agent Prompt Management:
113    --init-system-prompts        Create default Agent Prompt templates
114    --list                       List all Agent Prompt templates
115    --show <name>                Show Agent Prompt content
116    --validate                   Validate Agent Prompt templates
117    --variables <name>           Extract variables from template
118    --render <name>              Test render a template
119
120  Debugging:
121    --show-streaming-metrics     Show JSON streaming quality metrics
122    -c PATH, --config PATH       Use specific config file
123
124===============================================================================
125SHELL COMPLETION
126===============================================================================
127
128  Enable tab-completion for faster command entry:
129
130    Bash:
131      ralph --generate-completion=bash > ~/.local/share/bash-completion/completions/ralph
132
133    Zsh:
134      ralph --generate-completion=zsh > ~/.zsh/completion/_ralph
135
136    Fish:
137      ralph --generate-completion=fish > ~/.config/fish/completions/ralph.fish
138
139  Then restart your shell or source the file.
140
141===============================================================================
142TROUBLESHOOTING
143===============================================================================
144
145  Common issues:
146
147    "PROMPT.md not found"
148      -> Run: ralph --init <work-guide>  (e.g., ralph --init bug-fix)
149
150    "No agents available"
151      -> Run: ralph -d  (diagnose) to check agent status
152      -> Ensure at least one agent is installed (claude, codex, opencode)
153
154    "Config file not found"
155      -> Run: ralph --init  to create ~/.config/ralph-workflow.toml
156
157    Resume after interruption:
158      -> Run: ralph --resume  to continue from last checkpoint
159
160    Validate setup without running:
161      -> Run: ralph --dry-run
162
163===============================================================================
164EXAMPLES
165===============================================================================
166
167    ralph "fix: typo"                 Run with default settings
168    ralph -Q "fix: small bug"         Quick mode for tiny fixes
169    ralph -U "feat: add button"       Rapid mode for minor features
170    ralph -a claude "fix: bug"        Use specific agent
171    ralph --list-work-guides          See all Work Guides
172    ralph --init bug-fix              Create PROMPT.md from a Work Guide
173    ralph --init bug-fix --force-overwrite  Overwrite existing PROMPT.md
174
175===============================================================================
176"#
177    );
178}