aia 0.9.23 → 0.10.2

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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/.version +1 -1
  3. data/CHANGELOG.md +95 -3
  4. data/README.md +187 -60
  5. data/bin/aia +6 -0
  6. data/docs/cli-reference.md +145 -72
  7. data/docs/configuration.md +156 -19
  8. data/docs/directives-reference.md +28 -8
  9. data/docs/examples/tools/index.md +2 -2
  10. data/docs/faq.md +11 -11
  11. data/docs/guides/available-models.md +11 -11
  12. data/docs/guides/basic-usage.md +18 -17
  13. data/docs/guides/chat.md +57 -11
  14. data/docs/guides/executable-prompts.md +15 -15
  15. data/docs/guides/first-prompt.md +2 -2
  16. data/docs/guides/getting-started.md +6 -6
  17. data/docs/guides/image-generation.md +24 -24
  18. data/docs/guides/local-models.md +2 -2
  19. data/docs/guides/models.md +96 -18
  20. data/docs/guides/tools.md +4 -4
  21. data/docs/index.md +2 -2
  22. data/docs/installation.md +2 -2
  23. data/docs/prompt_management.md +11 -11
  24. data/docs/security.md +3 -3
  25. data/docs/workflows-and-pipelines.md +1 -1
  26. data/examples/README.md +6 -6
  27. data/examples/headlines +3 -3
  28. data/lib/aia/aia_completion.bash +2 -2
  29. data/lib/aia/aia_completion.fish +4 -4
  30. data/lib/aia/aia_completion.zsh +2 -2
  31. data/lib/aia/chat_processor_service.rb +31 -21
  32. data/lib/aia/config/cli_parser.rb +403 -403
  33. data/lib/aia/config/config_section.rb +87 -0
  34. data/lib/aia/config/defaults.yml +219 -0
  35. data/lib/aia/config/defaults_loader.rb +147 -0
  36. data/lib/aia/config/mcp_parser.rb +151 -0
  37. data/lib/aia/config/model_spec.rb +67 -0
  38. data/lib/aia/config/validator.rb +185 -136
  39. data/lib/aia/config.rb +336 -17
  40. data/lib/aia/directive_processor.rb +14 -6
  41. data/lib/aia/directives/checkpoint.rb +283 -0
  42. data/lib/aia/directives/configuration.rb +27 -98
  43. data/lib/aia/directives/models.rb +15 -9
  44. data/lib/aia/directives/registry.rb +2 -0
  45. data/lib/aia/directives/utility.rb +25 -9
  46. data/lib/aia/directives/web_and_file.rb +50 -47
  47. data/lib/aia/logger.rb +328 -0
  48. data/lib/aia/prompt_handler.rb +18 -22
  49. data/lib/aia/ruby_llm_adapter.rb +584 -65
  50. data/lib/aia/session.rb +49 -156
  51. data/lib/aia/topic_context.rb +125 -0
  52. data/lib/aia/ui_presenter.rb +20 -16
  53. data/lib/aia/utility.rb +50 -18
  54. data/lib/aia.rb +91 -66
  55. data/lib/extensions/ruby_llm/modalities.rb +2 -0
  56. data/mcp_servers/apple-mcp.json +8 -0
  57. data/mcp_servers/mcp_server_chart.json +11 -0
  58. data/mcp_servers/playwright_one.json +8 -0
  59. data/mcp_servers/playwright_two.json +8 -0
  60. data/mcp_servers/tavily_mcp_server.json +8 -0
  61. metadata +85 -26
  62. data/lib/aia/config/base.rb +0 -288
  63. data/lib/aia/config/defaults.rb +0 -91
  64. data/lib/aia/config/file_loader.rb +0 -163
  65. data/lib/aia/context_manager.rb +0 -134
  66. data/mcp_servers/imcp.json +0 -7
  67. data/mcp_servers/launcher.json +0 -11
  68. data/mcp_servers/timeserver.json +0 -8
data/lib/aia.rb CHANGED
@@ -21,14 +21,20 @@ DebugMeDefaultOptions[:skip1] = true
21
21
  require_relative 'extensions/openstruct_merge' # adds self.merge self.get_value
22
22
  require_relative 'extensions/ruby_llm/modalities' # adds model.modalities.text_to_text? etc.
