aia 0.0.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,126 @@
1
+ ## Suggested Refactoring into Modules
2
+
3
+ ### ConfigurationModule
4
+
5
+ This module could encapsulate all the constants and environment-dependent settings.
6
+
7
+ ```ruby
8
+ module Configuration
9
+ HOME = Pathname.new(ENV['HOME'])
10
+ PROMPTS_DIR = Pathname.new(ENV['PROMPTS_DIR'] || (HOME + ".prompts_dir"))
11
+ AI_CLI_PROGRAM = "mods"
12
+ EDITOR = ENV['EDITOR'] || 'edit'
13
+ MY_NAME = Pathname.new(__FILE__).basename.to_s.split('.')[0]
14
+ MODS_MODEL = ENV['MODS_MODEL'] || 'gpt-4-1106-preview'
15
+ OUTPUT = Pathname.pwd + "temp.md"
16
+ PROMPT_LOG = PROMPTS_DIR + "_prompts.log"
17
+ USAGE = <<~EOUSAGE
18
+ AI Assistant (aia)
19
+ ==================
20
+ The AI cli program being used is: #{AI_CLI_PROGRAM}
21
+ You can pass additional CLI options to #{AI_CLI_PROGRAM} like this:
22
+ "#{MY_NAME} my options -- options for #{AI_CLI_PROGRAM}"
23
+ EOUSAGE
24
+ end
25
+ ```
26
+
27
+ ### OptionParsingModule
28
+
29
+ This module could manage the parsing of command-line arguments and configuring the options for the application.
30
+
31
+ ```ruby
32
+ module OptionParsing
33
+ def build_reader_methods
34
+ # ... method definition ...
35
+ end
36
+
37
+ def process_arguments
38
+ # ... method definition ...
39
+ end
40
+
41
+ def check_for(an_option)
42
+ # ... method definition ...
43
+ end
44
+
45
+ def process_option(option_sym, switches)
46
+ # ... method definition ...
47
+ end
48
+ end
49
+ ```
50
+
51
+ ### CommandLineInterfaceModule
52
+
53
+ This module would manage interactions with the command-line interface including editing of prompts and selection processes.
54
+
55
+ ```ruby
56
+ module CommandLineInterface
57
+ def keyword_value(kw, default)
58
+ # ... method definition ...
59
+ end
60
+
61
+ def handle_multiple_prompts(found_these, while_looking_for_this)
62
+ # ... method definition ...
63
+ end
64
+ end
65
+ ```
66
+
67
+ ### LoggingModule
68
+
69
+ Responsible for logging the results of the command.
70
+
71
+ ```ruby
72
+ module Logging
73
+ def write_to_log(answer)
74
+ # ... method definition ...
75
+ end
76
+ end
77
+ ```
78
+
79
+ ### AICommandModule
80
+
81
+ Manages the building and execution of the AI CLI command.
82
+
83
+ ```ruby
84
+ module AICommand
85
+ def setup_cli_program
86
+ # ... method definition ...
87
+ end
88
+
89
+ def build_command
90
+ # ... method definition ...
91
+ end
92
+
93
+ def execute_and_log_command(command)
94
+ # ... method definition ...
95
+ end
96
+ end
97
+ ```
98
+
99
+ ### PromptProcessingModule
100
+
101
+ Handles prompt retrieval, existing check, and keyword processing.
102
+
103
+ ```ruby
104
+ module PromptProcessing
105
+ def existing_prompt?(prompt_id)
106
+ # ... method definition ...
107
+ end
108
+
109
+ def process_prompt
110
+ # ... method definition ...
111
+ end
112
+
113
+ def replace_keywords
114
+ # ... method definition ...
115
+ end
116
+
117
+ def search_for_a_matching_prompt(prompt_id)
118
+ # ... method definition ...
119
+ end
120
+ end
121
+ ```
122
+
123
+ Each module should only contain the methods relevant to that module's purpose. After defining these modules, they can be included in the `AIA::Main` class where appropriate. Note that the method `get_prompt_id` didn't fit neatly into one of the outlined modules; it may remain in the main class or be included in a module if additional context becomes available or if it can be logically grouped with similar methods.
124
+
125
+ The `__END__` block and the Readline history management could be encapsulated into a separate module for terminal interactions if that block grows in complexity or moves out of the overall class definition.
126
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-24 00:00:00.000000000 Z
11
+ date: 2023-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prompt_manager
@@ -103,8 +103,28 @@ files:
103
103
  - bin/aia
104
104
  - bin/aia_completion.sh
105
105
  - lib/aia.rb
106
+ - lib/aia/cli.rb
107
+ - lib/aia/configuration.rb
108
+ - lib/aia/external.rb
109
+ - lib/aia/external/,keep
110
+ - lib/aia/external/.irbrc
111
+ - lib/aia/external/ag.rb
112
+ - lib/aia/external/bat.rb
113
+ - lib/aia/external/fzf.rb
114
+ - lib/aia/external/glow.rb
115
+ - lib/aia/external/mods.rb
116
+ - lib/aia/external/rg.rb
117
+ - lib/aia/external/sgpt.rb
118
+ - lib/aia/external/subl.rb
119
+ - lib/aia/external/temp.md
120
+ - lib/aia/external/tool.rb
121
+ - lib/aia/external_two.rb
122
+ - lib/aia/logging.rb
123
+ - lib/aia/main.rb
124
+ - lib/aia/prompt_processing.rb
106
125
  - lib/aia/version.rb
107
126
  - lib/core_ext/string_wrap.rb
127
+ - lib/modularization_plan.md
108
128
  homepage: https://github.com/MadBomber/aia
109
129
  licenses:
110
130
  - MIT