aia 0.0.5 → 0.3.0
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/CHANGELOG.md +4 -0
- data/README.md +24 -2
- data/lib/aia/cli.rb +2 -32
- data/lib/aia/external/,keep +0 -0
- data/lib/aia/external/.irbrc +11 -0
- data/lib/aia/external/ag.rb +103 -0
- data/lib/aia/external/bat.rb +189 -0
- data/lib/aia/external/fzf.rb +147 -0
- data/lib/aia/external/glow.rb +37 -0
- data/lib/aia/external/mods.rb +57 -0
- data/lib/aia/external/rg.rb +1163 -0
- data/lib/aia/external/sgpt.rb +58 -0
- data/lib/aia/external/subl.rb +47 -0
- data/lib/aia/external/temp.md +37 -0
- data/lib/aia/external/tool.rb +73 -0
- data/lib/aia/external.rb +259 -0
- data/lib/aia/external_two.rb +43 -0
- data/lib/aia/main.rb +2 -2
- data/lib/aia/prompt_processing.rb +67 -13
- data/lib/aia/version.rb +1 -1
- metadata +16 -3
- data/lib/aia/external_commands.rb +0 -116
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4d68353a3458a4a3e485acbf09ec6444e63d33ddaedca66a1f48aaf38b31a96
|
4
|
+
data.tar.gz: b2d07bde2cb329db6f23ccda5c845b67251f00f5bdfab680406d671a32ee0b32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d27e5190de909b14a71a52f2eea78b8d948de6cbe5c621f3b10e819404d0a9a78087c5da748598b6dfbf8af88ece61382c407d62382eadb062ad0582d5f4b8f9
|
7
|
+
data.tar.gz: 6cc9b0ad1d570f0cb994e06af614d4faea07b356303042fa1e1bfe03ed12a62f273824e0240b8bb2cb46a64b6f195dd715b15161a228255f3d2639fc1648e61e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.3.0] = 2023-11-23
|
4
|
+
|
5
|
+
- Matching version to [prompt_manager](https://github.com/prompt_manager) This version allows for the user of history in the entery of values to prompt keywords. KW_HISTORY_MAX is set at 5. Changed CLI enteraction to use historical selection and editing of prior keyword values.
|
6
|
+
|
3
7
|
## [0.1.0] - 2023-11-23
|
4
8
|
|
5
9
|
- Initial release
|
data/README.md
CHANGED
@@ -1,11 +1,27 @@
|
|
1
1
|
# AI Assistant (AIA)
|
2
2
|
|
3
|
-
**Under Development**
|
4
|
-
|
5
3
|
`aia` is a command-line utility that integrates prameterized prompt management with generative AI (gen-AI) execution.
|
6
4
|
|
7
5
|
Uses the gem "prompt_manager" to manage the prompts sent to the `mods` command-line utility. Uses the command line tools "ripgrep" to search for prompts to send and "fzf" to select the prompts that match the search term.
|
8
6
|
|
7
|
+
**Most Recent Change**
|
8
|
+
|
9
|
+
v0.3.0 - Matching version to [prompt_manager](https://github.com/prompt_manager) This version allows for the user of history in the entery of values to prompt keywords. KW_HISTORY_MAX is set at 5. Changed CLI enteraction to use historical selection and editing of prior keyword values.
|
10
|
+
|
11
|
+
|
12
|
+
<!-- Tocer[start]: Auto-generated, don't remove. -->
|
13
|
+
|
14
|
+
## Table of Contents
|
15
|
+
|
16
|
+
- [Installation](#installation)
|
17
|
+
- [Usage](#usage)
|
18
|
+
- [System Environment Variables (envars)](#system-environment-variables-envars)
|
19
|
+
- [External CLI Tools Used](#external-cli-tools-used)
|
20
|
+
- [Development](#development)
|
21
|
+
- [Contributing](#contributing)
|
22
|
+
- [License](#license)
|
23
|
+
|
24
|
+
<!-- Tocer[finish]: Auto-generated, don't remove. -->
|
9
25
|
|
10
26
|
|
11
27
|
## Installation
|
@@ -138,6 +154,12 @@ export EDITOR="subl -w"
|
|
138
154
|
|
139
155
|
```
|
140
156
|
|
157
|
+
## Shell Completion
|
158
|
+
|
159
|
+
One of the executables with this gem is `aia_completion.sh` which contains a completion script for hte `aia` such that you specify the first few characters of a prompt ID on the command line and the shell will complete the rest of the ID for you. It works with the `bash` shell but do not know whether it works with the other shells.
|
160
|
+
|
161
|
+
To set the completion you can execute aia_completion.sh` in your `.bashrc` however, the PROMPTS_DIR environment variable must be set in order for prompt ID to work correctly.
|
162
|
+
|
141
163
|
|
142
164
|
## Development
|
143
165
|
|
data/lib/aia/cli.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
module AIA::Cli
|
4
4
|
def setup_cli_options(args)
|
5
5
|
@arguments = args
|
6
|
+
# TODO: consider a fixed config file: ~/,aia
|
6
7
|
@options = {
|
7
8
|
# Value
|
8
9
|
edit?: [false, "-e --edit", "Edit the Prompt File"],
|
@@ -16,6 +17,7 @@ module AIA::Cli
|
|
16
17
|
output: [OUTPUT,"-o --output --no-output", "Out FILENAME"],
|
17
18
|
log: [PROMPT_LOG,"-l --log --no-log", "Log FILEPATH"],
|
18
19
|
markdown?: [true, "-m --markdown --no-markdown --md --no-md", "Format with Markdown"],
|
20
|
+
backend: [:mods, "-b --be --backend --no-backend", "Specify the backend prompt resolver"],
|
19
21
|
}
|
20
22
|
|
21
23
|
# Array(String)
|
@@ -175,35 +177,3 @@ module AIA::Cli
|
|
175
177
|
exit
|
176
178
|
end
|
177
179
|
end
|
178
|
-
|
179
|
-
|
180
|
-
__END__
|
181
|
-
|
182
|
-
|
183
|
-
# TODO: Consider using this history process to preload the default
|
184
|
-
# so that an up arrow will bring the previous answer into
|
185
|
-
# the read buffer for line editing.
|
186
|
-
# Instead of usin the .history file just push the default
|
187
|
-
# value from the JSON file.
|
188
|
-
|
189
|
-
while input = Readline.readline('> ', true)
|
190
|
-
# Skip empty entries and duplicates
|
191
|
-
if input.empty? || Readline::HISTORY.to_a[-2] == input
|
192
|
-
Readline::HISTORY.pop
|
193
|
-
end
|
194
|
-
break if input == 'exit'
|
195
|
-
|
196
|
-
# Do something with the input
|
197
|
-
puts "You entered: #{input}"
|
198
|
-
|
199
|
-
# Save the history in case you want to preserve it for the next sessions
|
200
|
-
File.open('.history', 'a') { |f| f.puts(input) }
|
201
|
-
end
|
202
|
-
|
203
|
-
# Load history from file at the beginning of the program
|
204
|
-
if File.exist?('.history')
|
205
|
-
File.readlines('.history').each do |line|
|
206
|
-
Readline::HISTORY.push(line.chomp)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
File without changes
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# lib/aia/external/ag.rb
|
2
|
+
|
3
|
+
class AIA::External::Ag < AIA::External::Tool
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
@role = :search
|
7
|
+
@desc = "the_silver_searcher Code-search similar to ack"
|
8
|
+
@url = "https://github.com/ggreer/the_silver_searcher"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
__END__
|
13
|
+
|
14
|
+
Usage: ag [FILE-TYPE] [OPTIONS] PATTERN [PATH]
|
15
|
+
|
16
|
+
Recursively search for PATTERN in PATH.
|
17
|
+
Like grep or ack, but faster.
|
18
|
+
|
19
|
+
Example:
|
20
|
+
ag -i foo /bar/
|
21
|
+
|
22
|
+
Output Options:
|
23
|
+
--ackmate Print results in AckMate-parseable format
|
24
|
+
-A --after [LINES] Print lines after match (Default: 2)
|
25
|
+
-B --before [LINES] Print lines before match (Default: 2)
|
26
|
+
--[no]break Print newlines between matches in different files
|
27
|
+
(Enabled by default)
|
28
|
+
-c --count Only print the number of matches in each file.
|
29
|
+
(This often differs from the number of matching lines)
|
30
|
+
--[no]color Print color codes in results (Enabled by default)
|
31
|
+
--color-line-number Color codes for line numbers (Default: 1;33)
|
32
|
+
--color-match Color codes for result match numbers (Default: 30;43)
|
33
|
+
--color-path Color codes for path names (Default: 1;32)
|
34
|
+
--column Print column numbers in results
|
35
|
+
--[no]filename Print file names (Enabled unless searching a single file)
|
36
|
+
-H --[no]heading Print file names before each file's matches
|
37
|
+
(Enabled by default)
|
38
|
+
-C --context [LINES] Print lines before and after matches (Default: 2)
|
39
|
+
--[no]group Same as --[no]break --[no]heading
|
40
|
+
-g --filename-pattern PATTERN
|
41
|
+
Print filenames matching PATTERN
|
42
|
+
-l --files-with-matches Only print filenames that contain matches
|
43
|
+
(don't print the matching lines)
|
44
|
+
-L --files-without-matches
|
45
|
+
Only print filenames that don't contain matches
|
46
|
+
--print-all-files Print headings for all files searched, even those that
|
47
|
+
don't contain matches
|
48
|
+
--[no]numbers Print line numbers. Default is to omit line numbers
|
49
|
+
when searching streams
|
50
|
+
-o --only-matching Prints only the matching part of the lines
|
51
|
+
--print-long-lines Print matches on very long lines (Default: >2k characters)
|
52
|
+
--passthrough When searching a stream, print all lines even if they
|
53
|
+
don't match
|
54
|
+
--silent Suppress all log messages, including errors
|
55
|
+
--stats Print stats (files scanned, time taken, etc.)
|
56
|
+
--stats-only Print stats and nothing else.
|
57
|
+
(Same as --count when searching a single file)
|
58
|
+
--vimgrep Print results like vim's :vimgrep /pattern/g would
|
59
|
+
(it reports every match on the line)
|
60
|
+
-0 --null --print0 Separate filenames with null (for 'xargs -0')
|
61
|
+
|
62
|
+
Search Options:
|
63
|
+
-a --all-types Search all files (doesn't include hidden files
|
64
|
+
or patterns from ignore files)
|
65
|
+
-D --debug Ridiculous debugging (probably not useful)
|
66
|
+
--depth NUM Search up to NUM directories deep (Default: 25)
|
67
|
+
-f --follow Follow symlinks
|
68
|
+
-F --fixed-strings Alias for --literal for compatibility with grep
|
69
|
+
-G --file-search-regex PATTERN Limit search to filenames matching PATTERN
|
70
|
+
--hidden Search hidden files (obeys .*ignore files)
|
71
|
+
-i --ignore-case Match case insensitively
|
72
|
+
--ignore PATTERN Ignore files/directories matching PATTERN
|
73
|
+
(literal file/directory names also allowed)
|
74
|
+
--ignore-dir NAME Alias for --ignore for compatibility with ack.
|
75
|
+
-m --max-count NUM Skip the rest of a file after NUM matches (Default: 10,000)
|
76
|
+
--one-device Don't follow links to other devices.
|
77
|
+
-p --path-to-ignore STRING
|
78
|
+
Use .ignore file at STRING
|
79
|
+
-Q --literal Don't parse PATTERN as a regular expression
|
80
|
+
-s --case-sensitive Match case sensitively
|
81
|
+
-S --smart-case Match case insensitively unless PATTERN contains
|
82
|
+
uppercase characters (Enabled by default)
|
83
|
+
--search-binary Search binary files for matches
|
84
|
+
-t --all-text Search all text files (doesn't include hidden files)
|
85
|
+
-u --unrestricted Search all files (ignore .ignore, .gitignore, etc.;
|
86
|
+
searches binary and hidden files as well)
|
87
|
+
-U --skip-vcs-ignores Ignore VCS ignore files
|
88
|
+
(.gitignore, .hgignore; still obey .ignore)
|
89
|
+
-v --invert-match
|
90
|
+
-w --word-regexp Only match whole words
|
91
|
+
-W --width NUM Truncate match lines after NUM characters
|
92
|
+
-z --search-zip Search contents of compressed (e.g., gzip) files
|
93
|
+
|
94
|
+
File Types:
|
95
|
+
The search can be restricted to certain types of files. Example:
|
96
|
+
ag --html needle
|
97
|
+
- Searches for 'needle' in files with suffix .htm, .html, .shtml or .xhtml.
|
98
|
+
|
99
|
+
For a list of supported file types run:
|
100
|
+
ag --list-file-types
|
101
|
+
|
102
|
+
ag was originally created by Geoff Greer. More information (and the latest release)
|
103
|
+
can be found at http://geoff.greer.fm/ag
|
@@ -0,0 +1,189 @@
|
|
1
|
+
# lib/aia/external/bat.rb
|
2
|
+
|
3
|
+
class AIA::External::Bat < AIA::External::Tool
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
@role = :render
|
7
|
+
@desc = 'Clone of cat(1) with syntax highlighting and Git integration'
|
8
|
+
@url = 'https://github.com/sharkdp/bat'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
__END__
|
13
|
+
|
14
|
+
|
15
|
+
A cat(1) clone with syntax highlighting and Git integration.
|
16
|
+
|
17
|
+
Usage: bat [OPTIONS] [FILE]...
|
18
|
+
bat <COMMAND>
|
19
|
+
|
20
|
+
Arguments:
|
21
|
+
[FILE]...
|
22
|
+
File(s) to print / concatenate. Use a dash ('-') or no argument at all to read from
|
23
|
+
standard input.
|
24
|
+
|
25
|
+
Options:
|
26
|
+
-A, --show-all
|
27
|
+
Show non-printable characters like space, tab or newline. This option can also be
|
28
|
+
used to print binary files. Use '--tabs' to control the width of the
|
29
|
+
tab-placeholders.
|
30
|
+
|
31
|
+
--nonprintable-notation <notation>
|
32
|
+
Set notation for non-printable characters.
|
33
|
+
|
34
|
+
Possible values:
|
35
|
+
* unicode (␇, ␊, ␀, ..)
|
36
|
+
* caret (^G, ^J, ^@, ..)
|
37
|
+
|
38
|
+
-p, --plain...
|
39
|
+
Only show plain style, no decorations. This is an alias for '--style=plain'. When
|
40
|
+
'-p' is used twice ('-pp'), it also disables automatic paging (alias for
|
41
|
+
'--style=plain --paging=never').
|
42
|
+
|
43
|
+
-l, --language <language>
|
44
|
+
Explicitly set the language for syntax highlighting. The language can be specified as
|
45
|
+
a name (like 'C++' or 'LaTeX') or possible file extension (like 'cpp', 'hpp' or
|
46
|
+
'md'). Use '--list-languages' to show all supported language names and file
|
47
|
+
extensions.
|
48
|
+
|
49
|
+
-H, --highlight-line <N:M>
|
50
|
+
Highlight the specified line ranges with a different background color For example:
|
51
|
+
'--highlight-line 40' highlights line 40
|
52
|
+
'--highlight-line 30:40' highlights lines 30 to 40
|
53
|
+
'--highlight-line :40' highlights lines 1 to 40
|
54
|
+
'--highlight-line 40:' highlights lines 40 to the end of the file
|
55
|
+
'--highlight-line 30:+10' highlights lines 30 to 40
|
56
|
+
|
57
|
+
--file-name <name>
|
58
|
+
Specify the name to display for a file. Useful when piping data to bat from STDIN
|
59
|
+
when bat does not otherwise know the filename. Note that the provided file name is
|
60
|
+
also used for syntax detection.
|
61
|
+
|
62
|
+
-d, --diff
|
63
|
+
Only show lines that have been added/removed/modified with respect to the Git index.
|
64
|
+
Use --diff-context=N to control how much context you want to see.
|
65
|
+
|
66
|
+
--diff-context <N>
|
67
|
+
Include N lines of context around added/removed/modified lines when using '--diff'.
|
68
|
+
|
69
|
+
--tabs <T>
|
70
|
+
Set the tab width to T spaces. Use a width of 0 to pass tabs through directly
|
71
|
+
|
72
|
+
--wrap <mode>
|
73
|
+
Specify the text-wrapping mode (*auto*, never, character). The '--terminal-width'
|
74
|
+
option can be used in addition to control the output width.
|
75
|
+
|
76
|
+
-S, --chop-long-lines
|
77
|
+
Truncate all lines longer than screen width. Alias for '--wrap=never'.
|
78
|
+
|
79
|
+
--terminal-width <width>
|
80
|
+
Explicitly set the width of the terminal instead of determining it automatically. If
|
81
|
+
prefixed with '+' or '-', the value will be treated as an offset to the actual
|
82
|
+
terminal width. See also: '--wrap'.
|
83
|
+
|
84
|
+
-n, --number
|
85
|
+
Only show line numbers, no other decorations. This is an alias for '--style=numbers'
|
86
|
+
|
87
|
+
--color <when>
|
88
|
+
Specify when to use colored output. The automatic mode only enables colors if an
|
89
|
+
interactive terminal is detected - colors are automatically disabled if the output
|
90
|
+
goes to a pipe.
|
91
|
+
Possible values: *auto*, never, always.
|
92
|
+
|
93
|
+
--italic-text <when>
|
94
|
+
Specify when to use ANSI sequences for italic text in the output. Possible values:
|
95
|
+
always, *never*.
|
96
|
+
|
97
|
+
--decorations <when>
|
98
|
+
Specify when to use the decorations that have been specified via '--style'. The
|
99
|
+
automatic mode only enables decorations if an interactive terminal is detected.
|
100
|
+
Possible values: *auto*, never, always.
|
101
|
+
|
102
|
+
-f, --force-colorization
|
103
|
+
Alias for '--decorations=always --color=always'. This is useful if the output of bat
|
104
|
+
is piped to another program, but you want to keep the colorization/decorations.
|
105
|
+
|
106
|
+
--paging <when>
|
107
|
+
Specify when to use the pager. To disable the pager, use --paging=never' or its
|
108
|
+
alias,'-P'. To disable the pager permanently, set BAT_PAGING to 'never'. To control
|
109
|
+
which pager is used, see the '--pager' option. Possible values: *auto*, never,
|
110
|
+
always.
|
111
|
+
|
112
|
+
--pager <command>
|
113
|
+
Determine which pager is used. This option will override the PAGER and BAT_PAGER
|
114
|
+
environment variables. The default pager is 'less'. To control when the pager is
|
115
|
+
used, see the '--paging' option. Example: '--pager "less -RF"'.
|
116
|
+
|
117
|
+
-m, --map-syntax <glob:syntax>
|
118
|
+
Map a glob pattern to an existing syntax name. The glob pattern is matched on the
|
119
|
+
full path and the filename. For example, to highlight *.build files with the Python
|
120
|
+
syntax, use -m '*.build:Python'. To highlight files named '.myignore' with the Git
|
121
|
+
Ignore syntax, use -m '.myignore:Git Ignore'. Note that the right-hand side is the
|
122
|
+
*name* of the syntax, not a file extension.
|
123
|
+
|
124
|
+
--ignored-suffix <ignored-suffix>
|
125
|
+
Ignore extension. For example:
|
126
|
+
'bat --ignored-suffix ".dev" my_file.json.dev' will use JSON syntax, and ignore
|
127
|
+
'.dev'
|
128
|
+
|
129
|
+
--theme <theme>
|
130
|
+
Set the theme for syntax highlighting. Use '--list-themes' to see all available
|
131
|
+
themes. To set a default theme, add the '--theme="..."' option to the configuration
|
132
|
+
file or export the BAT_THEME environment variable (e.g.: export BAT_THEME="...").
|
133
|
+
|
134
|
+
--list-themes
|
135
|
+
Display a list of supported themes for syntax highlighting.
|
136
|
+
|
137
|
+
--style <components>
|
138
|
+
Configure which elements (line numbers, file headers, grid borders, Git
|
139
|
+
modifications, ..) to display in addition to the file contents. The argument is a
|
140
|
+
comma-separated list of components to display (e.g. 'numbers,changes,grid') or a
|
141
|
+
pre-defined style ('full'). To set a default style, add the '--style=".."' option to
|
142
|
+
the configuration file or export the BAT_STYLE environment variable (e.g.: export
|
143
|
+
BAT_STYLE="..").
|
144
|
+
|
145
|
+
Possible values:
|
146
|
+
|
147
|
+
* default: enables recommended style components (default).
|
148
|
+
* full: enables all available components.
|
149
|
+
* auto: same as 'default', unless the output is piped.
|
150
|
+
* plain: disables all available components.
|
151
|
+
* changes: show Git modification markers.
|
152
|
+
* header: alias for 'header-filename'.
|
153
|
+
* header-filename: show filenames before the content.
|
154
|
+
* header-filesize: show file sizes before the content.
|
155
|
+
* grid: vertical/horizontal lines to separate side bar
|
156
|
+
and the header from the content.
|
157
|
+
* rule: horizontal lines to delimit files.
|
158
|
+
* numbers: show line numbers in the side bar.
|
159
|
+
* snip: draw separation lines between distinct line ranges.
|
160
|
+
|
161
|
+
-r, --line-range <N:M>
|
162
|
+
Only print the specified range of lines for each file. For example:
|
163
|
+
'--line-range 30:40' prints lines 30 to 40
|
164
|
+
'--line-range :40' prints lines 1 to 40
|
165
|
+
'--line-range 40:' prints lines 40 to the end of the file
|
166
|
+
'--line-range 40' only prints line 40
|
167
|
+
'--line-range 30:+10' prints lines 30 to 40
|
168
|
+
|
169
|
+
-L, --list-languages
|
170
|
+
Display a list of supported languages for syntax highlighting.
|
171
|
+
|
172
|
+
-u, --unbuffered
|
173
|
+
This option exists for POSIX-compliance reasons ('u' is for 'unbuffered'). The output
|
174
|
+
is always unbuffered - this option is simply ignored.
|
175
|
+
|
176
|
+
--diagnostic
|
177
|
+
Show diagnostic information for bug reports.
|
178
|
+
|
179
|
+
--acknowledgements
|
180
|
+
Show acknowledgements.
|
181
|
+
|
182
|
+
-h, --help
|
183
|
+
Print help (see a summary with '-h')
|
184
|
+
|
185
|
+
-V, --version
|
186
|
+
Print version
|
187
|
+
|
188
|
+
You can use 'bat cache' to customize syntaxes and themes. See 'bat cache --help' for more
|
189
|
+
information
|
@@ -0,0 +1,147 @@
|
|
1
|
+
# lib/aia/external/fzf.rb
|
2
|
+
|
3
|
+
class AIA::External::Fzf < AIA::External::Tool
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
@role = :selecter
|
7
|
+
@desc = 'Command-line fuzzy finder written in Go'
|
8
|
+
@url = 'https://github.com/junegunn/fzf'
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
def command(options = {})
|
13
|
+
cd_command = "cd #{options[:prompt_dir]}"
|
14
|
+
find_command = "find . -name '*.txt'"
|
15
|
+
fzf_options = build_fzf_options(options[:fuzzy])
|
16
|
+
"#{cd_command} ; #{find_command} | fzf #{fzf_options}"
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def build_fzf_options(fuzzy)
|
22
|
+
[
|
23
|
+
"--tabstop=2",
|
24
|
+
"--header='Prompt contents below'",
|
25
|
+
"--header-first",
|
26
|
+
"--prompt='Search term: '",
|
27
|
+
'--delimiter :',
|
28
|
+
"--preview 'ww {1}'", # 'ww' from word_wrap gem
|
29
|
+
"--preview-window=down:50%:wrap"
|
30
|
+
].tap { |opts| opts << "--exact" unless fuzzy }.join(' ')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
__END__
|
35
|
+
|
36
|
+
usage: fzf [options]
|
37
|
+
|
38
|
+
Search
|
39
|
+
-x, --extended Extended-search mode
|
40
|
+
(enabled by default; +x or --no-extended to disable)
|
41
|
+
-e, --exact Enable Exact-match
|
42
|
+
-i Case-insensitive match (default: smart-case match)
|
43
|
+
+i Case-sensitive match
|
44
|
+
--scheme=SCHEME Scoring scheme [default|path|history]
|
45
|
+
--literal Do not normalize latin script letters before matching
|
46
|
+
-n, --nth=N[,..] Comma-separated list of field index expressions
|
47
|
+
for limiting search scope. Each can be a non-zero
|
48
|
+
integer or a range expression ([BEGIN]..[END]).
|
49
|
+
--with-nth=N[,..] Transform the presentation of each line using
|
50
|
+
field index expressions
|
51
|
+
-d, --delimiter=STR Field delimiter regex (default: AWK-style)
|
52
|
+
+s, --no-sort Do not sort the result
|
53
|
+
--track Track the current selection when the result is updated
|
54
|
+
--tac Reverse the order of the input
|
55
|
+
--disabled Do not perform search
|
56
|
+
--tiebreak=CRI[,..] Comma-separated list of sort criteria to apply
|
57
|
+
when the scores are tied [length|chunk|begin|end|index]
|
58
|
+
(default: length)
|
59
|
+
|
60
|
+
Interface
|
61
|
+
-m, --multi[=MAX] Enable multi-select with tab/shift-tab
|
62
|
+
--no-mouse Disable mouse
|
63
|
+
--bind=KEYBINDS Custom key bindings. Refer to the man page.
|
64
|
+
--cycle Enable cyclic scroll
|
65
|
+
--keep-right Keep the right end of the line visible on overflow
|
66
|
+
--scroll-off=LINES Number of screen lines to keep above or below when
|
67
|
+
scrolling to the top or to the bottom (default: 0)
|
68
|
+
--no-hscroll Disable horizontal scroll
|
69
|
+
--hscroll-off=COLS Number of screen columns to keep to the right of the
|
70
|
+
highlighted substring (default: 10)
|
71
|
+
--filepath-word Make word-wise movements respect path separators
|
72
|
+
--jump-labels=CHARS Label characters for jump and jump-accept
|
73
|
+
|
74
|
+
Layout
|
75
|
+
--height=[~]HEIGHT[%] Display fzf window below the cursor with the given
|
76
|
+
height instead of using fullscreen.
|
77
|
+
If prefixed with '~', fzf will determine the height
|
78
|
+
according to the input size.
|
79
|
+
--min-height=HEIGHT Minimum height when --height is given in percent
|
80
|
+
(default: 10)
|
81
|
+
--layout=LAYOUT Choose layout: [default|reverse|reverse-list]
|
82
|
+
--border[=STYLE] Draw border around the finder
|
83
|
+
[rounded|sharp|bold|block|thinblock|double|horizontal|vertical|
|
84
|
+
top|bottom|left|right|none] (default: rounded)
|
85
|
+
--border-label=LABEL Label to print on the border
|
86
|
+
--border-label-pos=COL Position of the border label
|
87
|
+
[POSITIVE_INTEGER: columns from left|
|
88
|
+
NEGATIVE_INTEGER: columns from right][:bottom]
|
89
|
+
(default: 0 or center)
|
90
|
+
--margin=MARGIN Screen margin (TRBL | TB,RL | T,RL,B | T,R,B,L)
|
91
|
+
--padding=PADDING Padding inside border (TRBL | TB,RL | T,RL,B | T,R,B,L)
|
92
|
+
--info=STYLE Finder info style
|
93
|
+
[default|right|hidden|inline[:SEPARATOR]|inline-right]
|
94
|
+
--separator=STR String to form horizontal separator on info line
|
95
|
+
--no-separator Hide info line separator
|
96
|
+
--scrollbar[=C1[C2]] Scrollbar character(s) (each for main and preview window)
|
97
|
+
--no-scrollbar Hide scrollbar
|
98
|
+
--prompt=STR Input prompt (default: '> ')
|
99
|
+
--pointer=STR Pointer to the current line (default: '>')
|
100
|
+
--marker=STR Multi-select marker (default: '>')
|
101
|
+
--header=STR String to print as header
|
102
|
+
--header-lines=N The first N lines of the input are treated as header
|
103
|
+
--header-first Print header before the prompt line
|
104
|
+
--ellipsis=STR Ellipsis to show when line is truncated (default: '..')
|
105
|
+
|
106
|
+
Display
|
107
|
+
--ansi Enable processing of ANSI color codes
|
108
|
+
--tabstop=SPACES Number of spaces for a tab character (default: 8)
|
109
|
+
--color=COLSPEC Base scheme (dark|light|16|bw) and/or custom colors
|
110
|
+
--no-bold Do not use bold text
|
111
|
+
|
112
|
+
History
|
113
|
+
--history=FILE History file
|
114
|
+
--history-size=N Maximum number of history entries (default: 1000)
|
115
|
+
|
116
|
+
Preview
|
117
|
+
--preview=COMMAND Command to preview highlighted line ({})
|
118
|
+
--preview-window=OPT Preview window layout (default: right:50%)
|
119
|
+
[up|down|left|right][,SIZE[%]]
|
120
|
+
[,[no]wrap][,[no]cycle][,[no]follow][,[no]hidden]
|
121
|
+
[,border-BORDER_OPT]
|
122
|
+
[,+SCROLL[OFFSETS][/DENOM]][,~HEADER_LINES]
|
123
|
+
[,default][,<SIZE_THRESHOLD(ALTERNATIVE_LAYOUT)]
|
124
|
+
--preview-label=LABEL
|
125
|
+
--preview-label-pos=N Same as --border-label and --border-label-pos,
|
126
|
+
but for preview window
|
127
|
+
|
128
|
+
Scripting
|
129
|
+
-q, --query=STR Start the finder with the given query
|
130
|
+
-1, --select-1 Automatically select the only match
|
131
|
+
-0, --exit-0 Exit immediately when there's no match
|
132
|
+
-f, --filter=STR Filter mode. Do not start interactive finder.
|
133
|
+
--print-query Print query as the first line
|
134
|
+
--expect=KEYS Comma-separated list of keys to complete fzf
|
135
|
+
--read0 Read input delimited by ASCII NUL characters
|
136
|
+
--print0 Print output delimited by ASCII NUL characters
|
137
|
+
--sync Synchronous search for multi-staged filtering
|
138
|
+
--listen[=[ADDR:]PORT] Start HTTP server to receive actions (POST /)
|
139
|
+
(To allow remote process execution, use --listen-unsafe)
|
140
|
+
--version Display version information and exit
|
141
|
+
|
142
|
+
Environment variables
|
143
|
+
FZF_DEFAULT_COMMAND Default command to use when input is tty
|
144
|
+
FZF_DEFAULT_OPTS Default options
|
145
|
+
(e.g. '--layout=reverse --inline-info')
|
146
|
+
FZF_API_KEY X-API-Key header for HTTP server (--listen)
|
147
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# lib/aia/external/glow.rb
|
2
|
+
|
3
|
+
class AIA::External::Glow < AIA::External::Tool
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
@role = :render
|
7
|
+
@desc = 'Render markdown on the CLI'
|
8
|
+
@url = 'https://github.com/charmbracelet/glow'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
__END__
|
14
|
+
|
15
|
+
Render markdown on the CLI, with pizzazz!
|
16
|
+
|
17
|
+
Usage:
|
18
|
+
glow [SOURCE|DIR] [flags]
|
19
|
+
glow [command]
|
20
|
+
|
21
|
+
Available Commands:
|
22
|
+
completion Generate the autocompletion script for the specified shell
|
23
|
+
config Edit the glow config file
|
24
|
+
help Help about any command
|
25
|
+
stash Stash a markdown
|
26
|
+
|
27
|
+
Flags:
|
28
|
+
-a, --all show system files and directories (TUI-mode only)
|
29
|
+
--config string config file (default /Users/dewayne/Library/Preferences/glow/glow.yml)
|
30
|
+
-h, --help help for glow
|
31
|
+
-l, --local show local files only; no network (TUI-mode only)
|
32
|
+
-p, --pager display with pager
|
33
|
+
-s, --style string style name or JSON path (default "auto")
|
34
|
+
-v, --version version for glow
|
35
|
+
-w, --width uint word-wrap at width
|
36
|
+
|
37
|
+
Use "glow [command] --help" for more information about a command.
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# lib/aia/external/mods.rb
|
2
|
+
|
3
|
+
class AIA::External::Mods < AIA::External::Tool
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
@role = :search
|
7
|
+
@desc = 'AI on the command-line'
|
8
|
+
@url = 'https://github.com/charmbracelet/mods'
|
9
|
+
end
|
10
|
+
|
11
|
+
def command(extra_options = [])
|
12
|
+
model = ENV['MODS_MODEL'] || 'gpt-4-1106-preview'
|
13
|
+
ai_default_opts = "-m #{model} --no-limit -f"
|
14
|
+
"#{name} #{ai_default_opts} #{extra_options.join(' ')}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
__END__
|
19
|
+
|
20
|
+
GPT on the command line. Built for pipelines.
|
21
|
+
|
22
|
+
Usage:
|
23
|
+
mods [OPTIONS] [PREFIX TERM]
|
24
|
+
|
25
|
+
Options:
|
26
|
+
-m, --model Default model (gpt-3.5-turbo, gpt-4, ggml-gpt4all-j...).
|
27
|
+
-a, --api OpenAI compatible REST API (openai, localai).
|
28
|
+
-x, --http-proxy HTTP proxy to use for API requests.
|
29
|
+
-f, --format Ask for the response to be formatted as markdown unless otherwise set.
|
30
|
+
-r, --raw Render output as raw text when connected to a TTY.
|
31
|
+
-P, --prompt Include the prompt from the arguments and stdin, truncate stdin to specified number of lines.
|
32
|
+
-p, --prompt-args Include the prompt from the arguments in the response.
|
33
|
+
-c, --continue Continue from the last response or a given save title.
|
34
|
+
-C, --continue-last Continue from the last response.
|
35
|
+
-l, --list Lists saved conversations.
|
36
|
+
-t, --title Saves the current conversation with the given title.
|
37
|
+
-d, --delete Deletes a saved conversation with the given title or ID.
|
38
|
+
-s, --show Show a saved conversation with the given title or ID.
|
39
|
+
-S, --show-last Show a the last saved conversation.
|
40
|
+
-q, --quiet Quiet mode (hide the spinner while loading and stderr messages for success).
|
41
|
+
-h, --help Show help and exit.
|
42
|
+
-v, --version Show version and exit.
|
43
|
+
--max-retries Maximum number of times to retry API calls.
|
44
|
+
--no-limit Turn off the client-side limit on the size of the input into the model.
|
45
|
+
--max-tokens Maximum number of tokens in response.
|
46
|
+
--temp Temperature (randomness) of results, from 0.0 to 2.0.
|
47
|
+
--topp TopP, an alternative to temperature that narrows response, from 0.0 to 1.0.
|
48
|
+
--fanciness Your desired level of fanciness.
|
49
|
+
--status-text Text to show while generating.
|
50
|
+
--no-cache Disables caching of the prompt/response.
|
51
|
+
--reset-settings Backup your old settings file and reset everything to the defaults.
|
52
|
+
--settings Open settings in your $EDITOR.
|
53
|
+
--dirs Print the directories in which mods store its data
|
54
|
+
|
55
|
+
Example:
|
56
|
+
# Editorialize your video files
|
57
|
+
ls ~/vids | mods -f "summarize each of these titles, group them by decade" | glow
|