appydave-tools 0.82.0 → 0.83.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 +7 -0
- data/bin/llm_context.rb +17 -1
- data/lib/appydave/tools/llm_context/options.rb +4 -0
- data/lib/appydave/tools/llm_context/output_handler.rb +41 -16
- data/lib/appydave/tools/version.rb +1 -1
- data/package.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b1472f59045694d5411b4112d3c66c04dfa724197ff9a6caa6fe8dde4437a6a
|
|
4
|
+
data.tar.gz: 9088a3cc358367481e06602912df404694af78d5271d2b90458e08ee63dc272c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9dd76f56f7e9886dbd88b8ab9a2a4e026abd1ddaad935046c61a9fc7a9b72cbf316edb8fcb3d81889a55833cca273c3e09abee6d066bad035b7337afa823aab5
|
|
7
|
+
data.tar.gz: 1c32c5827d8b838d9c4f723ecfc0c4695c6d5189fc0f19401b365ca9c9888f3e57de8a167fdc9ba67edb4dc56d3519207e19df95c3382f9f7d50b3af5eef85c7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [0.82.0](https://github.com/appydave/appydave-tools/compare/v0.81.0...v0.82.0) (2026-04-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add random_context tool — randomly surfaces brain/OMI content for discovery; config at ~/.config/appydave/random-queries.yml bootstrapped from bundled seed ([1a98813](https://github.com/appydave/appydave-tools/commit/1a98813951283db7e777b3e7d6a48d60aaa840ad))
|
|
7
|
+
|
|
1
8
|
# [0.81.0](https://github.com/appydave/appydave-tools/compare/v0.80.0...v0.81.0) (2026-04-04)
|
|
2
9
|
|
|
3
10
|
|
data/bin/llm_context.rb
CHANGED
|
@@ -81,6 +81,16 @@ def setup_options(opts, options)
|
|
|
81
81
|
options.show_tokens = true
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
+
opts.on('-s', '--smart', 'Auto-route: clipboard if ≤ threshold tokens, else temp file',
|
|
85
|
+
'Mutually exclusive with explicit -o clipboard or -o temp') do
|
|
86
|
+
options.smart = true
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
opts.on('--smart-limit N', Integer,
|
|
90
|
+
'Token threshold for --smart (default: 100000)') do |n|
|
|
91
|
+
options.smart_limit = n
|
|
92
|
+
end
|
|
93
|
+
|
|
84
94
|
opts.on('--stdin', 'Read file paths from stdin (one per line) instead of using patterns') do
|
|
85
95
|
options.stdin = true
|
|
86
96
|
end
|
|
@@ -99,6 +109,7 @@ def setup_help_sections(opts)
|
|
|
99
109
|
opts.separator ' clipboard - Copy to system clipboard (default)'
|
|
100
110
|
opts.separator ' temp - Write to system temp dir, copy path to clipboard'
|
|
101
111
|
opts.separator ' filename - Write to specified file path'
|
|
112
|
+
opts.separator ' --smart - Auto-route: clipboard if ≤ 100k tokens, else temp file'
|
|
102
113
|
opts.separator ''
|
|
103
114
|
opts.separator 'INPUT MODES'
|
|
104
115
|
opts.separator ' Patterns (default): -i <glob> and -e <exclude_glob>'
|
|
@@ -165,7 +176,12 @@ if options.include_patterns.empty? && options.exclude_patterns.empty? && options
|
|
|
165
176
|
exit
|
|
166
177
|
end
|
|
167
178
|
|
|
168
|
-
if options.output_target.
|
|
179
|
+
if options.smart && (options.output_target & %w[clipboard temp]).any?
|
|
180
|
+
warn 'Error: --smart (-s) cannot be combined with explicit -o clipboard or -o temp'
|
|
181
|
+
exit 1
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
if options.output_target.empty? && !options.smart
|
|
169
185
|
puts 'No output target provided. Will default to `clipboard`. You can set the output target using -o'
|
|
170
186
|
options.output_target << 'clipboard'
|
|
171
187
|
end
|
|
@@ -16,6 +16,8 @@ module Appydave
|
|
|
16
16
|
:show_tokens,
|
|
17
17
|
:file_paths,
|
|
18
18
|
:stdin,
|
|
19
|
+
:smart,
|
|
20
|
+
:smart_limit,
|
|
19
21
|
keyword_init: true
|
|
20
22
|
) do
|
|
21
23
|
def initialize(**args)
|
|
@@ -29,6 +31,8 @@ module Appydave
|
|
|
29
31
|
self.show_tokens ||= false
|
|
30
32
|
self.file_paths ||= []
|
|
31
33
|
self.stdin ||= false
|
|
34
|
+
self.smart ||= false
|
|
35
|
+
self.smart_limit ||= 100_000
|
|
32
36
|
end
|
|
33
37
|
end
|
|
34
38
|
end
|
|
@@ -9,18 +9,15 @@ module Appydave
|
|
|
9
9
|
@content = content
|
|
10
10
|
@output_targets = options.output_target
|
|
11
11
|
@working_directory = options.working_directory
|
|
12
|
+
@smart = options.smart
|
|
13
|
+
@smart_limit = options.smart_limit
|
|
12
14
|
end
|
|
13
15
|
|
|
14
16
|
def execute
|
|
15
|
-
@
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
when 'temp'
|
|
20
|
-
write_to_temp
|
|
21
|
-
when /^.+$/
|
|
22
|
-
write_to_file(target)
|
|
23
|
-
end
|
|
17
|
+
if @smart
|
|
18
|
+
execute_smart
|
|
19
|
+
else
|
|
20
|
+
@output_targets.each { |target| route(target) }
|
|
24
21
|
end
|
|
25
22
|
end
|
|
26
23
|
|
|
@@ -28,23 +25,51 @@ module Appydave
|
|
|
28
25
|
|
|
29
26
|
attr_reader :content, :output_targets, :working_directory
|
|
30
27
|
|
|
28
|
+
def execute_smart
|
|
29
|
+
token_estimate = (@content.length / 4.0).ceil
|
|
30
|
+
if token_estimate <= @smart_limit
|
|
31
|
+
Clipboard.copy(@content)
|
|
32
|
+
warn "→ clipboard (#{format_tokens(token_estimate)})"
|
|
33
|
+
else
|
|
34
|
+
file_path = write_to_temp_file
|
|
35
|
+
Clipboard.copy(file_path)
|
|
36
|
+
warn "→ temp file: #{file_path} (#{format_tokens(token_estimate)})"
|
|
37
|
+
warn ' Path copied to clipboard.'
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def format_tokens(count)
|
|
42
|
+
"#{(count / 1000.0).round.to_i}k tokens"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def route(target)
|
|
46
|
+
case target
|
|
47
|
+
when 'clipboard'
|
|
48
|
+
Clipboard.copy(@content)
|
|
49
|
+
when 'temp'
|
|
50
|
+
write_to_temp
|
|
51
|
+
when /^.+$/
|
|
52
|
+
write_to_file(target)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
31
56
|
def write_to_file(target)
|
|
32
57
|
resolved_path = Pathname.new(target).absolute? ? target : File.join(working_directory, target)
|
|
33
58
|
File.write(resolved_path, content)
|
|
34
59
|
end
|
|
35
60
|
|
|
36
61
|
def write_to_temp
|
|
37
|
-
|
|
62
|
+
file_path = write_to_temp_file
|
|
63
|
+
Clipboard.copy(file_path)
|
|
64
|
+
warn "Context saved to: #{file_path}"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def write_to_temp_file
|
|
38
68
|
tmp_dir = Dir.tmpdir
|
|
39
69
|
timestamp = Time.now.strftime('%Y%m%d-%H%M%S-%N')[0..18] # millisecond precision
|
|
40
70
|
file_path = File.join(tmp_dir, "llm_context-#{timestamp}.txt")
|
|
41
|
-
|
|
42
|
-
# Write content to file
|
|
43
71
|
File.write(file_path, @content)
|
|
44
|
-
|
|
45
|
-
# Copy path to clipboard
|
|
46
|
-
Clipboard.copy(file_path)
|
|
47
|
-
warn "Context saved to: #{file_path}"
|
|
72
|
+
file_path
|
|
48
73
|
end
|
|
49
74
|
end
|
|
50
75
|
end
|
data/package.json
CHANGED