23
23
 
24
- require_relative 'refinements/string.rb' # adds #include_any? #include_all?
25
-
26
-
27
-
24
+ require_relative 'refinements/string' # adds #include_any? #include_all?
28
25
 
29
26
  require_relative 'aia/utility'
30
27
  require_relative 'aia/version'
31
28
  require_relative 'aia/config'
29
+ require_relative 'aia/logger'
30
+
31
+ # Top-level logger method available anywhere in the application
32
+ def logger
33
+ AIA::LoggerManager.aia_logger
34
+ end
35
+
36
+ require_relative 'aia/config/cli_parser'
37
+ require_relative 'aia/config/validator'
32
38
  require_relative 'aia/prompt_handler'
33
39
  require_relative 'aia/ruby_llm_adapter'
34
40
  require_relative 'aia/directive_processor'
@@ -41,86 +47,105 @@ require_relative 'aia/session'
41
47
  # provides an interface for interacting with AI models and managing prompts.
42
48
  module AIA
43
49
  at_exit do
44
- STDERR.puts "Exiting AIA application..."
45
- # Clean up temporary STDIN file if it exists
46
- if @config&.stdin_temp_file && File.exist?(@config.stdin_temp_file)
47
- File.unlink(@config.stdin_temp_file)
48
- end
50
+ warn 'Exiting AIA application...'
49
51
  end
50
52
 
51
53
  @config = nil
54
+ @client = nil
52
55
 
53
- def self.config
54
- @config
55
- end
56
+ class << self
57
+ attr_accessor :config, :client
56
58
 
57
- def self.client
58
- @config.client
59
- end
59
+ def good_file?(filename)
60
+ File.exist?(filename) &&
61
+ File.readable?(filename) &&
62
+ !File.directory?(filename)
63
+ end
60
64
 
61
- def self.client=(client)
62
- @config.client = client
63
- end
64
65
 
65
- def self.good_file?(filename)
66
- File.exist?(filename) &&
67
- File.readable?(filename) &&
68
- !File.directory?(filename)
69
- end
66
+ def bad_file?(filename)
67
+ !good_file?(filename)
68
+ end
70
69
 
71
- def self.bad_file?(filename)
72
- !good_file?(filename)
73
- end
74
70
 
75
- def self.build_flags
76
- @config.each_pair do |key, value|
77
- if [TrueClass, FalseClass].include?(value.class)
78
- define_singleton_method("#{key}?") do
79
- @config[key]
80
- end
81
- end
71
+ # Convenience flag accessors (delegate to config.flags section)
72
+ def chat?
73
+ @config&.flags&.chat == true
82
74
  end
83
- end
84
75
 
85
- def self.run
86
- @config = Config.setup
87
76
 
88
- build_flags
77
+ def debug?
78
+ @config&.flags&.debug == true
79
+ end
89
80
 
90
- # Load Fzf if fuzzy search is enabled and fzf is installed
91
- if @config.fuzzy
92
- begin
93
- # Cache fzf availability check for better performance
94
- if system('which fzf >/dev/null 2>&1')
95
- require_relative 'aia/fzf'
96
- else
97
- warn "Warning: Fuzzy search enabled but fzf not found. Install fzf for enhanced search capabilities."
98
- end
99
- rescue StandardError => e
100
- warn "Warning: Failed to load fzf: #{e.message}"
101
- end
81
+
82
+ def verbose?
83
+ @config&.flags&.verbose == true
84
+ end
85
+
86
+
87
+ def fuzzy?
88
+ @config&.flags&.fuzzy == true
89
+ end
90
+
91
+
92
+ def terse?
93
+ @config&.flags&.terse == true
94
+ end
95
+
96
+
97
+ def speak?
98
+ @config&.flags&.speak == true
99
+ end
100
+
101
+
102
+ def append?
103
+ @config&.output&.append == true
102
104
  end
103
105
 
104
- prompt_handler = PromptHandler.new
105
106
 
106
- # Initialize the appropriate client adapter based on configuration
107
- @config.client = if 'ruby_llm' == @config.adapter
108
- RubyLLMAdapter.new
109
- else
110
- # TODO: ?? some other LLM API wrapper
111
- STDERR.puts "ERROR: There is no adapter for #{@config.adapter}"
112
- exit 1
113
- end
107
+ def run
108
+ # Parse CLI arguments
109
+ cli_overrides = CLIParser.parse
114
110
 
