hiiro 0.1.91 → 0.1.92
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/CLAUDE.md +17 -5
- data/bin/h-plugin +2 -2
- data/lib/hiiro/{prefix_matcher.rb → matcher.rb} +63 -14
- data/lib/hiiro/version.rb +1 -1
- data/lib/hiiro.rb +1 -1
- data/plugins/pins.rb +1 -1
- data/plugins/tasks.rb +5 -5
- 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: a225754bf06275debc8ce5bad696541103d1a062a2d4a5565f2b3ce34d628983
|
|
4
|
+
data.tar.gz: 4c7d7f4c88694b90a05254908558eabe0cd54f944b7fe0ba8c76ff0baba64a15
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 381d57d3d69d3da9a47dedf7ed379b0b81706902523e2bb8158593e5240dddc69f00f460b41f4a8ec3d3294a5d91c117ecd689df845e7576122934466e2a12a7
|
|
7
|
+
data.tar.gz: e1ee7670dd9b3d3f580eeb76c5f6032e9e9dd48afe0ebaa6e8510488c3bba81a99457e5ad1d2d1ea39488ca1630ffc33d46dbbf9fb84d1c14ccd24ff8a988dba
|
data/CLAUDE.md
CHANGED
|
@@ -161,23 +161,35 @@ Instance methods available in subcommand blocks:
|
|
|
161
161
|
- `attach_method(name, &block)` - Add methods to hiiro instance dynamically
|
|
162
162
|
- `make_child(subcmd, *args)` - Create nested Hiiro for sub-subcommands
|
|
163
163
|
|
|
164
|
-
### Hiiro::
|
|
164
|
+
### Hiiro::Matcher (lib/hiiro/matcher.rb)
|
|
165
165
|
|
|
166
|
-
Handles
|
|
166
|
+
Handles pattern matching for commands and items with prefix and substring matching:
|
|
167
167
|
|
|
168
168
|
```ruby
|
|
169
|
-
matcher = Hiiro::
|
|
170
|
-
|
|
169
|
+
matcher = Hiiro::Matcher.new(items, :name)
|
|
170
|
+
|
|
171
|
+
# Prefix matching - find items where name starts with pattern
|
|
172
|
+
result = matcher.by_prefix("pre")
|
|
171
173
|
result.match? # Any matches?
|
|
172
174
|
result.one? # Exactly one match?
|
|
173
175
|
result.ambiguous? # Multiple matches?
|
|
174
176
|
result.first&.item # Get first matching item
|
|
175
177
|
result.resolved&.item # Get exact or single match
|
|
176
178
|
|
|
179
|
+
# Substring matching - find items where name contains pattern anywhere
|
|
180
|
+
result = matcher.by_substring("abc")
|
|
181
|
+
result.matches.map(&:item) # All matching items
|
|
182
|
+
|
|
177
183
|
# Path-based matching for hierarchical names (e.g., "task/subtask")
|
|
178
184
|
result = matcher.resolve_path("t/s")
|
|
185
|
+
|
|
186
|
+
# Class methods for one-off matching
|
|
187
|
+
Hiiro::Matcher.by_prefix(items, "pre", key: :name)
|
|
188
|
+
Hiiro::Matcher.by_substring(items, "abc", key: :name)
|
|
179
189
|
```
|
|
180
190
|
|
|
191
|
+
Note: `Hiiro::PrefixMatcher` is aliased to `Hiiro::Matcher` for backward compatibility.
|
|
192
|
+
|
|
181
193
|
### Hiiro::Git (lib/hiiro/git.rb)
|
|
182
194
|
|
|
183
195
|
Git operations wrapper with submodules for branches, worktrees, remotes, and PRs:
|
|
@@ -235,7 +247,7 @@ History.by_session("work") # Filter by tmux session
|
|
|
235
247
|
- `bin/h-*` - External subcommands (tmux wrappers, video operations)
|
|
236
248
|
- `plugins/*.rb` - Reusable plugin modules (Pins, Project, Task, Tmux, Notify)
|
|
237
249
|
- `lib/hiiro.rb` - Main Hiiro class and Runners
|
|
238
|
-
- `lib/hiiro/*.rb` - Supporting classes (Git,
|
|
250
|
+
- `lib/hiiro/*.rb` - Supporting classes (Git, Matcher, Fuzzyfind, Todo, History)
|
|
239
251
|
|
|
240
252
|
## External Dependencies
|
|
241
253
|
|
data/bin/h-plugin
CHANGED
|
@@ -23,8 +23,8 @@ o.add_subcmd(:edit) { |*args|
|
|
|
23
23
|
if args.none?
|
|
24
24
|
system(ENV['EDITOR'] || 'safe_nvim', __FILE__)
|
|
25
25
|
else
|
|
26
|
-
pm = Hiiro::
|
|
27
|
-
plugins = args.flat_map { |arg| pm.
|
|
26
|
+
pm = Hiiro::Matcher.new(plugin_files) { |f| File.basename(f) }
|
|
27
|
+
plugins = args.flat_map { |arg| pm.by_prefix(arg).matches.map(&:item) }.uniq
|
|
28
28
|
|
|
29
29
|
if plugins.none?
|
|
30
30
|
puts "No matching plugins found for: #{args.map(&:inspect).join(' ')}"
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
class Hiiro
|
|
2
|
-
class
|
|
2
|
+
class Matcher
|
|
3
3
|
class << self
|
|
4
|
+
# Prefix matching class methods
|
|
4
5
|
def find(items, prefix, key: nil, &block)
|
|
5
|
-
new(items, key, &block).
|
|
6
|
+
new(items, key, &block).by_prefix(prefix)
|
|
6
7
|
end
|
|
7
8
|
|
|
8
9
|
def find_all(items, prefix, key: nil, &block)
|
|
9
|
-
new(items, key, &block).
|
|
10
|
+
new(items, key, &block).by_prefix(prefix)
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
def resolve(items, prefix, key: nil, &block)
|
|
13
|
-
new(items, key, &block).
|
|
14
|
+
new(items, key, &block).by_prefix(prefix)
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
def find_path(items, prefix, key: nil, &block)
|
|
@@ -24,6 +25,16 @@ class Hiiro
|
|
|
24
25
|
def resolve_path(items, prefix, key: nil, &block)
|
|
25
26
|
new(items, key, &block).resolve_path(prefix)
|
|
26
27
|
end
|
|
28
|
+
|
|
29
|
+
# Substring matching class methods
|
|
30
|
+
def by_substring(items, substring, key: nil, &block)
|
|
31
|
+
new(items, key, &block).by_substring(substring)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Prefix matching class methods (explicit)
|
|
35
|
+
def by_prefix(items, prefix, key: nil, &block)
|
|
36
|
+
new(items, key, &block).by_prefix(prefix)
|
|
37
|
+
end
|
|
27
38
|
end
|
|
28
39
|
|
|
29
40
|
attr_reader :original_items, :key, :block
|
|
@@ -51,28 +62,48 @@ class Hiiro
|
|
|
51
62
|
}
|
|
52
63
|
end
|
|
53
64
|
|
|
54
|
-
|
|
65
|
+
# Primary prefix matching method
|
|
66
|
+
def by_prefix(prefix, key = nil, &block)
|
|
55
67
|
Result.new(
|
|
56
68
|
matcher: self,
|
|
57
69
|
all_items: all_items(key, &block),
|
|
58
|
-
|
|
70
|
+
pattern: prefix,
|
|
71
|
+
match_type: :prefix,
|
|
59
72
|
key: key || @key,
|
|
60
73
|
block: block || @block
|
|
61
74
|
)
|
|
62
75
|
end
|
|
63
76
|
|
|
77
|
+
# Primary substring matching method
|
|
78
|
+
def by_substring(substring, key = nil, &block)
|
|
79
|
+
Result.new(
|
|
80
|
+
matcher: self,
|
|
81
|
+
all_items: all_items(key, &block),
|
|
82
|
+
pattern: substring,
|
|
83
|
+
match_type: :substring,
|
|
84
|
+
key: key || @key,
|
|
85
|
+
block: block || @block
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Legacy method aliases for backward compatibility
|
|
90
|
+
def search(prefix, key = nil, &block)
|
|
91
|
+
by_prefix(prefix, key, &block)
|
|
92
|
+
end
|
|
93
|
+
|
|
64
94
|
def find(prefix, key = nil, &block)
|
|
65
|
-
|
|
95
|
+
by_prefix(prefix, key, &block)
|
|
66
96
|
end
|
|
67
97
|
|
|
68
98
|
def find_all(prefix, key = nil, &block)
|
|
69
|
-
|
|
99
|
+
by_prefix(prefix, key, &block)
|
|
70
100
|
end
|
|
71
101
|
|
|
72
102
|
def resolve(prefix, key = nil, &block)
|
|
73
|
-
|
|
103
|
+
by_prefix(prefix, key, &block)
|
|
74
104
|
end
|
|
75
105
|
|
|
106
|
+
# Path-based matching
|
|
76
107
|
def find_path(prefix, key = nil, &block)
|
|
77
108
|
search_path(prefix, key, &block)
|
|
78
109
|
end
|
|
@@ -119,18 +150,33 @@ class Hiiro
|
|
|
119
150
|
end
|
|
120
151
|
|
|
121
152
|
class Result
|
|
122
|
-
attr_reader :matcher, :all_items, :key, :block, :
|
|
153
|
+
attr_reader :matcher, :all_items, :key, :block, :pattern, :match_type
|
|
123
154
|
|
|
124
|
-
def initialize(matcher:, all_items:,
|
|
155
|
+
def initialize(matcher:, all_items:, pattern:, match_type: :prefix, key: nil, block: nil)
|
|
125
156
|
@matcher = matcher
|
|
126
157
|
@all_items = all_items
|
|
127
|
-
@
|
|
158
|
+
@pattern = pattern
|
|
159
|
+
@match_type = match_type
|
|
128
160
|
@key = key
|
|
129
161
|
@block = block
|
|
130
162
|
end
|
|
131
163
|
|
|
164
|
+
# Alias for backward compatibility
|
|
165
|
+
def prefix
|
|
166
|
+
pattern
|
|
167
|
+
end
|
|
168
|
+
|
|
132
169
|
def matches
|
|
133
|
-
@matches ||= all_items.select { |item|
|
|
170
|
+
@matches ||= all_items.select { |item|
|
|
171
|
+
case match_type
|
|
172
|
+
when :prefix
|
|
173
|
+
item.extracted_item.to_s.start_with?(pattern.to_s)
|
|
174
|
+
when :substring
|
|
175
|
+
item.extracted_item.to_s.include?(pattern.to_s)
|
|
176
|
+
else
|
|
177
|
+
item.extracted_item.to_s.start_with?(pattern.to_s)
|
|
178
|
+
end
|
|
179
|
+
}
|
|
134
180
|
end
|
|
135
181
|
|
|
136
182
|
def count
|
|
@@ -142,7 +188,7 @@ class Hiiro
|
|
|
142
188
|
end
|
|
143
189
|
|
|
144
190
|
def exact_match
|
|
145
|
-
all_items.find { |item| item.extracted_item ==
|
|
191
|
+
all_items.find { |item| item.extracted_item == pattern }
|
|
146
192
|
end
|
|
147
193
|
|
|
148
194
|
def match
|
|
@@ -238,4 +284,7 @@ class Hiiro
|
|
|
238
284
|
end
|
|
239
285
|
end
|
|
240
286
|
end
|
|
287
|
+
|
|
288
|
+
# Backward compatibility alias
|
|
289
|
+
PrefixMatcher = Matcher
|
|
241
290
|
end
|
data/lib/hiiro/version.rb
CHANGED
data/lib/hiiro.rb
CHANGED
data/plugins/pins.rb
CHANGED
data/plugins/tasks.rb
CHANGED
|
@@ -178,19 +178,19 @@ class Environment
|
|
|
178
178
|
end
|
|
179
179
|
|
|
180
180
|
def tree_matcher
|
|
181
|
-
@tree_matcher ||= Hiiro::
|
|
181
|
+
@tree_matcher ||= Hiiro::Matcher.new(all_trees, :name)
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
def session_matcher
|
|
185
|
-
@session_matcher ||= Hiiro::
|
|
185
|
+
@session_matcher ||= Hiiro::Matcher.new(all_sessions, :name)
|
|
186
186
|
end
|
|
187
187
|
|
|
188
188
|
def app_matcher
|
|
189
|
-
@app_matcher ||= Hiiro::
|
|
189
|
+
@app_matcher ||= Hiiro::Matcher.new(all_apps, :name)
|
|
190
190
|
end
|
|
191
191
|
|
|
192
192
|
def task_matcher
|
|
193
|
-
@task_matcher ||= Hiiro::
|
|
193
|
+
@task_matcher ||= Hiiro::Matcher.new(all_tasks, :name)
|
|
194
194
|
end
|
|
195
195
|
|
|
196
196
|
def task
|
|
@@ -286,7 +286,7 @@ class TaskManager
|
|
|
286
286
|
return slash_lookup(name) if name.include?('/')
|
|
287
287
|
|
|
288
288
|
key = (scope == :subtask) ? :short_name : :name
|
|
289
|
-
Hiiro::
|
|
289
|
+
Hiiro::Matcher.new(tasks, key).by_prefix(name).first&.item
|
|
290
290
|
end
|
|
291
291
|
|
|
292
292
|
def task_by_tree(tree_name)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hiiro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.92
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joshua Toyota
|
|
@@ -103,9 +103,9 @@ files:
|
|
|
103
103
|
- lib/hiiro/git/remote.rb
|
|
104
104
|
- lib/hiiro/git/worktree.rb
|
|
105
105
|
- lib/hiiro/git/worktrees.rb
|
|
106
|
+
- lib/hiiro/matcher.rb
|
|
106
107
|
- lib/hiiro/notification.rb
|
|
107
108
|
- lib/hiiro/options.rb
|
|
108
|
-
- lib/hiiro/prefix_matcher.rb
|
|
109
109
|
- lib/hiiro/shell.rb
|
|
110
110
|
- lib/hiiro/todo.rb
|
|
111
111
|
- lib/hiiro/version.rb
|