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,582 @@
1
+ # CLI Reference
2
+
3
+ Complete reference for all AIA command-line arguments, options, and flags.
4
+
5
+ ## Usage Patterns
6
+
7
+ ```bash
8
+ # Basic usage
9
+ aia [options] [PROMPT_ID] [CONTEXT_FILE]*
10
+
11
+ # Chat mode
12
+ aia --chat [PROMPT_ID] [CONTEXT_FILE]*
13
+ aia --chat [CONTEXT_FILE]*
14
+
15
+ # Show help
16
+ aia --help
17
+
18
+ # Show version
19
+ aia --version
20
+ ```
21
+
22
+ ## Mode Options
23
+
24
+ ### `--chat`
25
+ Begin a chat session with the LLM after processing all prompts in the pipeline.
26
+
27
+ ```bash
28
+ aia --chat
29
+ aia --chat system_prompt
30
+ aia --chat my_prompt context.txt
31
+ ```
32
+
33
+ ### `-f, --fuzzy`
34
+ Use fuzzy matching for prompt search (requires `fzf` to be installed).
35
+
36
+ ```bash
37
+ aia --fuzzy
38
+ aia -f
39
+ ```
40
+
41
+ **Note**: If `fzf` is not installed, AIA will exit with an error.
42
+
43
+ ### `--terse`
44
+ Adds a special instruction to the prompt asking the AI to keep responses short and to the point.
45
+
46
+ ```bash
47
+ aia --terse my_prompt
48
+ aia --terse --chat
49
+ ```
50
+
51
+ ## Adapter Options
52
+
53
+ ### `--adapter ADAPTER`
54
+ Interface that adapts AIA to the LLM. Currently supported: `ruby_llm`
55
+
56
+ ```bash
57
+ aia --adapter ruby_llm
58
+ ```
59
+
60
+ **Valid adapters**: `ruby_llm`
61
+
62
+ ### `--available_models [QUERY]`
63
+ List (then exit) available models that match the optional query. Query is a comma-separated list of AND components.
64
+
65
+ ```bash
66
+ # List all models
67
+ aia --available_models
68
+
69
+ # Filter by provider
70
+ aia --available_models openai
71
+
72
+ # Filter by capability and provider
73
+ aia --available_models openai,mini
74
+
75
+ # Filter by modality
76
+ aia --available_models text_to_text
77
+
78
+ # Complex filter
79
+ aia --available_models openai,gpt,text_to_image
80
+ ```
81
+
82
+ ## Model Options
83
+
84
+ ### `-m MODEL, --model MODEL`
85
+ Name of the LLM model(s) to use. For multiple models, use comma-separated values.
86
+
87
+ ```bash
88
+ # Single model
89
+ aia --model gpt-4 my_prompt
90
+
91
+ # Multiple models (parallel processing)
92
+ aia --model "gpt-4,claude-3-sonnet,gemini-pro" my_prompt
93
+
94
+ # Short form
95
+ aia -m gpt-3.5-turbo my_prompt
96
+ ```
97
+
98
+ ### `--[no-]consensus`
99
+ Enable/disable consensus mode for multi-model responses. When enabled, AIA attempts to create a consensus response from multiple models.
100
+
101
+ ```bash
102
+ # Enable consensus mode (requires multiple models)
103
+ aia --model "gpt-4,claude-3-sonnet" --consensus my_prompt
104
+
105
+ # Disable consensus mode (default: show individual responses)
106
+ aia --model "gpt-4,claude-3-sonnet" --no-consensus my_prompt
107
+ ```
108
+
109
+ ### `--sm, --speech_model MODEL`
110
+ Speech model to use for text-to-speech functionality.
111
+
112
+ ```bash
113
+ aia --speech_model tts-1 --speak my_prompt
114
+ aia --sm tts-1-hd --speak my_prompt
115
+ ```
116
+
117
+ ### `--tm, --transcription_model MODEL`
118
+ Transcription model to use for speech-to-text functionality.
119
+
120
+ ```bash
121
+ aia --transcription_model whisper-1 audio_file.wav
122
+ aia --tm whisper-1 my_audio.mp3
123
+ ```
124
+
125
+ ## File Options
126
+
127
+ ### `-c, --config_file FILE`
128
+ Load configuration from a specific file.
129
+
130
+ ```bash
131
+ aia --config_file /path/to/config.yml my_prompt
132
+ aia -c ~/.aia/custom_config.yml my_prompt
133
+ ```
134
+
135
+ ### `-o, --[no-]out_file [FILE]`
136
+ Output file for saving AI responses.
137
+
138
+ ```bash
139
+ # Save to default file (temp.md)
140
+ aia --out_file my_prompt
141
+
142
+ # Save to specific file
143
+ aia --out_file output.txt my_prompt
144
+
145
+ # Use absolute path
146
+ aia --out_file /tmp/ai_response.md my_prompt
147
+
148
+ # Disable file output
149
+ aia --no-out_file my_prompt
150
+ ```
151
+
152
+ ### `-a, --[no-]append`
153
+ Append to output file instead of overwriting.
154
+
155
+ ```bash
156
+ # Append mode
157
+ aia --out_file log.md --append my_prompt
158
+
159
+ # Overwrite mode (default)
160
+ aia --out_file log.md --no-append my_prompt
161
+ ```
162
+
163
+ ### `-l, --[no-]log_file [FILE]`
164
+ Log file for AIA operations.
165
+
166
+ ```bash
167
+ # Enable logging to default location
168
+ aia --log_file my_prompt
169
+
170
+ # Log to specific file
171
+ aia --log_file /var/log/aia.log my_prompt
172
+
173
+ # Disable logging
174
+ aia --no-log_file my_prompt
175
+ ```
176
+
177
+ ### `--md, --[no-]markdown`
178
+ Format output with Markdown.
179
+
180
+ ```bash
181
+ # Enable Markdown formatting
182
+ aia --markdown my_prompt
183
+
184
+ # Disable Markdown formatting
185
+ aia --no-markdown my_prompt
186
+ ```
187
+
188
+ ## Prompt Options
189
+
190
+ ### `--prompts_dir DIR`
191
+ Directory containing prompt files.
192
+
193
+ ```bash
194
+ aia --prompts_dir /custom/prompts my_prompt
195
+ aia --prompts_dir ~/work/prompts my_prompt
196
+ ```
197
+
198
+ ### `--roles_prefix PREFIX`
199
+ Subdirectory name for role files (default: `roles`).
200
+
201
+ ```bash
202
+ # Use custom roles directory
203
+ aia --roles_prefix personas --role expert
204
+
205
+ # Results in looking for roles in ~/.prompts/personas/expert.txt
206
+ ```
207
+
208
+ ### `-r, --role ROLE_ID`
209
+ Role ID to prepend to the prompt.
210
+
211
+ ```bash
212
+ aia --role expert my_prompt
213
+ aia -r teacher explain_concept
214
+ ```
215
+
216
+ ### `-n, --next PROMPT_ID`
217
+ Next prompt to process (can be used multiple times to build a pipeline).
218
+
219
+ ```bash
220
+ aia my_prompt --next second_prompt --next third_prompt
221
+ aia -n analysis -n summary my_prompt
222
+ ```
223
+
224
+ ### `-p PROMPTS, --pipeline PROMPTS`
225
+ Pipeline of comma-separated prompt IDs to process.
226
+
227
+ ```bash
228
+ aia --pipeline "analysis,summary,report" my_data
229
+ aia -p "review,optimize,test" my_code.py
230
+ ```
231
+
232
+ ### `-x, --[no-]exec`
233
+ Designate an executable prompt file.
234
+
235
+ ```bash
236
+ # Treat prompt as executable
237
+ aia --exec my_script_prompt
238
+
239
+ # Treat as regular prompt (default)
240
+ aia --no-exec my_script_prompt
241
+ ```
242
+
243
+ ### `--system_prompt PROMPT_ID`
244
+ System prompt ID to use for chat sessions.
245
+
246
+ ```bash
247
+ aia --system_prompt helpful_assistant --chat
248
+ aia --system_prompt code_expert --chat my_code.py
249
+ ```
250
+
251
+ ### `--regex PATTERN`
252
+ Regex pattern to extract parameters from prompt text.
253
+
254
+ ```bash
255
+ aia --regex '\{\{(\w+)\}\}' my_template_prompt
256
+ aia --regex '<%=\s*(\w+)\s*%>' erb_prompt
257
+ ```
258
+
259
+ ## AI Parameters
260
+
261
+ ### `-t, --temperature TEMP`
262
+ Temperature for text generation (0.0 to 2.0). Higher values make output more creative and random.
263
+
264
+ ```bash
265
+ # Conservative/focused
266
+ aia --temperature 0.1 analysis_prompt
267
+
268
+ # Balanced (default ~0.7)
269
+ aia --temperature 0.7 my_prompt
270
+
271
+ # Creative
272
+ aia --temperature 1.5 creative_writing
273
+
274
+ # Very creative
275
+ aia -t 2.0 brainstorm_ideas
276
+ ```
277
+
278
+ ### `--max_tokens TOKENS`
279
+ Maximum tokens for text generation.
280
+
281
+ ```bash
282
+ aia --max_tokens 100 short_summary
283
+ aia --max_tokens 4000 detailed_analysis
284
+ ```
285
+
286
+ ### `--top_p VALUE`
287
+ Top-p sampling value (0.0 to 1.0). Alternative to temperature for controlling randomness.
288
+
289
+ ```bash
290
+ aia --top_p 0.1 precise_answer
291
+ aia --top_p 0.9 creative_response
292
+ ```
293
+
294
+ ### `--frequency_penalty VALUE`
295
+ Frequency penalty (-2.0 to 2.0). Positive values discourage repetition.
296
+
297
+ ```bash
298
+ # Discourage repetition
299
+ aia --frequency_penalty 0.5 my_prompt
300
+
301
+ # Encourage repetition
302
+ aia --frequency_penalty -0.5 my_prompt
303
+ ```
304
+
305
+ ### `--presence_penalty VALUE`
306
+ Presence penalty (-2.0 to 2.0). Positive values encourage discussing new topics.
307
+
308
+ ```bash
309
+ # Encourage new topics
310
+ aia --presence_penalty 0.5 broad_discussion
311
+
312
+ # Focus on current topics
313
+ aia --presence_penalty -0.5 deep_dive
314
+ ```
315
+
316
+ ## Audio/Image Options
317
+
318
+ ### `--speak`
319
+ Convert text to audio and play it. Uses the configured speech model and voice.
320
+
321
+ ```bash
322
+ aia --speak my_prompt
323
+ aia --speak --voice nova my_prompt
324
+ ```
325
+
326
+ ### `--voice VOICE`
327
+ Voice to use for speech synthesis.
328
+
329
+ ```bash
330
+ aia --voice alloy --speak my_prompt
331
+ aia --voice echo --speak my_prompt
332
+ aia --voice fable --speak my_prompt
333
+ aia --voice nova --speak my_prompt
334
+ aia --voice onyx --speak my_prompt
335
+ aia --voice shimmer --speak my_prompt
336
+ ```
337
+
338
+ ### `--is, --image_size SIZE`
339
+ Image size for image generation.
340
+
341
+ ```bash
342
+ aia --image_size 1024x1024 image_prompt
343
+ aia --is 1792x1024 wide_image
344
+ aia --is 1024x1792 tall_image
345
+ ```
346
+
347
+ **Common sizes**: `256x256`, `512x512`, `1024x1024`, `1792x1024`, `1024x1792`
348
+
349
+ ### `--iq, --image_quality QUALITY`
350
+ Image quality for image generation.
351
+
352
+ ```bash
353
+ aia --image_quality standard image_prompt
354
+ aia --iq hd high_quality_image
355
+ ```
356
+
357
+ **Values**: `standard`, `hd`
358
+
359
+ ### `--style, --image_style STYLE`
360
+ Style for image generation.
361
+
362
+ ```bash
363
+ aia --image_style vivid colorful_image
364
+ aia --style natural realistic_image
365
+ ```
366
+
367
+ **Values**: `vivid`, `natural`
368
+
369
+ ## Tool Options
370
+
371
+ ### `--rq LIBS, --require LIBS`
372
+ Ruby libraries to require for Ruby directive execution.
373
+
374
+ ```bash
375
+ aia --require json,csv data_processing_prompt
376
+ aia --rq "net/http,uri" web_request_prompt
377
+ ```
378
+
379
+ ### `--tools PATH_LIST`
380
+ Add tool file(s) or directories. Comma-separated paths.
381
+
382
+ ```bash
383
+ # Single tool file
384
+ aia --tools ./my_tool.rb my_prompt
385
+
386
+ # Multiple tools
387
+ aia --tools "./tool1.rb,./tool2.rb" my_prompt
388
+
389
+ # Tool directory
390
+ aia --tools ./tools/ my_prompt
391
+
392
+ # Mixed paths
393
+ aia --tools "./tools/,./special_tool.rb" my_prompt
394
+ ```
395
+
396
+ ### `--at, --allowed_tools TOOLS_LIST`
397
+ Allow only these tools to be used. Security feature to restrict tool access.
398
+
399
+ ```bash
400
+ # Allow specific tools
401
+ aia --allowed_tools "calculator,file_reader" my_prompt
402
+ aia --at "web_scraper,data_analyzer" analysis_prompt
403
+ ```
404
+
405
+ ### `--rt, --rejected_tools TOOLS_LIST`
406
+ Reject/block these tools from being used.
407
+
408
+ ```bash
409
+ # Block dangerous tools
410
+ aia --rejected_tools "file_writer,system_command" my_prompt
411
+ aia --rt "network_access" secure_prompt
412
+ ```
413
+
414
+ ## Utility Options
415
+
416
+ ### `-d, --debug`
417
+ Enable debug output for troubleshooting.
418
+
419
+ ```bash
420
+ aia --debug my_prompt
421
+ aia -d --chat
422
+ ```
423
+
424
+ ### `--no-debug`
425
+ Explicitly disable debug output.
426
+
427
+ ```bash
428
+ aia --no-debug my_prompt
429
+ ```
430
+
431
+ ### `-v, --[no-]verbose`
432
+ Enable/disable verbose output.
433
+
434
+ ```bash
435
+ # Verbose mode
436
+ aia --verbose my_prompt
437
+ aia -v my_prompt
438
+
439
+ # Quiet mode
440
+ aia --no-verbose my_prompt
441
+ ```
442
+
443
+ ### `--refresh DAYS`
444
+ Refresh models database interval in days.
445
+
446
+ ```bash
447
+ # Refresh immediately
448
+ aia --refresh 0
449
+
450
+ # Refresh weekly
451
+ aia --refresh 7
452
+
453
+ # Refresh monthly
454
+ aia --refresh 30
455
+ ```
456
+
457
+ ### `--dump FILE`
458
+ Dump current configuration to a file for inspection or backup.
459
+
460
+ ```bash
461
+ aia --dump current_config.yaml
462
+ aia --dump /tmp/aia_config_backup.yml
463
+ ```
464
+
465
+ ### `--completion SHELL`
466
+ Show completion script for shell integration.
467
+
468
+ ```bash
469
+ # Bash completion
470
+ aia --completion bash > ~/.bash_completion.d/aia
471
+
472
+ # Zsh completion
473
+ aia --completion zsh > ~/.zsh/completions/_aia
474
+
475
+ # Fish completion
476
+ aia --completion fish > ~/.config/fish/completions/aia.fish
477
+ ```
478
+
479
+ **Supported shells**: `bash`, `zsh`, `fish`
480
+
481
+ ### `--version`
482
+ Show AIA version and exit.
483
+
484
+ ```bash
485
+ aia --version
486
+ ```
487
+
488
+ ### `-h, --help`
489
+ Show help message and exit.
490
+
491
+ ```bash
492
+ aia --help
493
+ aia -h
494
+ ```
495
+
496
+ ## Usage Examples
497
+
498
+ ### Basic Examples
499
+
500
+ ```bash
501
+ # Simple prompt execution
502
+ aia hello_world
503
+
504
+ # Chat mode
505
+ aia --chat
506
+
507
+ # Use specific model
508
+ aia --model gpt-4 code_review my_script.py
509
+
510
+ # Fuzzy prompt selection
511
+ aia --fuzzy
512
+ ```
513
+
514
+ ### Advanced Examples
515
+
516
+ ```bash
517
+ # Multi-model consensus
518
+ aia --model "gpt-4,claude-3-sonnet" --consensus analysis_prompt data.csv
519
+
520
+ # Creative writing with voice output
521
+ aia --model gpt-4 --temperature 1.2 --speak --voice nova story_prompt
522
+
523
+ # Secure tool usage
524
+ aia --tools ./safe_tools/ --allowed_tools "calculator,file_reader" --rejected_tools "system_command" analysis_prompt
525
+
526
+ # Pipeline with custom configuration
527
+ aia --pipeline "extract,analyze,summarize" --temperature 0.3 --max_tokens 2000 --out_file report.md data_source.txt
528
+
529
+ # Debug mode with verbose output
530
+ aia --debug --verbose --model claude-3-sonnet problematic_prompt
531
+ ```
532
+
533
+ ### Configuration Examples
534
+
535
+ ```bash
536
+ # Use custom configuration
537
+ aia --config_file ./project_config.yml --prompts_dir ./project_prompts/ my_prompt
538
+
539
+ # Save output with markdown formatting
540
+ aia --out_file analysis.md --markdown --append data_analysis dataset.csv
541
+
542
+ # Audio processing
543
+ aia --transcription_model whisper-1 --speech_model tts-1-hd --voice echo audio_prompt audio_file.wav
544
+ ```
545
+
546
+ ## Exit Codes
547
+
548
+ - `0` - Success
549
+ - `1` - General error (invalid arguments, file not found, etc.)
550
+ - `2` - Configuration error
551
+ - `3` - Model/API error
552
+ - `4` - Tool execution error
553
+
554
+ ## Environment Variables
555
+
556
+ Many CLI options have corresponding environment variables with the `AIA_` prefix:
557
+
558
+ ```bash
559
+ export AIA_MODEL="gpt-4"
560
+ export AIA_TEMPERATURE="0.8"
561
+ export AIA_PROMPTS_DIR="/custom/prompts"
562
+ export AIA_VERBOSE="true"
563
+ export AIA_DEBUG="false"
564
+ ```
565
+
566
+ See [Configuration](configuration.md#environment-variables) for a complete list.
567
+
568
+ ## Configuration Precedence
569
+
570
+ Options are resolved in this order (highest to lowest precedence):
571
+
572
+ 1. Command line arguments
573
+ 2. Environment variables
574
+ 3. Configuration files
575
+ 4. Built-in defaults
576
+
577
+ ## Related Documentation
578
+
579
+ - [Configuration Guide](configuration.md) - Detailed configuration options
580
+ - [Getting Started](guides/getting-started.md) - Basic usage tutorial
581
+ - [Advanced Prompting](advanced-prompting.md) - Advanced usage patterns
582
+ - [Directives Reference](directives-reference.md) - Prompt directive reference