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,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