utils 0.97.0 → 0.98.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '088f06f0b7afc673dfe77ddc10735e335adc01e5a2123162fc518be1f16d233e'
4
- data.tar.gz: 9a4b0425541b6f7ef5174a4fa31fb6f582014de7e5f5f158d69b2dedc169fd7c
3
+ metadata.gz: b7b648dddabd119635d9e6f1371b5272b44b27118610b145a3fcec5f2b125ac1
4
+ data.tar.gz: 2aaa35ea9a54d83f078fcff03ea95a932322ef72ddcb7b36d4d9a4bac1d80f6f
5
5
  SHA512:
6
- metadata.gz: 9a66320d7a7b3cd863660fb3e4f2944631c0340ffb3e16f1c35afc6b00505f124956ba23bfb7f2b4d7b46563074b0201a039dbfc52aef5ba0864fab85b1ccdb2
7
- data.tar.gz: d193b6d96ad83d2f8846746a69f72318d817d3a8560edddb551d35a022b5267be23fa8c997b626a738dae9a6c7d17f7d2a4be39b0852fb4e762923e3b8284850
6
+ metadata.gz: 4aa8628eed6a56f6e8c1da5d336bec9bd76417dc1006a212504b3ce0bdf7dc4d293c26fbea777a8e8a3af490eb5a54ab24156dafd579b81d07cfe1a4937038b3
7
+ data.tar.gz: b83d729b88f9588665d14d0508b4e7592ccd0e925dbc59c9da60f282a5033e8912e23047a64443c178f36afa13c6ef05bb294079f0741beaebf3dd46dd8f9f66
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.load_from_json(config + 'client.json')
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.load_from_json "#{config}/options.json"
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
@@ -98,7 +98,7 @@ selected = SearchUI::Search.new(
98
98
  match: -> answer {
99
99
  return [] if answer.empty?
100
100
  matcher = Amatch::PairDistance.new(answer.downcase)
101
- entries.map { |entry| [ entry, matcher.similar(entry.name) ] }
101
+ entries.map { |entry| [ entry, matcher.similar(entry.name, ?-) ] }
102
102
  .select { |_, score| score > 0 }
103
103
  .sort_by { |_, score| -score }
104
104
  .first(limit)
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
- # - client.json: Ollama client settings
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.load_from_json $config_dir + 'client.json'
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($config_dir.read('options.json', default: default_options))
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/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 (client.json, options.json, system.txt, prompt.txt)
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', '-c', config + 'client.json',
35
- '-M', config + 'options.json', '-P', "branch=#{branch}",
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
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.97.0'
3
+ VERSION = '0.98.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/utils.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.97.0 ruby lib
2
+ # stub: utils 0.98.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "utils".freeze
6
- s.version = "0.97.0".freeze
6
+ s.version = "0.98.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.17".freeze
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.97.0
4
+ version: 0.98.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.17
435
+ rubygems_version: 4.0.20
436
436
  specification_version: 4
437
437
  summary: Some useful command line utilities
438
438
  test_files: