hiiro 0.1.321 → 0.1.323

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: 155f21221068bb182837aa80c7b920edfb592d46003cc697761441fca7e104d4
4
- data.tar.gz: c911e69d3f63924790edd1103f299450ee19bbf70587f54ab205817a0ed9956b
3
+ metadata.gz: 3f0e6f5a6312065c5ed74198ae2c2eb9e2a00b313a716946c920722805908ecf
4
+ data.tar.gz: 88a43b3e4225ef3ce0d99b7eeb7f31d0aa3b4adc521ea7563d31f3ef4bed203c
5
5
  SHA512:
6
- metadata.gz: e7f3f13b81a41a625160d27c7e90a093f20678cd835f5ef1eadc95999fa00c17b41eaac793135389573746e233120b41f94363f87e59bbffac1357c9a573db47
7
- data.tar.gz: 195f053e63a71b2975b4fb29addb85893e91012b1482e08547169e762d4651d9397c0a228b9e29735b3e16928d37f2cee906281ed0e674155366806590e7bdaa
6
+ metadata.gz: b79f44eab5cd1d65e6fe231242cd82492d280356d5ca571ec3d012b0b36c5d06e21b1d914bd37a6b7a98b1ad7f108e2fbefcffb127ff6efa19fa1c869e449410
7
+ data.tar.gz: ddf1662f78450f2167db30dba65f582a5cf863ca123c69dc5a7be66917f3741bc179f7e6437970914b17714bd78c3776b7509d8fc226e7bf83a5103d53f4930d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.323] - 2026-04-01
4
+
5
+ ### Changed
6
+ - Simplify `h pr ls` status refresh logic: always call `refresh_all_status` with `force:` parameter instead of conditional block
7
+ - Add optional `verbose:` parameter to `refresh_all_status` to control "already checked" message output
8
+ - Update `h pr update` to pass `verbose: true` when refreshing active PR status
9
+
10
+ ## [0.1.322] - 2026-04-01
11
+
12
+ ### Changed
13
+ - Refactor `h link tags` filtering logic to use new `Hiiro::Tag.tags_by_type` helper
14
+ - Simplify tag query to use `Hiiro::Link.where(id:)` instead of manual filtering
15
+ - Extract `tags_by_type(type)` singleton method to `Hiiro::Tag` for code reuse
16
+
3
17
  ## [0.1.321] - 2026-04-01
4
18
 
5
19
  ### Changed
@@ -271,4 +285,4 @@
271
285
  ## [0.1.295]
272
286
 
273
287
  ### Changed
274
- - Filter logic changes for PR management
288
+ - Filter logic changes for PR management
data/bin/h-link CHANGED
@@ -528,35 +528,21 @@ Hiiro.run(*ARGV, plugins: [Pins], links_file: lm.links_file) do
528
528
  end
529
529
 
530
530
  add_subcmd(:tags) do |*tag_args|
531
- all_known = Hiiro::Tag.where(taggable_type: 'Link').distinct.pluck(:name).sort
531
+ all_known = Hiiro::Tag.tags_by_type('Link')
532
+ filtered = all_known.select{|t|
533
+ tag_args.any?{|ta| t.start_with?(ta) }
534
+ }
532
535
 
533
- if tag_args.empty?
534
- if all_known.empty?
535
- puts "No tags found."
536
- else
537
- all_known.each { |t| puts t }
538
- end
539
- next
540
- end
541
-
542
- # Prefix-match the given args against known tags
543
- matched_tags = tag_args.flat_map { |arg|
544
- all_known.select { |t| t.start_with?(arg) }
545
- }.uniq
546
-
547
- if matched_tags.empty?
548
- puts "No tags match: #{tag_args.join(', ')}"
549
- next
550
- end
551
-
552
- # Batch-load all link tags to avoid N+1
553
- tagged_ids = Hiiro::Tag.where(taggable_type: 'Link', name: matched_tags).map { |t| t.taggable_id.to_i }.uniq
554
- links = lm.load_links.select { |link| tagged_ids.include?(link.id) }
555
-
556
- if links.empty?
557
- puts "No links tagged with: #{matched_tags.join(', ')}"
536
+ if filtered.empty?
537
+ puts "No tags found."
558
538
  else
559
- links.each_with_index { |link, idx| puts link.display_string(idx) }
539
+ filtered.each do |tag_name|
540
+ ids = Hiiro::Tag.where(taggable_type: 'Link', name: tag_name).select(:taggable_id).map(&:taggable_id).map(&:to_i)
541
+ # links = lm.load_links.select |link| tagged_ids.include?(link.id) }
542
+ links = Hiiro::Link.where(id: ids)
543
+ puts "#{tag_name}:"
544
+ links.each { |link| puts " #{link.display_string(exclude_tags: [tag_name])}" }
545
+ end
560
546
  end
561
547
  end
562
548
 
data/bin/h-pr CHANGED
@@ -242,13 +242,8 @@ Hiiro.run(*ARGV, plugins: [Pins]) do
242
242
  pinned = pinned_manager.load_pinned
243
243
  next puts "No tracked PRs" if pinned.empty?
244
244
 
245
- if opts.update
246
- active = pinned.select(&:active?)
247
- puts "Updating status for #{active.length} active PR(s)..."
248
- pinned_manager.refresh_all_status(pinned, force: true)
249
- pinned_manager.save_pinned(pinned)
250
- puts
251
- end
245
+ pinned_manager.refresh_all_status(pinned, force: opts.update)
246
+ pinned_manager.save_pinned(pinned)
252
247
 
253
248
  results = pinned_manager.apply_filters(pinned, opts)
254
249
 
@@ -334,7 +329,7 @@ Hiiro.run(*ARGV, plugins: [Pins]) do
334
329
 
335
330
  active = pinned.select(&:active?)
336
331
  puts "Updating status for #{active.length} active PR(s) (#{pinned.length - active.length} closed/merged skipped)..."
337
- pinned_manager.refresh_all_status(pinned, force: opts.force_update)
332
+ pinned_manager.refresh_all_status(pinned, force: opts.force_update, verbose: true)
338
333
  pinned_manager.save_pinned(pinned)
339
334
  puts "Done."
340
335
 
data/lib/hiiro/link.rb CHANGED
@@ -40,11 +40,11 @@ class Hiiro
40
40
  terms.all? { |term| searchable.include?(term.downcase) }
41
41
  end
42
42
 
43
- def display_string(index = nil)
43
+ def display_string(index = nil, exclude_tags: [])
44
44
  num = index ? "#{(index + 1).to_s.rjust(3)}." : ""
45
45
  shorthand_str = shorthand ? " [#{shorthand}]" : ""
46
46
  desc_str = description.to_s.empty? ? "" : " - #{description}"
47
- link_tags = tags
47
+ link_tags = tags - Array(exclude_tags)
48
48
  tags_str = link_tags.any? ? " \e[30;104m#{link_tags.join(' ')}\e[0m" : ""
49
49
  "#{num}#{shorthand_str} #{url}#{desc_str}#{tags_str}".strip
50
50
  end
@@ -271,11 +271,11 @@ class Hiiro
271
271
  result
272
272
  end
273
273
 
274
- def refresh_all_status(prs, force: false)
274
+ def refresh_all_status(prs, force: false, verbose: false)
275
275
  prs_to_refresh = prs.select { |pr| pr.active? && needs_refresh?(pr, force: force) }
276
276
 
277
277
  if prs_to_refresh.empty?
278
- puts "All PRs recently checked (within last 2 minutes). Use -U to force update." unless force
278
+ puts "All PRs recently checked (within last 2 minutes). Use -U to force update." if verbose
279
279
  return prs
280
280
  end
281
281
 
data/lib/hiiro/tags.rb CHANGED
@@ -21,6 +21,11 @@ class Hiiro
21
21
  klass&.[](taggable_id)
22
22
  end
23
23
 
24
+ # Returns all Tag rows for a given object
25
+ def self.tags_by_type(type)
26
+ where(taggable_type: type.to_s).select(:name).distinct.map(&:name).sort
27
+ end
28
+
24
29
  # Returns all Tag rows for a given object
25
30
  def self.for(obj)
26
31
  t = obj.class.name.split('::').last
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.321"
2
+ VERSION = "0.1.323"
3
3
  end
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.321
4
+ version: 0.1.323
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota