aia 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 926de232dae7c4e214ae72129e7da50bb4ca130388bc47e78d102ae4e5ddcfde
4
- data.tar.gz: 6b57f7aa93ef06246465a3e143f444b0cb61105f1fd775fbce791d0b46fabc7d
3
+ metadata.gz: 35bff72b31591194079e96f6e1dfab9dc76db90fda1f635e962377aeb77b5662
4
+ data.tar.gz: 60704012ba00cca73bdb6bb344a4207df189b97b5dc2d686a53215836c5d27d5
5
5
  SHA512:
6
- metadata.gz: dae3b2adb921947200e1cc819c6f3f3918251a1298a752ed9ee7b19da7a515e66e6f87b21402b30ab6e81e03769bdba9d73f23101b42ef87c9ca8a8f5a8baf62
7
- data.tar.gz: 5ba9e32129ab8331aec76ddcda9d81445835c28fefe308c5b27bb65fe1780c41f2d5f0727eb1702a0403da342c89892c6186fcd553d13587174a2ff5f0d5f6d8
6
+ metadata.gz: a7b3f5bb0bee380f3863bfe80599e8898e16143587d374db27f99d27a718433d9e6869da1a8f44207016185c0b28935b5c5edbaf45d939992ad58ecd65a68fa9
7
+ data.tar.gz: 3f4fd8f0707e55cfc2147090d55ff4c865eba8c14bb22bb07831b3e46653530c9800a8d69f148e978bcb763a91d47ac3b58c1f2ab19e387019d6537b9446059e
data/.semver CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 5
4
- :patch: 0
4
+ :patch: 2
5
5
  :special: ''
6
6
  :metadata: ''
data/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
1
  ## [Unreleased]
2
+
3
+ ## [0.5.2] 2024-01-13
4
+ - wrap response when its going to the terminal
5
+
6
+ ## [0.5.1] 2024-01-12
7
+ - removed a wicked puts "loaded" statement
8
+ - fixed missed code when the options were changed to --out_file and --log_file
9
+ - fixed completion functions by updating $PROMPT_DIR to $AIA_PROMPTS_DIR to match the documentation.
10
+
2
11
  ## [0.5.0] 2024-01-05
3
12
  - breaking changes:
4
13
  - changed `--config` to `--config_file`
data/README.md CHANGED
@@ -107,7 +107,8 @@ OPTIONS
107
107
  Invokes an editor on the prompt file. You can make changes to the prompt file,
108
108
  save it and the newly saved prompt will be processed by the backend.
109
109
 
110
- --shell This option tells aia to replace references to system environment variables in
110
+ --shell
111
+ This option tells aia to replace references to system environment variables in
111
112
  the prompt with the value of the envar. envars are like $HOME and ${HOME} in
112
113
  this example their occurance will be replaced by the value of ENV[‘HOME’].
113
114
  Also the dynamic shell command in the pattern $(shell command) will be executed
@@ -138,7 +139,7 @@ OPTIONS
138
139
  -b, --[no]-backend LLM TOOL
139
140
  Specify the backend prompt resolver - default is mods
140
141
 
141
- -c, --config PATH_TO_CONFIG_FILE
142
+ -c, --config_file PATH_TO_CONFIG_FILE
142
143
  Load Config File - default is nil
143
144
 
144
145
  -d, --debug
@@ -153,7 +154,7 @@ OPTIONS
153
154
  -h, --help
154
155
  Show Usage - default is false
155
156
 
156
- -l, --[no]-log PATH_TO_LOG_FILE
157
+ -l, --[no]-log_file PATH_TO_LOG_FILE
157
158
  Log FILEPATH - default is $HOME/.prompts/prompts.log
158
159
 
159
160
  -m, --[no]-markdown
@@ -208,9 +209,9 @@ OpenAI ACCOUNT IS REQUIRED
208
209
 
209
210
  USAGE NOTES
210
211
  aia is designed for flexibility, allowing users to pass prompt ids and context files
211
- as arguments. Some options change the behavior of the output, such as ---out_file for
212
- specifying a file or --no-out_file for disabling file output in favor of standard output
213
- (STDPIT).
212
+ as arguments. Some options change the behavior of the output, such as --out_file for
213
+ specifying a file or --no-out_file for disabling file output in favor of standard
214
+ output (STDPIT).
214
215
 
215
216
  The --completion option displays a script that enables prompt ID auto-completion for
216
217
  bash, zsh, or fish shells. It’s crucial to integrate the script into the shell’s
data/justfile CHANGED
@@ -69,6 +69,11 @@ project := "`basename $RR`"
69
69
  backup_envrc.rb
70
70
 
71
71
 
72
+ # Delete all mods saved conversations
73
+ mods_delete_all:
74
+ mods -l | awk '{print $1}' | xargs -I {} mods -d {}
75
+
76
+
72
77
  #################################################
73
78
  ## Private recipes
74
79
 
@@ -107,6 +112,7 @@ project := "`basename $RR`"
107
112
  module_repo := "/Users/dewayne/sandbox/git_repos/repo.just"
108
113
  module_gem := "/Users/dewayne/sandbox/git_repos/gem.just"
109
114
  module_version := "/Users/dewayne/just_modules/version.just"
115
+ module_git := "/Users/dewayne/just_modules/git.just"
110
116
 
111
117
 
112
118
  # Install Locally
@@ -180,3 +186,9 @@ alias inc := bump
180
186
  @version what='' args='':
181
187
  just -d . -f {{module_version}} {{what}} {{args}}
182
188
 
189
+
190
+
191
+ # Module git
192
+ @git what='' args='':
193
+ just -d . -f {{module_git}} {{what}} {{args}}
194
+
@@ -3,7 +3,7 @@
3
3
  # the bash shell
4
4
  #
5
5
  # This script assumes that the system environment
6
- # variable PROMPTS_DIR has been set correctly
6
+ # variable AIA_PROMPTS_DIR has been set correctly
7
7
 
8
8
  _aia_completion() {
9
9
  # The current word being completed
@@ -18,7 +18,7 @@ _aia_completion() {
18
18
  # Check if we are currently completing the option that requires prompt IDs
19
19
  if [[ "$prev_word" == "aia" ]]; then
20
20
  # Change directory to the prompts directory
21
- cd "$PROMPTS_DIR" || return
21
+ cd "$AIA_PROMPTS_DIR" || return
22
22
 
23
23
  # Generate a list of relative paths from the ~/.prompts directory (without .txt extension)
24
24
  local files=($(find . -name "*.txt" -type f | sed 's|^\./||' | sed 's/\.txt$//'))
@@ -2,7 +2,7 @@
2
2
  # Setup a prompt completion for use with the fish shell
3
3
  #
4
4
  # This script assumes that the system environment
5
- # variable PROMPTS_DIR has been set correctly
5
+ # variable AIA_PROMPTS_DIR has been set correctly
6
6
 
7
7
  function __fish_aia_complete
8
8
  # Get the command line and current token
@@ -12,9 +12,9 @@ function __fish_aia_complete
12
12
  # Check if we are currently completing the option that requires prompt IDs
13
13
  if set -q cmd_line[2]
14
14
  # Change directory to the prompts directory
15
- if test -d $PROMPTS_DIR
16
- pushd $PROMPTS_DIR
17
- # Generate completions based on .txt files in the PROMPTS_DIR directory
15
+ if test -d $AIA_PROMPTS_DIR
16
+ pushd $AIA_PROMPTS_DIR
17
+ # Generate completions based on .txt files in the AIA_PROMPTS_DIR directory
18
18
  for file in (find . -name "*.txt" -type f)
19
19
  set file (string replace -r '\.txt$' '' -- $file)
20
20
  set file (string replace -r '^\./' '' -- $file)
@@ -3,7 +3,7 @@
3
3
  # the zsh shell
4
4
  #
5
5
  # This script assumes that the system environment
6
- # variable PROMPTS_DIR has been set correctly
6
+ # variable AIA_PROMPTS_DIR has been set correctly
7
7
 
8
8
  _aia_completion() {
9
9
  # The current word being completed
@@ -18,7 +18,7 @@ _aia_completion() {
18
18
  # Check if we are currently completing the option that requires prompt IDs
19
19
  if [[ "$prev_word" == "aia" ]]; then
20
20
  # Change directory to the prompts directory
21
- cd "$PROMPTS_DIR" || return
21
+ cd "$AIA_PROMPTS_DIR" || return
22
22
 
23
23
  # Generate a list of relative paths from the ~/.prompts directory (without .txt extension)
24
24
  local files=($(find . -name "*.txt" -type f | sed 's|^\./||' | sed 's/\.txt$//'))
data/lib/aia/cli.rb CHANGED
@@ -143,7 +143,7 @@ class AIA::Cli
143
143
  config_file:[nil, "-c --config_file"],
144
144
  prompts_dir:["~/.prompts", "-p --prompts"],
145
145
  out_file: [STDOUT, "-o --out_file --no-out_file"],
146
- log_file: ["~/.prompts/_prompts.log", "-l --log --no-log"],
146
+ log_file: ["~/.prompts/_prompts.log", "-l --log_file --no-log_file"],
147
147
  #
148
148
  backend: ['mods', "-b --be --backend --no-backend"],
149
149
  }
@@ -236,7 +236,7 @@ class AIA::Cli
236
236
  arguments.slice!(index,1)
237
237
  else
238
238
  if switch.include?('-no-')
239
- AIA.config[option_sym] = switch.include?('output') ? STDOUT : nil
239
+ AIA.config[option_sym] = switch.include?('out_file') ? STDOUT : nil
240
240
  arguments.slice!(index,1)
241
241
  else
242
242
  AIA.config[option_sym] = arguments[index + 1]
data/lib/aia/main.rb CHANGED
@@ -56,6 +56,11 @@ class AIA::Main
56
56
 
57
57
  # Function to prompt the user with a question using reline
58
58
  def ask_question_with_reline(prompt)
59
+ if prompt.start_with?("\n")
60
+ puts
61
+ prompt = prompt[1..]
62
+ end
63
+
59
64
  answer = Reline.readline(prompt)
60
65
  Reline::HISTORY.push(answer) unless answer.nil? || Reline::HISTORY.to_a.include?(answer)
61
66
  answer
@@ -109,6 +114,12 @@ class AIA::Main
109
114
 
110
115
  result = backend.run
111
116
 
117
+ if STDOUT == AIA.config.out_file
118
+ result = result.wrap(indent: 2)
119
+ end
120
+
121
+ # TODO: consider using glow to render markdown to
122
+ # terminal `brew install glow`
112
123
  AIA.config.out_file.write result
113
124
 
114
125
  logger.prompt_result(@prompt, result)
@@ -139,7 +150,7 @@ class AIA::Main
139
150
 
140
151
  speak response
141
152
 
142
- puts "\nResponse: #{response}"
153
+ puts "\nResponse:\n#{response.wrap(indent: 2)}"
143
154
  logger.info "Response: #{backend.run}"
144
155
 
145
156
  # TODO: Allow user to enter a directive; loop
data/lib/aia/prompt.rb CHANGED
@@ -150,6 +150,11 @@ class AIA::Prompt
150
150
 
151
151
  # Function to prompt the user with a question using reline
152
152
  def ask_question_with_reline(prompt)
153
+ if prompt.start_with?("\n")
154
+ puts
155
+ prompt = prompt[1..]
156
+ end
157
+
153
158
  answer = Reline.readline(prompt)
154
159
  Reline::HISTORY.push(answer) unless answer.nil? || Reline::HISTORY.to_a.include?(answer)
155
160
  answer
@@ -178,7 +183,7 @@ class AIA::Prompt
178
183
  if default&.empty?
179
184
  user_prompt = "\n-=> "
180
185
  else
181
- user_prompt = "\n(#{default}) -=>"
186
+ user_prompt = "\n(#{default}) -=> "
182
187
  end
183
188
 
184
189
  a_string = ask_question_with_reline(user_prompt)
data/lib/aia.rb CHANGED
@@ -6,7 +6,6 @@ def tramp_require(what, &block)
6
6
  begin
7
7
  require_result = require what
8
8
  loaded = true
9
- puts "Loaded"
10
9
  rescue Exception => ex
11
10
  # Do nothing
12
11
  end
data/main.just CHANGED
@@ -14,6 +14,7 @@ with ~/.justfile
14
14
  module repo /Users/dewayne/sandbox/git_repos/repo.just
15
15
  module gem /Users/dewayne/sandbox/git_repos/gem.just
16
16
  module version /Users/dewayne/just_modules/version.just
17
+ module git /Users/dewayne/just_modules/git.just
17
18
 
18
19
 
19
20
  # Install Locally
data/man/aia.1 CHANGED
@@ -68,7 +68,7 @@ Use Fuzzy Matching when searching for a prompt \- default is false
68
68
  \fB\-h\fR, \fB\-\-help\fR
69
69
  Show Usage \- default is false
70
70
  .TP
71
- \fB\-l\fR, \fB\-\-\[lB]no\[rB]\-log\fR \fIPATH\[ru]TO\[ru]LOG\[ru]FILE\fP
71
+ \fB\-l\fR, \fB\-\-\[lB]no\[rB]\-log\[ru]file\fR \fIPATH\[ru]TO\[ru]LOG\[ru]FILE\fP
72
72
  Log FILEPATH \- default is \[Do]HOME\[sl]\.prompts\[sl]prompts\.log
73
73
  .TP
74
74
  \fB\-m\fR, \fB\-\-\[lB]no\[rB]\-markdown\fR
data/man/aia.1.md CHANGED
@@ -73,7 +73,7 @@ The aia command-line tool is an interface for interacting with an AI model backe
73
73
  `-h`, `--help`
74
74
  : Show Usage - default is false
75
75
 
76
- `-l`, `--[no]-log` *PATH_TO_LOG_FILE*
76
+ `-l`, `--[no]-log_file` *PATH_TO_LOG_FILE*
77
77
  : Log FILEPATH - default is $HOME/.prompts/prompts.log
78
78
 
79
79
  `-m`, `--[no]-markdown`
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.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-06 00:00:00.000000000 Z
11
+ date: 2024-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie