aia 0.9.24 → 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.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/CHANGELOG.md +84 -3
- data/README.md +179 -59
- data/bin/aia +6 -0
- data/docs/cli-reference.md +145 -72
- data/docs/configuration.md +156 -19
- data/docs/examples/tools/index.md +2 -2
- data/docs/faq.md +11 -11
- data/docs/guides/available-models.md +11 -11
- data/docs/guides/basic-usage.md +18 -17
- data/docs/guides/chat.md +57 -11
- data/docs/guides/executable-prompts.md +15 -15
- data/docs/guides/first-prompt.md +2 -2
- data/docs/guides/getting-started.md +6 -6
- data/docs/guides/image-generation.md +24 -24
- data/docs/guides/local-models.md +2 -2
- data/docs/guides/models.md +96 -18
- data/docs/guides/tools.md +4 -4
- data/docs/installation.md +2 -2
- data/docs/prompt_management.md +11 -11
- data/docs/security.md +3 -3
- data/docs/workflows-and-pipelines.md +1 -1
- data/examples/README.md +6 -6
- data/examples/headlines +3 -3
- data/lib/aia/aia_completion.bash +2 -2
- data/lib/aia/aia_completion.fish +4 -4
- data/lib/aia/aia_completion.zsh +2 -2
- data/lib/aia/chat_processor_service.rb +31 -21
- data/lib/aia/config/cli_parser.rb +403 -403
- data/lib/aia/config/config_section.rb +87 -0
- data/lib/aia/config/defaults.yml +219 -0
- data/lib/aia/config/defaults_loader.rb +147 -0
- data/lib/aia/config/mcp_parser.rb +151 -0
- data/lib/aia/config/model_spec.rb +67 -0
- data/lib/aia/config/validator.rb +185 -136
- data/lib/aia/config.rb +336 -17
- data/lib/aia/directive_processor.rb +14 -6
- data/lib/aia/directives/configuration.rb +24 -10
- data/lib/aia/directives/models.rb +3 -4
- data/lib/aia/directives/utility.rb +3 -2
- data/lib/aia/directives/web_and_file.rb +50 -47
- data/lib/aia/logger.rb +328 -0
- data/lib/aia/prompt_handler.rb +18 -22
- data/lib/aia/ruby_llm_adapter.rb +572 -69
- data/lib/aia/session.rb +9 -8
- data/lib/aia/ui_presenter.rb +20 -16
- data/lib/aia/utility.rb +50 -18
- data/lib/aia.rb +91 -66
- data/lib/extensions/ruby_llm/modalities.rb +2 -0
- data/mcp_servers/apple-mcp.json +8 -0
- data/mcp_servers/mcp_server_chart.json +11 -0
- data/mcp_servers/playwright_one.json +8 -0
- data/mcp_servers/playwright_two.json +8 -0
- data/mcp_servers/tavily_mcp_server.json +8 -0
- metadata +83 -25
- data/lib/aia/config/base.rb +0 -308
- data/lib/aia/config/defaults.rb +0 -91
- data/lib/aia/config/file_loader.rb +0 -163
- data/mcp_servers/imcp.json +0 -7
- data/mcp_servers/launcher.json +0 -11
- data/mcp_servers/timeserver.json +0 -8
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
# lib/aia/config/file_loader.rb
|
|
2
|
-
|
|
3
|
-
require 'yaml'
|
|
4
|
-
require 'toml-rb'
|
|
5
|
-
require 'erb'
|
|
6
|
-
require 'date'
|
|
7
|
-
|
|
8
|
-
module AIA
|
|
9
|
-
module ConfigModules
|
|
10
|
-
module FileLoader
|
|
11
|
-
class << self
|
|
12
|
-
def load_config_file(file, config)
|
|
13
|
-
if File.exist?(file)
|
|
14
|
-
ext = File.extname(file).downcase
|
|
15
|
-
content = File.read(file)
|
|
16
|
-
|
|
17
|
-
# Process ERB if filename ends with .erb
|
|
18
|
-
if file.end_with?('.erb')
|
|
19
|
-
content = ERB.new(content).result
|
|
20
|
-
file = file.chomp('.erb')
|
|
21
|
-
File.write(file, content)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
file_config = case ext
|
|
25
|
-
when '.yml', '.yaml'
|
|
26
|
-
YAML.safe_load(content, permitted_classes: [Symbol], symbolize_names: true)
|
|
27
|
-
when '.toml'
|
|
28
|
-
TomlRB.parse(content)
|
|
29
|
-
else
|
|
30
|
-
raise "Unsupported config file format: #{ext}"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
file_config.each do |key, value|
|
|
34
|
-
config[key.to_sym] = value
|
|
35
|
-
end
|
|
36
|
-
else
|
|
37
|
-
raise "Config file not found: #{file}"
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def cf_options(file)
|
|
42
|
-
config = OpenStruct.new
|
|
43
|
-
|
|
44
|
-
if File.exist?(file)
|
|
45
|
-
content = read_and_process_config_file(file)
|
|
46
|
-
file_config = parse_config_content(content, File.extname(file).downcase)
|
|
47
|
-
apply_file_config_to_struct(config, file_config)
|
|
48
|
-
else
|
|
49
|
-
STDERR.puts "WARNING:Config file not found: #{file}"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
normalize_last_refresh_date(config)
|
|
53
|
-
config
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def read_and_process_config_file(file)
|
|
57
|
-
content = File.read(file)
|
|
58
|
-
|
|
59
|
-
# Process ERB if filename ends with .erb
|
|
60
|
-
if file.end_with?('.erb')
|
|
61
|
-
content = ERB.new(content).result
|
|
62
|
-
processed_file = file.chomp('.erb')
|
|
63
|
-
File.write(processed_file, content)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
content
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def parse_config_content(content, ext)
|
|
70
|
-
case ext
|
|
71
|
-
when '.yml', '.yaml'
|
|
72
|
-
YAML.safe_load(content, permitted_classes: [Symbol], symbolize_names: true)
|
|
73
|
-
when '.toml'
|
|
74
|
-
TomlRB.parse(content)
|
|
75
|
-
else
|
|
76
|
-
raise "Unsupported config file format: #{ext}"
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def apply_file_config_to_struct(config, file_config)
|
|
81
|
-
file_config.each do |key, value|
|
|
82
|
-
# Special handling for model array with roles (ADR-005 v2)
|
|
83
|
-
if (key == :model || key == 'model') && value.is_a?(Array) && value.first.is_a?(Hash)
|
|
84
|
-
config[:model] = process_model_array_with_roles(value)
|
|
85
|
-
else
|
|
86
|
-
config[key] = value
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# Process model array with roles from config file (ADR-005 v2)
|
|
92
|
-
# Format: [{model: "gpt-4o", role: "architect"}, ...]
|
|
93
|
-
# Also supports models without roles: [{model: "gpt-4o"}, ...]
|
|
94
|
-
def process_model_array_with_roles(models_array)
|
|
95
|
-
return [] if models_array.nil? || models_array.empty?
|
|
96
|
-
|
|
97
|
-
model_specs = []
|
|
98
|
-
model_counts = Hash.new(0)
|
|
99
|
-
|
|
100
|
-
models_array.each do |spec|
|
|
101
|
-
model_name = spec[:model] || spec['model']
|
|
102
|
-
role_name = spec[:role] || spec['role']
|
|
103
|
-
|
|
104
|
-
model_counts[model_name] += 1
|
|
105
|
-
instance = model_counts[model_name]
|
|
106
|
-
|
|
107
|
-
model_specs << {
|
|
108
|
-
model: model_name,
|
|
109
|
-
role: role_name,
|
|
110
|
-
instance: instance,
|
|
111
|
-
internal_id: instance > 1 ? "#{model_name}##{instance}" : model_name
|
|
112
|
-
}
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
model_specs
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
def normalize_last_refresh_date(config)
|
|
119
|
-
return unless config.last_refresh&.is_a?(String)
|
|
120
|
-
|
|
121
|
-
config.last_refresh = Date.strptime(config.last_refresh, '%Y-%m-%d')
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
def dump_config(config, file)
|
|
125
|
-
# Implementation for config dump
|
|
126
|
-
ext = File.extname(file).downcase
|
|
127
|
-
|
|
128
|
-
config.last_refresh = config.last_refresh.to_s if config.last_refresh.is_a? Date
|
|
129
|
-
|
|
130
|
-
config_hash = config.to_h
|
|
131
|
-
|
|
132
|
-
# Remove prompt_id to prevent automatic initial pompting in --chat mode
|
|
133
|
-
config_hash.delete(:prompt_id)
|
|
134
|
-
|
|
135
|
-
# Remove dump_file key to prevent automatic exit on next load
|
|
136
|
-
config_hash.delete(:dump_file)
|
|
137
|
-
|
|
138
|
-
content = case ext
|
|
139
|
-
when '.yml', '.yaml'
|
|
140
|
-
YAML.dump(config_hash)
|
|
141
|
-
when '.toml'
|
|
142
|
-
TomlRB.dump(config_hash)
|
|
143
|
-
else
|
|
144
|
-
raise "Unsupported config file format: #{ext}"
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
File.write(file, content)
|
|
148
|
-
puts "Config successfully dumped to #{file}"
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
def generate_completion_script(shell)
|
|
152
|
-
script_path = File.join(File.dirname(__FILE__), "../../aia_completion.#{shell}")
|
|
153
|
-
|
|
154
|
-
if File.exist?(script_path)
|
|
155
|
-
puts File.read(script_path)
|
|
156
|
-
else
|
|
157
|
-
STDERR.puts "ERROR: The shell '#{shell}' is not supported or the completion script is missing."
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
end
|
data/mcp_servers/imcp.json
DELETED
data/mcp_servers/launcher.json
DELETED