hiiro 0.1.86 → 0.1.87

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.
data/lib/hiiro.rb CHANGED
@@ -6,10 +6,9 @@ require "pry"
6
6
  require_relative "hiiro/version"
7
7
  require_relative "hiiro/prefix_matcher"
8
8
  require_relative "hiiro/git"
9
- require_relative "hiiro/history"
10
9
  require_relative "hiiro/options"
11
10
  require_relative "hiiro/notification"
12
- require_relative "hiiro/sk"
11
+ require_relative "hiiro/fuzzyfind"
13
12
  require_relative "hiiro/todo"
14
13
 
15
14
  class String
@@ -39,7 +38,6 @@ class Hiiro
39
38
  bin_name = values[:bin_name] || $0
40
39
 
41
40
  new(bin_name, *args, logging: logging, **values).tap do |hiiro|
42
- History.load(hiiro)
43
41
  hiiro.load_plugins(*plugins)
44
42
 
45
43
  hiiro.add_subcommand(:pry) { |*args|
@@ -104,16 +102,9 @@ class Hiiro
104
102
  @todo_manager ||= TodoManager.new
105
103
  end
106
104
 
107
- def history
108
- @history ||= History.new
109
- end
110
-
111
105
  def run
112
106
  result = runner.run(*args)
113
107
 
114
- # Track command after running (only saves if state changed and in task context)
115
- History.track(cmd: full_command, hiiro: self)
116
-
117
108
  handle_result(result)
118
109
 
119
110
  exit 1
@@ -248,8 +239,12 @@ class Hiiro
248
239
  i = Args.new(*args)
249
240
  end
250
241
 
251
- def sk(lines)
252
- Sk.select(lines)
242
+ def fuzzyfind(lines)
243
+ Fuzzyfind.select(lines)
244
+ end
245
+
246
+ def fuzzyfind_from_map(mapping)
247
+ Fuzzyfind.map_select(mapping)
253
248
  end
254
249
 
255
250
  def get_value(name)
data/plugins/tasks.rb CHANGED
@@ -599,7 +599,7 @@ class TaskManager
599
599
  end
600
600
  end
601
601
 
602
- def help
602
+ def DELETEME_help
603
603
  scope_name = scope.to_s
604
604
  puts "Usage: h #{scope_name} <subcommand> [args]"
605
605
  puts
@@ -627,7 +627,7 @@ class TaskManager
627
627
  end
628
628
  return nil if names.empty?
629
629
 
630
- sk_select(names.sort)
630
+ hiiro.fuzzyfind(names.sort)
631
631
  end
632
632
 
633
633
  def value_for_task(task_name = nil, &block)
@@ -646,7 +646,7 @@ class TaskManager
646
646
  h[line] = val
647
647
  end
648
648
 
649
- Hiiro::Sk.map_select(mapping)
649
+ o.fuzzyfind_from_map(mapping)
650
650
  end
651
651
 
652
652
  def select_branch_interactive(prompt = nil)
@@ -657,7 +657,7 @@ class TaskManager
657
657
  end
658
658
  return nil if name_map.empty?
659
659
 
660
- Hiiro::Sk.map_select(name_map)
660
+ o.fuzzyfind_from_map(name_map)
661
661
  end
662
662
 
663
663
  # --- Private helpers ---
@@ -735,7 +735,7 @@ class TaskManager
735
735
  end
736
736
 
737
737
  def sk_select(items)
738
- Hiiro::Sk.select(items)
738
+ hiiro.fuzzyfind(items) # Hiiro::Fuzzyfind.select(items)
739
739
  end
740
740
 
741
741
  class Config
@@ -878,7 +878,7 @@ module Tasks
878
878
  h.add_subcmd(:app) do |app_name=nil|
879
879
  if app_name.nil?
880
880
  names = tm.environment.all_apps.map(&:name)
881
- app_name = tm.send(:sk_select, names)
881
+ app_name = h.fuzzyfind(names)
882
882
  next unless app_name
883
883
  end
884
884
  tm.open_app(app_name)
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.86
4
+ version: 0.1.87
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-02-14 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: pry
@@ -93,6 +94,7 @@ files:
93
94
  - exe/h
94
95
  - hiiro.gemspec
95
96
  - lib/hiiro.rb
97
+ - lib/hiiro/fuzzyfind.rb
96
98
  - lib/hiiro/git.rb
97
99
  - lib/hiiro/git/branch.rb
98
100
  - lib/hiiro/git/branches.rb
@@ -100,13 +102,10 @@ files:
100
102
  - lib/hiiro/git/remote.rb
101
103
  - lib/hiiro/git/worktree.rb
102
104
  - lib/hiiro/git/worktrees.rb
103
- - lib/hiiro/history.rb
104
- - lib/hiiro/history/entry.rb
105
105
  - lib/hiiro/notification.rb
106
106
  - lib/hiiro/options.rb
107
107
  - lib/hiiro/prefix_matcher.rb
108
108
  - lib/hiiro/shell.rb
109
- - lib/hiiro/sk.rb
110
109
  - lib/hiiro/todo.rb
111
110
  - lib/hiiro/version.rb
112
111
  - notes
@@ -128,6 +127,7 @@ metadata:
128
127
  homepage_uri: https://github.com/unixsuperhero/hiiro
129
128
  source_code_uri: https://github.com/unixsuperhero/hiiro
130
129
  changelog_uri: https://github.com/unixsuperhero/hiiro/blob/main/CHANGELOG.md
130
+ post_install_message:
131
131
  rdoc_options: []
132
132
  require_paths:
133
133
  - lib
@@ -142,7 +142,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
- rubygems_version: 4.0.3
145
+ rubygems_version: 3.3.7
146
+ signing_key:
146
147
  specification_version: 4
147
148
  summary: A lightweight CLI framework for Ruby
148
149
  test_files: []
@@ -1,136 +0,0 @@
1
- class Hiiro
2
- class History
3
- class Entry
4
- FIELDS = %i[
5
- id timestamp source cmd description pwd
6
- tmux_session tmux_window tmux_pane
7
- git_branch git_sha git_origin_sha git_worktree
8
- task subtask app
9
- ].freeze
10
-
11
- attr_reader(*FIELDS)
12
-
13
- def initialize(data)
14
- data ||= {}
15
- @id = data['id']
16
- @timestamp = data['timestamp']
17
- @source = data['source']
18
- @cmd = data['cmd']
19
- @description = data['description']
20
- @pwd = data['pwd']
21
- @tmux_session = data['tmux_session']
22
- @tmux_window = data['tmux_window']
23
- @tmux_pane = data['tmux_pane']
24
- @git_branch = data['git_branch']
25
- @git_sha = data['git_sha']
26
- @git_origin_sha = data['git_origin_sha']
27
- @git_worktree = data['git_worktree']
28
- @task = data['task']
29
- @subtask = data['subtask']
30
- @app = data['app']
31
- end
32
-
33
- def to_h
34
- {
35
- 'id' => id,
36
- 'timestamp' => timestamp,
37
- 'source' => source,
38
- 'cmd' => cmd,
39
- 'description' => description,
40
- 'pwd' => pwd,
41
- 'tmux_session' => tmux_session,
42
- 'tmux_window' => tmux_window,
43
- 'tmux_pane' => tmux_pane,
44
- 'git_branch' => git_branch,
45
- 'git_sha' => git_sha,
46
- 'git_origin_sha' => git_origin_sha,
47
- 'git_worktree' => git_worktree,
48
- 'task' => task,
49
- 'subtask' => subtask,
50
- 'app' => app,
51
- }.compact
52
- end
53
-
54
- # Data used for change detection (excludes timestamp, id, cmd)
55
- def state_key
56
- {
57
- 'pwd' => pwd,
58
- 'tmux_session' => tmux_session,
59
- 'tmux_window' => tmux_window,
60
- 'tmux_pane' => tmux_pane,
61
- 'git_branch' => git_branch,
62
- 'git_sha' => git_sha,
63
- 'git_origin_sha' => git_origin_sha,
64
- 'git_worktree' => git_worktree,
65
- 'task' => task,
66
- 'subtask' => subtask,
67
- 'app' => app,
68
- }.compact
69
- end
70
-
71
- def state_fingerprint
72
- Digest::SHA256.hexdigest(state_key.to_yaml)[0..15]
73
- end
74
-
75
- def short_line(index)
76
- time_str = timestamp ? Time.parse(timestamp).strftime('%Y-%m-%d %H:%M') : Time.now.strftime('%Y-%m-%d %H:%M')
77
- desc = description || cmd || '(no description)'
78
- desc = desc[0..50] + '...' if desc.length > 53
79
- [
80
- format('%3d %s %s', index, time_str, desc),
81
- format(' %s @ %s', git_branch || '(no branch)', task || '(no task)'),
82
- ].join("\n")
83
- end
84
-
85
- def oneline(index = nil)
86
- time_str = timestamp ? Time.parse(timestamp).strftime('%m/%d %H:%M') : ''
87
- prefix = index ? format('%3d ', index) : ''
88
- sha_str = git_sha ? git_sha[0..6] : '-------'
89
- branch_str = git_branch ? "[#{git_branch}]" : ''
90
- task_str = task ? "(#{task})" : ''
91
- cmd_str = cmd || description || ''
92
- cmd_str = cmd_str[0..35] + '...' if cmd_str.length > 38
93
-
94
- "#{prefix}#{time_str} #{sha_str} #{branch_str.ljust(20)} #{task_str.ljust(15)} #{cmd_str}"
95
- end
96
-
97
- def full_display
98
- lines = []
99
- lines << "ID: #{id}"
100
- lines << "Timestamp: #{timestamp}"
101
- lines << "Description: #{description}" if description
102
- lines << "Command: #{cmd}" if cmd
103
- lines << "PWD: #{pwd}" if pwd
104
- lines << "Source: #{source}" if source
105
- lines << ""
106
- lines << "Tmux:"
107
- lines << " Session: #{tmux_session}" if tmux_session
108
- lines << " Window: #{tmux_window}" if tmux_window
109
- lines << " Pane: #{tmux_pane}" if tmux_pane
110
- lines << ""
111
- lines << "Git:"
112
- lines << " Worktree: #{git_worktree}" if git_worktree
113
- lines << " Branch: #{git_branch}" if git_branch
114
- lines << " SHA: #{git_sha}" if git_sha
115
- lines << " Origin: #{git_origin_sha}" if git_origin_sha
116
- lines << ""
117
- lines << "Task:"
118
- lines << " Task: #{task}" if task
119
- lines << " Subtask: #{subtask}" if subtask
120
- lines << " App: #{app}" if app
121
- lines.join("\n")
122
- end
123
-
124
- # Filter matching
125
- def matches?(filters)
126
- filters.all? do |key, value|
127
- entry_value = send(key) rescue nil
128
- next true if value.nil?
129
- next entry_value == value if value.is_a?(String)
130
- next value.include?(entry_value) if value.is_a?(Array)
131
- true
132
- end
133
- end
134
- end
135
- end
136
- end