utils 0.97.0 → 0.99.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/README.md +7 -0
- data/bin/changes +4 -4
- data/bin/charpick +3 -5
- data/bin/code_comment +5 -4
- data/bin/code_indexer +1 -1
- data/bin/commit_message +7 -5
- data/bin/irb_client +9 -0
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7232e4cf01c7018df6fc5f06172fe53c7677e573240b2309d37d7ce5063d9102
|
|
4
|
+
data.tar.gz: 4374f2832d691ae845a5c9dc578f6ec5c0fe707dbfb5341f1a1f3698dd7a8566
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b0ba498ca1c5f16060af527eb3c6a2f71b42fd21cebe35c54186cce18bb6cb5e324988bb2d8b28cfb0ddc1ef24e3a33b57d6c79efbf9a1465b1f5fbd758873a
|
|
7
|
+
data.tar.gz: b21168e8c5863a9552a689d0640793f89a229d1c5bca776e9d77c84472cba816d4614d9639003d6818008127d894575f6d6660e35cd6855d9107a62036ee8090
|
data/README.md
CHANGED
|
@@ -100,9 +100,16 @@ gem install utils
|
|
|
100
100
|
- **`serve`** - Simple HTTP server launcher
|
|
101
101
|
- **`ssh-tunnel`** - Create SSH tunnel to remote host
|
|
102
102
|
|
|
103
|
+
### ⌨️ Interactive
|
|
104
|
+
|
|
105
|
+
- **`irb_client`** - Send code to a running IRB server for evaluation and
|
|
106
|
+
execution (start the server with `irb_server` in the session)
|
|
107
|
+
|
|
103
108
|
### 🎨 Slacking
|
|
104
109
|
|
|
105
110
|
- **`ascii7`** - Generate ASCII art from text
|
|
111
|
+
- **`charpick`** - Fuzzy-search Unicode characters by name and copy the
|
|
112
|
+
glyph to the clipboard
|
|
106
113
|
- **`enum`** - Enumerate files and directories with line counts
|
|
107
114
|
- **`rainbow`** - Display rainbow-colored banner text
|
|
108
115
|
|
data/bin/changes
CHANGED
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
# - Configuration files in ~/.config/changes/
|
|
16
16
|
# - system.txt: System prompt for LLM
|
|
17
17
|
# - prompt.txt: Template for changelog generation
|
|
18
|
-
# - client.json: Ollama client settings
|
|
19
|
-
# - options.json: Generation options (temperature, etc.)
|
|
20
18
|
#
|
|
21
19
|
# Environment variables:
|
|
22
20
|
# OLLAMA_URL: Base URL of Ollama server OR
|
|
23
21
|
# OLLAMA_HOST: Host of Ollama server
|
|
24
22
|
# OLLAMA_MODEL: Model to use (default: llama3.1)
|
|
23
|
+
# OLLAMA_CLIENT: JSON client configuration
|
|
24
|
+
# OLLAMA_MODEL_OPTIONS: JSON model options
|
|
25
25
|
# XDG_CONFIG_HOME: Custom config directory location
|
|
26
26
|
# DEBUG: Set to 1 for verbose output
|
|
27
27
|
|
|
@@ -111,7 +111,7 @@ def compute_change(range_from, range_to, future_tag: range_to)
|
|
|
111
111
|
model = ENV.fetch('OLLAMA_MODEL', 'llama3.1')
|
|
112
112
|
system = config.read('system.txt')
|
|
113
113
|
prompt = config.read('prompt.txt') + "\n\n#{log}\n"
|
|
114
|
-
client_config = Client::Config.
|
|
114
|
+
client_config = Client::Config[**JSON.parse(ENV.fetch('OLLAMA_CLIENT', '{}'))]
|
|
115
115
|
client_config.base_url = base_url
|
|
116
116
|
|
|
117
117
|
if ENV['DEBUG'].to_i == 1
|
|
@@ -120,7 +120,7 @@ def compute_change(range_from, range_to, future_tag: range_to)
|
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
ollama = Client.configure_with(client_config)
|
|
123
|
-
options = Options.
|
|
123
|
+
options = Options.from_hash(JSON.parse(ENV.fetch('OLLAMA_MODEL_OPTIONS', '{}')))
|
|
124
124
|
changes = ollama.generate(model:, system:, prompt:, options:, stream: false, think: false)
|
|
125
125
|
changes = changes.response.gsub(/\t/, ' ')
|
|
126
126
|
|
data/bin/charpick
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
#
|
|
9
9
|
# Usage:
|
|
10
10
|
# charpick # interactive search
|
|
11
|
-
# charpick
|
|
11
|
+
# charpick rightwarrow # pre-fill the search field
|
|
12
12
|
#
|
|
13
13
|
# Requires the search_ui (>= 0.2), amatch, and tins gems.
|
|
14
14
|
|
|
@@ -42,8 +42,6 @@ module Charpick
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
# Downloads the UCD character database into the cache directory.
|
|
45
|
-
#
|
|
46
|
-
# @return [ void ]
|
|
47
45
|
def self.download
|
|
48
46
|
uri = URI(DATA_URL)
|
|
49
47
|
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
|
@@ -98,14 +96,14 @@ selected = SearchUI::Search.new(
|
|
|
98
96
|
match: -> answer {
|
|
99
97
|
return [] if answer.empty?
|
|
100
98
|
matcher = Amatch::PairDistance.new(answer.downcase)
|
|
101
|
-
entries.map { |entry| [ entry, matcher.similar(entry.name) ] }
|
|
99
|
+
entries.map { |entry| [ entry, matcher.similar(entry.name, ?-) ] }
|
|
102
100
|
.select { |_, score| score > 0 }
|
|
103
101
|
.sort_by { |_, score| -score }
|
|
104
102
|
.first(limit)
|
|
105
103
|
.map(&:first)
|
|
106
104
|
},
|
|
107
105
|
query: -> _answer, matches, selector {
|
|
108
|
-
return 'Type to search names (e.g. "
|
|
106
|
+
return 'Type to search names (e.g. "rightwarrow").' if matches.empty?
|
|
109
107
|
matches.each_with_index.map do |entry, i|
|
|
110
108
|
line = "%s U+%04X %s" % [ entry.char, entry.codepoint, entry.name ]
|
|
111
109
|
i == selector ? "→ " + SearchUI::Search.on_blue(line) : " " + line
|
data/bin/code_comment
CHANGED
|
@@ -16,12 +16,13 @@
|
|
|
16
16
|
# - Configuration files in ~/.config/code_comment/
|
|
17
17
|
# - system.txt: System prompt for LLM
|
|
18
18
|
# - prompt.txt: Template for comment generation
|
|
19
|
-
#
|
|
20
|
-
# - options.json: Generation options (temperature, etc.)
|
|
19
|
+
#
|
|
21
20
|
#
|
|
22
21
|
# Environment variables:
|
|
23
22
|
# OLLAMA_URL: Base URL of Ollama server
|
|
24
23
|
# OLLAMA_MODEL: Model to use (default: llama3.1)
|
|
24
|
+
# OLLAMA_CLIENT: JSON client configuration
|
|
25
|
+
# OLLAMA_MODEL_OPTIONS: JSON model options
|
|
25
26
|
# XDG_CONFIG_HOME: Custom config directory location
|
|
26
27
|
# DEBUG: Set to 1 for verbose output and debug.log creation
|
|
27
28
|
#
|
|
@@ -254,10 +255,10 @@ default_options = JSON(
|
|
|
254
255
|
min_p: 0.1,
|
|
255
256
|
)
|
|
256
257
|
|
|
257
|
-
client_config = Client::Config.
|
|
258
|
+
client_config = Client::Config[**JSON.parse(ENV.fetch('OLLAMA_CLIENT', '{}'))]
|
|
258
259
|
client_config.base_url = base_url
|
|
259
260
|
ollama = Client.configure_with(client_config)
|
|
260
|
-
options = JSON.parse(
|
|
261
|
+
options = Options.from_hash(JSON.parse(ENV.fetch('OLLAMA_MODEL_OPTIONS', default_options)))
|
|
261
262
|
|
|
262
263
|
if ENV['DEBUG'].to_i == 1
|
|
263
264
|
File.open('debug.log', ?w) do |log|
|
data/bin/code_indexer
CHANGED
|
@@ -14,7 +14,7 @@ config.code_indexer.formats.each do |format, output|
|
|
|
14
14
|
puts "Indexing code for #{format}…"
|
|
15
15
|
case format
|
|
16
16
|
when 'ctags'
|
|
17
|
-
cmd = [ 'ctags', '-f', output, '--exclude=pkg', '-R' ]
|
|
17
|
+
cmd = [ 'ctags', '-f', output, '--sort=no', '--exclude=pkg', '-R' ]
|
|
18
18
|
config.code_indexer.verbose and cmd << '--verbose'
|
|
19
19
|
when 'cscope'
|
|
20
20
|
cmd = [ 'starscope', '-e', format, '-f', output, '--no-read' ]
|
data/bin/commit_message
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#
|
|
11
11
|
# The script automatically:
|
|
12
12
|
# - Determines current git branch name
|
|
13
|
-
# - Loads configuration files (
|
|
13
|
+
# - Loads configuration files (system.txt, prompt.txt)
|
|
14
14
|
# - Generates commit message using ollama_cli with the current diff as input
|
|
15
15
|
#
|
|
16
16
|
# Requirements:
|
|
@@ -20,10 +20,12 @@
|
|
|
20
20
|
# - Configuration files in $XDG_CONFIG_HOME/commit_message/
|
|
21
21
|
#
|
|
22
22
|
# Configuration files:
|
|
23
|
-
# - client.json: Ollama API client configuration
|
|
24
|
-
# - options.json: Generation options
|
|
25
23
|
# - system.txt: System prompt for AI model
|
|
26
24
|
# - prompt.txt: Commit message template, contains %{branch} and %{stdin}
|
|
25
|
+
#
|
|
26
|
+
# Environment variables (used by ollama_cli):
|
|
27
|
+
# - OLLAMA_CLIENT: JSON client configuration
|
|
28
|
+
# - OLLAMA_MODEL_OPTIONS: JSON model options
|
|
27
29
|
|
|
28
30
|
require 'utils'
|
|
29
31
|
include Utils::XDG
|
|
@@ -31,6 +33,6 @@ include Utils::XDG
|
|
|
31
33
|
config = XDG_CONFIG_HOME + 'commit_message'
|
|
32
34
|
|
|
33
35
|
branch = `git rev-parse --abbrev-ref HEAD`.chomp
|
|
34
|
-
exec 'ollama_cli',
|
|
35
|
-
'-
|
|
36
|
+
exec 'ollama_cli',
|
|
37
|
+
'-P', "branch=#{branch}",
|
|
36
38
|
'-s', config + 'system.txt', '-p', config + 'prompt.txt'
|
data/bin/irb_client
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# irb_client — interact with a running IRB session remotely.
|
|
4
|
+
#
|
|
5
|
+
# Start the server by typing `irb_server` in your IRB session (provided by
|
|
6
|
+
# require 'utils/irb'). Then send code snippets from the command line:
|
|
7
|
+
#
|
|
8
|
+
# echo '2 + 2' | irb_client eval_snippet # => 4
|
|
9
|
+
# echo 'puts "hi"' | irb_client execute_snippet
|
|
10
|
+
# irb_client stop_server
|
|
2
11
|
|
|
3
12
|
require 'utils/irb'
|
|
4
13
|
include Utils::IRB
|
data/lib/utils/version.rb
CHANGED
data/utils.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: utils 0.
|
|
2
|
+
# stub: utils 0.99.0 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "utils".freeze
|
|
6
|
-
s.version = "0.
|
|
6
|
+
s.version = "0.99.0".freeze
|
|
7
7
|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
9
|
s.require_paths = ["lib".freeze]
|
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
s.homepage = "http://github.com/flori/utils".freeze
|
|
18
18
|
s.licenses = ["GPL-2.0".freeze]
|
|
19
19
|
s.rdoc_options = ["--title".freeze, "Utils - Some useful command line utilities".freeze, "--main".freeze, "README.md".freeze]
|
|
20
|
-
s.rubygems_version = "4.0.
|
|
20
|
+
s.rubygems_version = "4.0.20".freeze
|
|
21
21
|
s.summary = "Some useful command line utilities".freeze
|
|
22
22
|
s.test_files = ["tests/test_helper.rb".freeze, "tests/utils_test.rb".freeze]
|
|
23
23
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.99.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -432,7 +432,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
432
432
|
- !ruby/object:Gem::Version
|
|
433
433
|
version: '0'
|
|
434
434
|
requirements: []
|
|
435
|
-
rubygems_version: 4.0.
|
|
435
|
+
rubygems_version: 4.0.20
|
|
436
436
|
specification_version: 4
|
|
437
437
|
summary: Some useful command line utilities
|
|
438
438
|
test_files:
|