115
- # There are two kinds of sessions: batch and chat
116
- # A chat session is started when the --chat CLI option is used
117
- # BUT its also possible to start a chat session with an initial prompt AND
118
- # within that initial prompt there can be a workflow (aka pipeline)
119
- # defined. If that is the case, then the chat session will not start
120
- # until the initial prompt has completed its workflow.
111
+ # Create config with CLI overrides
112
+ @config = Config.setup(cli_overrides)
121
113
 
122
- session = Session.new(prompt_handler)
114
+ # Validate and tailor configuration (handles --dump early exit)
115
+ ConfigValidator.tailor(@config)
123
116
 
124
- session.start
117
+ # Load Fzf if fuzzy search is enabled and fzf is installed
118
+ if @config.flags.fuzzy
119
+ begin
120
+ if system('which fzf >/dev/null 2>&1')
121
+ require_relative 'aia/fzf'
122
+ else
123
+ warn 'Warning: Fuzzy search enabled but fzf not found. Install fzf for enhanced search capabilities.'
124
+ end
125
+ rescue StandardError => e
126
+ warn "Warning: Failed to load fzf: #{e.message}"
127
+ end
128
+ end
129
+
130
+ prompt_handler = PromptHandler.new
131
+
132
+ # Initialize the appropriate client adapter based on configuration
133
+ @client = if 'ruby_llm' == @config.llm.adapter
134
+ RubyLLMAdapter.new
135
+ else
136
+ warn "ERROR: There is no adapter for #{@config.llm.adapter}"
137
+ exit 1
138
+ end
139
+
140
+ # There are two kinds of sessions: batch and chat
141
+ # A chat session is started when the --chat CLI option is used
142
+ # BUT its also possible to start a chat session with an initial prompt AND
143
+ # within that initial prompt there can be a workflow (aka pipeline)
144
+ # defined. If that is the case, then the chat session will not start
145
+ # until the initial prompt has completed its workflow.
146
+
147
+ session = Session.new(prompt_handler)
148
+ session.start
149
+ end
125
150
  end
126
151
  end
@@ -1,5 +1,7 @@
1
1
  # lib/extensions/ruby_llm/modalities.rb
2
2
 
3
+ require 'ruby_llm'
4
+
3
5
  class RubyLLM::Model::Modalities
4
6
  #
5
7
  def text_to_text? = input.include?('text') && output.include?('text')
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "apple-mcp": {
4
+ "command": "npx",
5
+ "args": ["-y", "apple-mcp"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "mcp-server-chart": {
4
+ "command": "npx",
5
+ "args": [
6
+ "-y",
7
+ "@antv/mcp-server-chart"
8
+ ]
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "playwright": {
4
+ "command": "npx",
5
+ "args": ["@playwright/mcp"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "playwright": {
4
+ "command": "npx",
5
+ "args": ["@executeautomation/playwright-mcp-server"]
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "tavily-remote-mcp": {
4
+ "command": "npx -y mcp-remote https://mcp.tavily.com/mcp/?tavilyApiKey=$TAVILY_API_KEY",
5
+ "env": {}
6
+ }
7
+ }
8
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.23
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer
@@ -10,7 +10,21 @@ cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
- name: activesupport
13
+ name: anyway_config
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '2.6'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '2.6'
26
+ - !ruby/object:Gem::Dependency
27
+ name: amazing_print
14
28
  requirement: !ruby/object:Gem::Requirement
15
29
  requirements:
16
30
  - - ">="
@@ -24,7 +38,7 @@ dependencies:
24
38
  - !ruby/object:Gem::Version
25
39
  version: '0'
26
40
  - !ruby/object:Gem::Dependency
27
- name: amazing_print
41
+ name: async
28
42
  requirement: !ruby/object:Gem::Requirement
29
43
  requirements:
30
44
  - - ">="
@@ -38,7 +52,7 @@ dependencies:
38
52
  - !ruby/object:Gem::Version
39
53
  version: '0'
40
54
  - !ruby/object:Gem::Dependency
41
- name: async
55
+ name: clipboard
42
56
  requirement: !ruby/object:Gem::Requirement
43
57
  requirements:
44
58
  - - ">="
@@ -52,7 +66,7 @@ dependencies:
52
66
  - !ruby/object:Gem::Version
53
67
  version: '0'
54
68
  - !ruby/object:Gem::Dependency
55
- name: clipboard
69
+ name: simple_flow
56
70
  requirement: !ruby/object:Gem::Requirement
57
71
  requirements:
58
72
  - - ">="
@@ -66,7 +80,7 @@ dependencies:
66
80
  - !ruby/object:Gem::Version
67
81
  version: '0'
68
82
  - !ruby/object:Gem::Dependency
69
- name: faraday
83
+ name: lumberjack
70
84
  requirement: !ruby/object:Gem::Requirement
71
85
  requirements:
72
86
  - - ">="
@@ -80,49 +94,49 @@ dependencies:
80
94
  - !ruby/object:Gem::Version
81
95
  version: '0'
82
96
  - !ruby/object:Gem::Dependency
83
- name: prompt_manager
97
+ name: faraday
84
98
  requirement: !ruby/object:Gem::Requirement
85
99
  requirements:
86
100
  - - ">="
87
101
  - !ruby/object:Gem::Version
88
- version: 0.5.8
102
+ version: '0'
89
103
  type: :runtime
90
104
  prerelease: false
91
105
  version_requirements: !ruby/object:Gem::Requirement
92
106
  requirements:
93
107
  - - ">="
94
108
  - !ruby/object:Gem::Version
95
- version: 0.5.8
109
+ version: '0'
96
110
  - !ruby/object:Gem::Dependency
97
- name: ruby_llm
111
+ name: prompt_manager
98
112
  requirement: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - ">="
101
115
  - !ruby/object:Gem::Version
102
- version: 1.9.1
116
+ version: '0'
103
117
  type: :runtime
104
118
  prerelease: false
105
119
  version_requirements: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - ">="
108
122
  - !ruby/object:Gem::Version
109
- version: 1.9.1
123
+ version: '0'
110
124
  - !ruby/object:Gem::Dependency
111
- name: ruby_llm-mcp
125
+ name: ruby_llm
112
126
  requirement: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - ">="
115
129
  - !ruby/object:Gem::Version
116
- version: 0.8.0
130
+ version: '0'
117
131
  type: :runtime
118
132
  prerelease: false
119
133
  version_requirements: !ruby/object:Gem::Requirement
120
134
  requirements:
121
135
  - - ">="
122
136
  - !ruby/object:Gem::Version
123
- version: 0.8.0
137
+ version: '0'
124
138
  - !ruby/object:Gem::Dependency
125
- name: reline
139
+ name: ruby_llm-mcp
126
140
  requirement: !ruby/object:Gem::Requirement
127
141
  requirements:
128
142
  - - ">="
@@ -136,7 +150,7 @@ dependencies:
136
150
  - !ruby/object:Gem::Version
137
151
  version: '0'
138
152
  - !ruby/object:Gem::Dependency
139
- name: shellwords
153
+ name: reline
140
154
  requirement: !ruby/object:Gem::Requirement
141
155
  requirements:
142
156
  - - ">="
@@ -150,7 +164,7 @@ dependencies:
150
164
  - !ruby/object:Gem::Version
151
165
  version: '0'
152
166
  - !ruby/object:Gem::Dependency
153
- name: toml-rb
167
+ name: shellwords
154
168
  requirement: !ruby/object:Gem::Requirement
155
169
  requirements:
156
170
  - - ">="
@@ -421,13 +435,15 @@ files:
421
435
  - lib/aia/aia_completion.zsh
422
436
  - lib/aia/chat_processor_service.rb
423
437
  - lib/aia/config.rb
424
- - lib/aia/config/base.rb
425
438
  - lib/aia/config/cli_parser.rb
426
- - lib/aia/config/defaults.rb
427
- - lib/aia/config/file_loader.rb
439
+ - lib/aia/config/config_section.rb
440
+ - lib/aia/config/defaults.yml
441
+ - lib/aia/config/defaults_loader.rb
442
+ - lib/aia/config/mcp_parser.rb
443
+ - lib/aia/config/model_spec.rb
428
444
  - lib/aia/config/validator.rb
429
- - lib/aia/context_manager.rb
430
445
  - lib/aia/directive_processor.rb
446
+ - lib/aia/directives/checkpoint.rb
431
447
  - lib/aia/directives/configuration.rb
432
448
  - lib/aia/directives/execution.rb
433
449
  - lib/aia/directives/models.rb
@@ -436,9 +452,11 @@ files:
436
452
  - lib/aia/directives/web_and_file.rb
437
453
  - lib/aia/fzf.rb
438
454
  - lib/aia/history_manager.rb
455
+ - lib/aia/logger.rb
439
456
  - lib/aia/prompt_handler.rb
440
457
  - lib/aia/ruby_llm_adapter.rb
441
458
  - lib/aia/session.rb
459
+ - lib/aia/topic_context.rb
442
460
  - lib/aia/ui_presenter.rb
443
461
  - lib/aia/utility.rb
444
462
  - lib/aia/version.rb
@@ -449,11 +467,13 @@ files:
449
467
  - lib/refinements/string.rb
450
468
  - main.just
451
469
  - mcp_servers/README.md
470
+ - mcp_servers/apple-mcp.json
452
471
  - mcp_servers/filesystem.json
453
- - mcp_servers/imcp.json
454
- - mcp_servers/launcher.json
472
+ - mcp_servers/mcp_server_chart.json
473
+ - mcp_servers/playwright_one.json
455
474
  - mcp_servers/playwright_server_definition.json
456
- - mcp_servers/timeserver.json
475
+ - mcp_servers/playwright_two.json
476
+ - mcp_servers/tavily_mcp_server.json
457
477
  - mkdocs.yml
458
478
  homepage: https://github.com/MadBomber/aia
459
479
  licenses:
@@ -463,6 +483,44 @@ metadata:
463
483
  homepage_uri: https://github.com/MadBomber/aia
464
484
  source_code_uri: https://github.com/MadBomber/aia
465
485
  changelog_uri: https://github.com/MadBomber/aia
486
+ post_install_message: |2+
487
+
488
+ ╔══════════════════════════════════════════════════════════════╗
489
+ ║ AIA — AI Assistant Installed! ║
490
+ ╚══════════════════════════════════════════════════════════════╝
491
+
492
+ ⚠ Note: v0.10+ has breaking changes in config file format and
493
+ environment variable names. See docs for details.
494
+
495
+ Multi-model AI from your command line. 20+ providers supported.
496
+
497
+ Quick Start:
498
+ aia --help Show all options
499
+ aia --chat Start an interactive chat session
500
+ aia --fuzzy Select a prompt with fuzzy finder
501
+ aia my_prompt_file Run saved prompt(s) in batch mode
502
+
503
+ Setup:
504
+ 1. Set your API key(s): export OPENAI_API_KEY=your_key
505
+ export ANTHROPIC_API_KEY=your_key
506
+ ... etc.
507
+ 2. Create prompts dir: mkdir -p ~/.prompts
508
+ 3. Initialize config: aia --dump ~/.config/aia/aia.yml
509
+
510
+ Key Features:
511
+ • Dynamic prompts with embedded directives (//include, //shell)
512
+ • Consensus mode: run multiple models, get unified responses
513
+ • Shell & Ruby (ERB) integration in prompts
514
+ • Tool callbacks via RubyLLM::Tool
515
+ • MCP Integration via RubyLLM::MCP
516
+ • Session history and checkpoints
517
+ • Pipeline workflows
518
+ • Concurrently run the same prompt against multiple models
519
+ • Get cost estimates for prompts against multiple models
520
+
521
+ Documentation: https://madbomber.github.io/aia
522
+ Source Code: https://github.com/MadBomber/aia
523
+
466
524
  rdoc_options: []
467
525
  require_paths:
468
526
  - lib
@@ -477,8 +535,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
477
535
  - !ruby/object:Gem::Version
478
536
  version: '0'
479
537
  requirements: []
480
- rubygems_version: 4.0.0
538
+ rubygems_version: 4.0.3
481
539
  specification_version: 4
482
540
  summary: Multi-model AI CLI with dynamic prompts, consensus responses, shell & Ruby
483
541
  integration, and seamless chat workflows.
484
542
  test_files: []
543
+ ...