aia 0.9.11 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/CHANGELOG.md +66 -2
  4. data/README.md +133 -4
  5. data/docs/advanced-prompting.md +721 -0
  6. data/docs/cli-reference.md +582 -0
  7. data/docs/configuration.md +347 -0
  8. data/docs/contributing.md +332 -0
  9. data/docs/directives-reference.md +490 -0
  10. data/docs/examples/index.md +277 -0
  11. data/docs/examples/mcp/index.md +479 -0
  12. data/docs/examples/prompts/analysis/index.md +78 -0
  13. data/docs/examples/prompts/automation/index.md +108 -0
  14. data/docs/examples/prompts/development/index.md +125 -0
  15. data/docs/examples/prompts/index.md +333 -0
  16. data/docs/examples/prompts/learning/index.md +127 -0
  17. data/docs/examples/prompts/writing/index.md +62 -0
  18. data/docs/examples/tools/index.md +292 -0
  19. data/docs/faq.md +414 -0
  20. data/docs/guides/available-models.md +366 -0
  21. data/docs/guides/basic-usage.md +477 -0
  22. data/docs/guides/chat.md +474 -0
  23. data/docs/guides/executable-prompts.md +417 -0
  24. data/docs/guides/first-prompt.md +454 -0
  25. data/docs/guides/getting-started.md +455 -0
  26. data/docs/guides/image-generation.md +507 -0
  27. data/docs/guides/index.md +46 -0
  28. data/docs/guides/models.md +507 -0
  29. data/docs/guides/tools.md +856 -0
  30. data/docs/index.md +173 -0
  31. data/docs/installation.md +238 -0
  32. data/docs/mcp-integration.md +612 -0
  33. data/docs/prompt_management.md +579 -0
  34. data/docs/security.md +629 -0
  35. data/docs/tools-and-mcp-examples.md +1186 -0
  36. data/docs/workflows-and-pipelines.md +563 -0
  37. data/examples/tools/mcp/github_mcp_server.json +11 -0
  38. data/examples/tools/mcp/imcp.json +7 -0
  39. data/lib/aia/chat_processor_service.rb +19 -3
  40. data/lib/aia/config/base.rb +224 -0
  41. data/lib/aia/config/cli_parser.rb +409 -0
  42. data/lib/aia/config/defaults.rb +88 -0
  43. data/lib/aia/config/file_loader.rb +131 -0
  44. data/lib/aia/config/validator.rb +184 -0
  45. data/lib/aia/config.rb +10 -860
  46. data/lib/aia/directive_processor.rb +27 -372
  47. data/lib/aia/directives/configuration.rb +114 -0
  48. data/lib/aia/directives/execution.rb +37 -0
  49. data/lib/aia/directives/models.rb +178 -0
  50. data/lib/aia/directives/registry.rb +120 -0
  51. data/lib/aia/directives/utility.rb +70 -0
  52. data/lib/aia/directives/web_and_file.rb +71 -0
  53. data/lib/aia/prompt_handler.rb +23 -3
  54. data/lib/aia/ruby_llm_adapter.rb +307 -128
  55. data/lib/aia/session.rb +27 -14
  56. data/lib/aia/utility.rb +12 -8
  57. data/lib/aia.rb +11 -2
  58. data/lib/extensions/ruby_llm/.irbrc +56 -0
  59. data/mkdocs.yml +165 -0
  60. metadata +77 -20
  61. /data/{images → docs/assets/images}/aia.png +0 -0
@@ -0,0 +1,454 @@
1
+ # Your First Prompt
2
+
3
+ A step-by-step guide to creating and running your very first AIA prompt, from the simplest examples to more sophisticated patterns.
4
+
5
+ ## Before You Start
6
+
7
+ Make sure you have:
8
+ - [Installed AIA](../installation.md)
9
+ - Set up your API keys
10
+ - Created your prompts directory (`mkdir -p ~/.prompts`)
11
+
12
+ ## The Simplest Prompt
13
+
14
+ Let's start with the most basic prompt possible:
15
+
16
+ ### Step 1: Create Your First Prompt File
17
+ ```bash
18
+ echo "What is Ruby programming language?" > ~/.prompts/what_is_ruby.txt
19
+ ```
20
+
21
+ ### Step 2: Run Your Prompt
22
+ ```bash
23
+ aia what_is_ruby
24
+ ```
25
+
26
+ That's it! AIA will:
27
+ 1. Find your prompt file in `~/.prompts/`
28
+ 2. Send it to the default AI model
29
+ 3. Display the response in your terminal
30
+
31
+ ## Adding Context to Prompts
32
+
33
+ Now let's create a prompt that works with files:
34
+
35
+ ### Step 1: Create a Context-Aware Prompt
36
+ ```bash
37
+ cat > ~/.prompts/explain_code.txt << 'EOF'
38
+ Please explain what this code does:
39
+
40
+ <%= context_file %>
41
+
42
+ Provide a clear explanation that covers:
43
+ - What the code accomplishes
44
+ - How it works
45
+ - Any potential improvements
46
+ EOF
47
+ ```
48
+
49
+ ### Step 2: Use It with a File
50
+ ```bash
51
+ # Create a sample code file
52
+ echo 'puts "Hello, World!"' > hello.rb
53
+
54
+ # Run the prompt with context
55
+ aia explain_code hello.rb
56
+ ```
57
+
58
+ AIA automatically includes the file content where you specified `<%= context_file %>`.
59
+
60
+ ## Using Directives
61
+
62
+ Directives are special commands in prompts that start with `//`. Let's try some:
63
+
64
+ ### Configuration Directives
65
+ ```bash
66
+ cat > ~/.prompts/detailed_analysis.txt << 'EOF'
67
+ //config model gpt-4
68
+ //config temperature 0.3
69
+
70
+ Provide a detailed technical analysis of this code:
71
+
72
+ <%= context_file %>
73
+
74
+ Focus on:
75
+ - Architecture and design patterns
76
+ - Performance considerations
77
+ - Security implications
78
+ - Best practices compliance
79
+ EOF
80
+ ```
81
+
82
+ ### File Inclusion Directives
83
+ ```bash
84
+ cat > ~/.prompts/project_overview.txt << 'EOF'
85
+ //include README.md
86
+ //include package.json
87
+
88
+ Based on the project files above, provide an overview of:
89
+ - Project purpose and goals
90
+ - Technology stack
91
+ - Getting started instructions
92
+ - Key dependencies
93
+ EOF
94
+ ```
95
+
96
+ ### Shell Command Directives
97
+ ```bash
98
+ cat > ~/.prompts/system_status.txt << 'EOF'
99
+ Current system status:
100
+
101
+ //shell date
102
+ //shell whoami
103
+ //shell uptime
104
+ //shell df -h
105
+
106
+ Please analyze the system status and provide recommendations.
107
+ EOF
108
+ ```
109
+
110
+ ## Interactive Prompts with Parameters
111
+
112
+ Create prompts that accept parameters:
113
+
114
+ ### Step 1: Create a Parameterized Prompt
115
+ ```bash
116
+ cat > ~/.prompts/code_review.txt << 'EOF'
117
+ //config model gpt-4
118
+ //config temperature 0.2
119
+
120
+ # Code Review: <%= file_name %>
121
+
122
+ Review this <%= language %> code for:
123
+ - Bugs and potential issues
124
+ - Code quality and style
125
+ - Performance optimizations
126
+ - Security considerations
127
+
128
+ Focus level: <%= focus_level || "standard" %>
129
+
130
+ Code to review:
131
+ //include <%= file_name %>
132
+
133
+ Please provide specific, actionable feedback.
134
+ EOF
135
+ ```
136
+
137
+ ### Step 2: Use with Parameters
138
+ ```bash
139
+ # ERB-style parameters (in prompt content)
140
+ aia code_review --file_name "app.py" --language "Python" --focus_level "security"
141
+ ```
142
+
143
+ ## Your First Chat Session
144
+
145
+ Try AIA's interactive chat mode:
146
+
147
+ ### Step 1: Start a Chat
148
+ ```bash
149
+ aia --chat
150
+ ```
151
+
152
+ ### Step 2: Have a Conversation
153
+ ```
154
+ You: Help me understand how to use AIA effectively
155
+ AI: I'd be happy to help! AIA is a powerful CLI tool for AI interactions...
156
+
157
+ You: Can you help me write a Python function?
158
+ AI: Of course! What kind of function would you like to create?
159
+
160
+ You: A function that calculates factorial
161
+ AI: Here's a Python factorial function...
162
+ ```
163
+
164
+ ### Step 3: Save Your Conversation
165
+ ```
166
+ You: /save factorial_help.md
167
+ ```
168
+
169
+ ## Working with Different Models
170
+
171
+ Try different AI models for different tasks:
172
+
173
+ ### Quick Tasks
174
+ ```bash
175
+ aia --model gpt-3.5-turbo what_is_ruby
176
+ ```
177
+
178
+ ### Complex Analysis
179
+ ```bash
180
+ aia --model gpt-4 detailed_analysis complex_code.py
181
+ ```
182
+
183
+ ### Long Documents
184
+ ```bash
185
+ aia --model claude-3-sonnet project_overview
186
+ ```
187
+
188
+ ## Creating Your First Workflow
189
+
190
+ Chain prompts together for multi-step processes:
191
+
192
+ ### Step 1: Create Individual Steps
193
+ ```bash
194
+ # Step 1: Extract requirements
195
+ cat > ~/.prompts/extract_requirements.txt << 'EOF'
196
+ //next analyze_requirements
197
+
198
+ Extract and list all requirements from this project:
199
+
200
+ //include README.md
201
+ //include requirements.txt
202
+
203
+ Provide a structured list of:
204
+ - Functional requirements
205
+ - Non-functional requirements
206
+ - Dependencies
207
+ - Constraints
208
+ EOF
209
+
210
+ # Step 2: Analyze requirements
211
+ cat > ~/.prompts/analyze_requirements.txt << 'EOF'
212
+ //next generate_recommendations
213
+
214
+ Based on the requirements extraction, analyze:
215
+ - Completeness of requirements
216
+ - Potential conflicts or gaps
217
+ - Implementation complexity
218
+ - Risk factors
219
+ EOF
220
+
221
+ # Step 3: Generate recommendations
222
+ cat > ~/.prompts/generate_recommendations.txt << 'EOF'
223
+ Based on the requirements and analysis, provide:
224
+ - Implementation recommendations
225
+ - Architecture suggestions
226
+ - Risk mitigation strategies
227
+ - Next steps
228
+ EOF
229
+ ```
230
+
231
+ ### Step 2: Run the Workflow
232
+ ```bash
233
+ aia extract_requirements
234
+ ```
235
+
236
+ AIA will automatically run all three prompts in sequence!
237
+
238
+ ## Common Beginner Mistakes to Avoid
239
+
240
+ ### ❌ Don't: Create overly complex first prompts
241
+ ```bash
242
+ # Too complex for beginners
243
+ cat > ~/.prompts/bad_first_prompt.txt << 'EOF'
244
+ //config model gpt-4
245
+ //config temperature 0.7
246
+ //ruby complex_calculations
247
+ //shell complex_command | grep something
248
+ //include multiple_files.txt
249
+
250
+ Perform complex multi-step analysis with advanced features...
251
+ EOF
252
+ ```
253
+
254
+ ### ✅ Do: Start simple and build up
255
+ ```bash
256
+ # Good first prompt
257
+ cat > ~/.prompts/good_first_prompt.txt << 'EOF'
258
+ Summarize this file in simple terms:
259
+
260
+ <%= context_file %>
261
+ EOF
262
+ ```
263
+
264
+ ### ❌ Don't: Ignore error messages
265
+ ```bash
266
+ # If this fails, read the error message!
267
+ aia nonexistent_prompt
268
+ ```
269
+
270
+ ### ✅ Do: Use debug mode when learning
271
+ ```bash
272
+ # See what AIA is doing
273
+ aia --debug --verbose your_prompt
274
+ ```
275
+
276
+ ## Practice Exercises
277
+
278
+ Try these exercises to reinforce what you've learned:
279
+
280
+ ### Exercise 1: File Analyzer
281
+ Create a prompt that analyzes any file type and provides insights.
282
+
283
+ ```bash
284
+ cat > ~/.prompts/analyze_file.txt << 'EOF'
285
+ Analyze this file:
286
+
287
+ //include <%= file %>
288
+
289
+ Provide:
290
+ - File type and format
291
+ - Key content summary
292
+ - Purpose and use case
293
+ - Any notable features
294
+ EOF
295
+ ```
296
+
297
+ ### Exercise 2: Code Formatter
298
+ Create a prompt that suggests code improvements.
299
+
300
+ ```bash
301
+ cat > ~/.prompts/improve_code.txt << 'EOF'
302
+ //config temperature 0.3
303
+
304
+ Suggest improvements for this code:
305
+
306
+ //include <%= code_file %>
307
+
308
+ Focus on:
309
+ - Readability
310
+ - Performance
311
+ - Best practices
312
+ - Error handling
313
+ EOF
314
+ ```
315
+
316
+ ### Exercise 3: Project Documentation
317
+ Create a prompt that generates README content.
318
+
319
+ ```bash
320
+ cat > ~/.prompts/generate_readme.txt << 'EOF'
321
+ Generate README.md content for this project:
322
+
323
+ Project structure:
324
+ //shell find . -type f -name "*.py" -o -name "*.rb" -o -name "*.js" | head -10
325
+
326
+ Configuration files:
327
+ //shell ls *.json *.yml *.yaml 2>/dev/null || echo "No config files found"
328
+
329
+ Create a comprehensive README with:
330
+ - Project description
331
+ - Installation instructions
332
+ - Usage examples
333
+ - Contributing guidelines
334
+ EOF
335
+ ```
336
+
337
+ ## Tips for Success
338
+
339
+ ### Start Small
340
+ - Begin with simple, single-purpose prompts
341
+ - Test each prompt thoroughly before making it complex
342
+ - Add one new feature at a time
343
+
344
+ ### Use Descriptive Names
345
+ ```bash
346
+ # Good prompt names
347
+ ~/.prompts/analyze_python_code.txt
348
+ ~/.prompts/summarize_research_paper.txt
349
+ ~/.prompts/generate_api_docs.txt
350
+
351
+ # Poor prompt names
352
+ ~/.prompts/prompt1.txt
353
+ ~/.prompts/test.txt
354
+ ~/.prompts/stuff.txt
355
+ ```
356
+
357
+ ### Organize Your Prompts
358
+ ```bash
359
+ # Create categories
360
+ mkdir -p ~/.prompts/{development,analysis,writing,learning}
361
+
362
+ # Move prompts to appropriate directories
363
+ mv ~/.prompts/code_review.txt ~/.prompts/development/
364
+ mv ~/.prompts/analyze_file.txt ~/.prompts/analysis/
365
+ ```
366
+
367
+ ### Version Control Your Prompts
368
+ ```bash
369
+ cd ~/.prompts
370
+ git init
371
+ git add .
372
+ git commit -m "My first AIA prompts"
373
+ ```
374
+
375
+ ### Experiment and Iterate
376
+ - Try different models for the same prompt
377
+ - Adjust temperature settings to see the difference
378
+ - Refine prompts based on the results you get
379
+
380
+ ## Getting Help
381
+
382
+ ### Built-in Help
383
+ ```bash
384
+ # General help
385
+ aia --help
386
+
387
+ # Model information
388
+ aia --available_models
389
+
390
+ # Debug information
391
+ aia --debug my_prompt
392
+ ```
393
+
394
+ ### Community Resources
395
+ - Check the [FAQ](../faq.md) for common questions
396
+ - Browse [Examples](../examples/index.md) for inspiration
397
+ - Read the [Advanced Prompting](../advanced-prompting.md) guide when ready
398
+
399
+ ## Next Steps
400
+
401
+ After mastering your first prompt, explore:
402
+
403
+ 1. **[Basic Usage](basic-usage.md)** - Common usage patterns
404
+ 2. **[Chat Mode](chat.md)** - Interactive conversations
405
+ 3. **[Working with Models](models.md)** - Model selection strategies
406
+ 4. **[Tools Integration](tools.md)** - Extending capabilities
407
+ 5. **[Advanced Prompting](../advanced-prompting.md)** - Expert techniques
408
+
409
+ ## Troubleshooting Your First Prompt
410
+
411
+ ### Prompt Not Found
412
+ ```bash
413
+ # Check if file exists
414
+ ls ~/.prompts/your_prompt.txt
415
+
416
+ # Check file permissions
417
+ chmod 644 ~/.prompts/your_prompt.txt
418
+
419
+ # Use full path if needed
420
+ aia --prompts_dir ~/.prompts your_prompt
421
+ ```
422
+
423
+ ### API Errors
424
+ ```bash
425
+ # Check API key
426
+ echo $OPENAI_API_KEY | cut -c1-10
427
+
428
+ # Test with simple prompt
429
+ aia --model gpt-3.5-turbo --debug simple_test
430
+ ```
431
+
432
+ ### Unexpected Results
433
+ ```bash
434
+ # Use debug mode
435
+ aia --debug --verbose your_prompt
436
+
437
+ # Try different model
438
+ aia --model claude-3-sonnet your_prompt
439
+
440
+ # Simplify the prompt
441
+ echo "Simple test question" | aia --chat
442
+ ```
443
+
444
+ ## Congratulations!
445
+
446
+ You've created and run your first AIA prompt! You now understand:
447
+ - ✅ How to create basic prompt files
448
+ - ✅ How to run prompts with context
449
+ - ✅ How to use simple directives
450
+ - ✅ How to work with different models
451
+ - ✅ How to start chat sessions
452
+ - ✅ How to create basic workflows
453
+
454
+ Keep experimenting and building more sophisticated prompts as you become comfortable with these fundamentals!