Skip to content

Commit ff625ec

Browse files
author
nshkrdotcom
committed
update models, docs
1 parent b392f60 commit ff625ec

16 files changed

+5439
-12
lines changed

QUICK_START.md

Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
# Quick Start: From Manual Prompts to Seamless Automation
2+
3+
## 5-Minute Setup
4+
5+
### 1. Make the helper script accessible
6+
7+
```bash
8+
# Add to your PATH (choose one)
9+
10+
# Option A: Symlink to ~/bin
11+
mkdir -p ~/bin
12+
ln -s $(pwd)/scripts/ai ~/bin/ai
13+
export PATH="$HOME/bin:$PATH" # Add to ~/.bashrc or ~/.zshrc
14+
15+
# Option B: Add alias
16+
echo 'alias ai="'$(pwd)'/scripts/ai"' >> ~/.bashrc
17+
source ~/.bashrc
18+
```
19+
20+
### 2. Test it works
21+
22+
```bash
23+
# Mock mode (no API calls, no cost)
24+
TEST_MODE=mock ai review examples/simple_test.yaml
25+
26+
# Should show mock output
27+
```
28+
29+
### 3. Set up for real use
30+
31+
```bash
32+
# Required: Gemini API key
33+
export GEMINI_API_KEY="your-key-here"
34+
35+
# Required: Claude CLI
36+
# Install from https://claude.ai/download
37+
# Then run: claude auth
38+
39+
# Add to ~/.bashrc for persistence
40+
echo 'export GEMINI_API_KEY="your-key"' >> ~/.bashrc
41+
```
42+
43+
## Daily Usage
44+
45+
### Code Review (Most Common)
46+
47+
```bash
48+
# Quick review of a file
49+
ai review src/auth.ex
50+
51+
# Output appears in outputs/quick_review_*.md
52+
```
53+
54+
### Understand Unfamiliar Code
55+
56+
```bash
57+
ai explain lib/complex_module.ex
58+
59+
# Get plain-English explanation
60+
```
61+
62+
### Debug an Error
63+
64+
```bash
65+
# Save error to file first
66+
mix test 2>&1 | tee logs/error.log
67+
68+
# Get analysis and fix suggestion
69+
ai fix logs/error.log
70+
```
71+
72+
## Your First Custom Workflow
73+
74+
Create `workflows/my_task.yaml`:
75+
76+
```yaml
77+
workflow:
78+
name: "my_custom_task"
79+
80+
steps:
81+
- name: "do_thing"
82+
type: "claude"
83+
output_to_file: "result.md"
84+
claude_options:
85+
model: "haiku" # Fast and cheap
86+
prompt:
87+
- type: "file"
88+
path: "{{ input_file }}"
89+
- type: "static"
90+
content: "Do the thing I need done"
91+
```
92+
93+
Run it:
94+
95+
```bash
96+
mix pipeline.run.live workflows/my_task.yaml INPUT_FILE="data.txt"
97+
cat outputs/result.md
98+
```
99+
100+
## Integration Patterns
101+
102+
### Git Hook (Auto-review before commit)
103+
104+
```bash
105+
# .git/hooks/pre-commit
106+
#!/bin/bash
107+
108+
CHANGED=$(git diff --cached --name-only --diff-filter=ACM | grep '\.ex$')
109+
110+
for file in $CHANGED; do
111+
./scripts/ai review $file
112+
113+
# Optionally: fail if critical issues found
114+
if grep -q "CRITICAL" outputs/quick_review_*.md; then
115+
echo "❌ Critical issues in $file"
116+
exit 1
117+
fi
118+
done
119+
```
120+
121+
### Makefile (Team consistency)
122+
123+
```makefile
124+
# Makefile
125+
.PHONY: ai-review ai-fix
126+
127+
ai-review:
128+
@./scripts/ai review $(FILE)
129+
130+
ai-fix:
131+
@./scripts/ai fix $(LOG)
132+
133+
# Usage:
134+
# make ai-review FILE=src/auth.ex
135+
# make ai-fix LOG=logs/error.log
136+
```
137+
138+
### IEx Helper (Elixir REPL)
139+
140+
```elixir
141+
# .iex.exs
142+
defmodule AI do
143+
def review(file), do: System.cmd("./scripts/ai", ["review", file]) |> elem(0) |> IO.puts()
144+
def explain(file), do: System.cmd("./scripts/ai", ["explain", file]) |> elem(0) |> IO.puts()
145+
def fix(log), do: System.cmd("./scripts/ai", ["fix", log]) |> elem(0) |> IO.puts()
146+
end
147+
148+
# Usage:
149+
# iex> AI.review("lib/my_app.ex")
150+
```
151+
152+
## Common Workflows to Create
153+
154+
### Test Generation
155+
156+
```yaml
157+
# workflows/test_gen.yaml
158+
workflow:
159+
name: "generate_tests"
160+
steps:
161+
- name: "gen_tests"
162+
type: "claude"
163+
output_to_file: "tests_{{ timestamp }}.ex"
164+
claude_options:
165+
model: "sonnet"
166+
max_turns: 5
167+
prompt:
168+
- type: "file"
169+
path: "{{ code_file }}"
170+
- type: "static"
171+
content: |
172+
Generate comprehensive ExUnit tests for this module.
173+
Include: happy path, edge cases, error conditions.
174+
```
175+
176+
### Documentation
177+
178+
```yaml
179+
# workflows/gen_docs.yaml
180+
workflow:
181+
name: "generate_docs"
182+
steps:
183+
- name: "write_docs"
184+
type: "gemini"
185+
output_to_file: "docs_{{ timestamp }}.md"
186+
model: "gemini-flash-lite-latest"
187+
prompt:
188+
- type: "file"
189+
path: "{{ code_file }}"
190+
- type: "static"
191+
content: |
192+
Generate comprehensive documentation:
193+
- Module overview
194+
- Function descriptions
195+
- Parameters and return values
196+
- Usage examples
197+
- Common pitfalls
198+
```
199+
200+
### Refactoring Suggestions
201+
202+
```yaml
203+
# workflows/refactor.yaml
204+
workflow:
205+
name: "suggest_refactoring"
206+
steps:
207+
- name: "analyze"
208+
type: "claude"
209+
output_to_file: "refactor_{{ timestamp }}.md"
210+
claude_options:
211+
model: "sonnet"
212+
prompt:
213+
- type: "file"
214+
path: "{{ code_file }}"
215+
- type: "static"
216+
content: |
217+
Suggest refactoring improvements:
218+
- Code smells
219+
- Duplication
220+
- Complexity reduction
221+
- Better patterns
222+
- Specific changes with examples
223+
```
224+
225+
## Tips for Success
226+
227+
1. **Start with ONE workflow you'll use daily**
228+
2. **Use mock mode first** (TEST_MODE=mock)
229+
3. **Review AI output** - don't blindly trust
230+
4. **Iterate on prompts** - refine based on results
231+
5. **Share with team** - commit workflows to git
232+
233+
## What to Automate (Priority Order)
234+
235+
**Week 1:**
236+
- ✅ Code review (most common)
237+
- ✅ Code explanation (learning)
238+
239+
**Week 2:**
240+
- Test generation
241+
- Bug fix suggestions
242+
243+
**Week 3:**
244+
- Documentation generation
245+
- Refactoring suggestions
246+
247+
**Week 4:**
248+
- PR review automation
249+
- CI/CD integration
250+
251+
## Troubleshooting
252+
253+
### "Mix task not found"
254+
```bash
255+
# Run from project root
256+
cd /path/to/pipeline_ex
257+
./scripts/ai review file.ex
258+
```
259+
260+
### "GEMINI_API_KEY not set"
261+
```bash
262+
export GEMINI_API_KEY="your-key"
263+
# Or add to ~/.bashrc
264+
```
265+
266+
### "Claude CLI not found"
267+
```bash
268+
# Install Claude CLI
269+
# https://claude.ai/download
270+
# Then authenticate
271+
claude auth
272+
```
273+
274+
### "Outputs directory doesn't exist"
275+
```bash
276+
mkdir -p outputs
277+
# Or run any pipeline - it auto-creates
278+
```
279+
280+
## Next Steps
281+
282+
1. ✅ Set up the `ai` script
283+
2. ✅ Run one workflow in mock mode
284+
3. ✅ Run same workflow in live mode
285+
4. ✅ Create your first custom workflow
286+
5. ✅ Add to git hooks or Makefile
287+
6. ✅ Share with team
288+
289+
**Goal:** Within 1 week, you should be running AI workflows without thinking about it.
290+
291+
## Resources
292+
293+
- [Full transition guide](docs/guides/transitioning_from_manual_prompts.md)
294+
- [Programmatic usage](docs/guides/programmatic_usage.md)
295+
- [Model selection](docs/guides/model_selection.md)
296+
- [Robustness guide](docs/guides/robustness_and_reliability.md)

0 commit comments

Comments
 (0)