hiiro 0.1.231 → 0.1.232

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/h-pr +75 -0
  3. data/lib/hiiro/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f8ec87844086b0454fd8fbae741e0606702cba54c405a63f4084cd3e55d7fcf
4
- data.tar.gz: 3a770a7ad8c6c9ffb6abc47c1f1a09869ee61c9d7f712300c1a0ba0e516fab20
3
+ metadata.gz: a0d1ba68ed577241b03e05bbc748dbc880b0c411547a646bdc7bb9c77733f8c3
4
+ data.tar.gz: e25ca589b0609094596456dbef9f9afcb83963045dea1e2d809a50c227f4d7cd
5
5
  SHA512:
6
- metadata.gz: e6fa5471a21551ee74ac7764f040ce6d3874f022afd43831411e5d32236bce24636c6537b819cd0d06ee35b001bee02f5b4b13810a7d7bd99d589d3e0f6ed92b
7
- data.tar.gz: e1f351cc92d23a2345c9e5f4823af94f9b6d59d83bd937f75e0657990a0ae57f2330cf2da3db56c2a0eca8719192fd0f3d848e38d6badc504693bdfa817ff3e7
6
+ metadata.gz: 5c3558fd44e96b1b68ead9f8526f05c7de18e56fd0cd7345c77a3d8c649f6a236a82133aecd94676efd988e90dd192804a33120aca15aca73d1394d3c4043f76
7
+ data.tar.gz: e1ca686b11cdf7f0d795eb0a03a4275e660af825cf30f01a36563586f5843a75e5a4148bba648cf8b7c9bac264bcbac1b2f2dbb79c7324fedc349621f8e17c39
data/bin/h-pr CHANGED
@@ -1071,6 +1071,81 @@ Hiiro.run(*ARGV, plugins: [Pins]) do
1071
1071
  system('gh', 'pr', 'merge', pr_number.to_s, *merge_args)
1072
1072
  end
1073
1073
 
1074
+ add_subcmd(:fix) do |*fix_args|
1075
+ opts = Hiiro::Options.parse(fix_args) do
1076
+ flag(:red, short: :r, desc: 'Fix all PRs with failing checks')
1077
+ flag(:run, short: :R, desc: 'Launch queue tasks immediately after queuing')
1078
+ end
1079
+
1080
+ pinned = pinned_manager.load_pinned
1081
+
1082
+ prs_to_fix = if opts.red
1083
+ failing = pinned.select { |pr| (c = pr['checks']) && c['failed'].to_i > 0 }
1084
+ if failing.empty?
1085
+ puts "No PRs with failing checks"
1086
+ next
1087
+ end
1088
+ failing
1089
+ elsif opts.args.empty?
1090
+ # Default: fuzzy-select from failing PRs, fall back to all tracked
1091
+ failing = pinned.select { |pr| (c = pr['checks']) && c['failed'].to_i > 0 }
1092
+ candidates = failing.empty? ? pinned : failing
1093
+ if candidates.empty?
1094
+ puts "No tracked PRs"
1095
+ next
1096
+ end
1097
+ lines = candidates.each_with_index.each_with_object({}) do |(pr, idx), h|
1098
+ h[pinned_manager.display_pinned(pr, idx)] = pr
1099
+ end
1100
+ selected = fuzzyfind_from_map(lines)
1101
+ next unless selected
1102
+ [selected]
1103
+ else
1104
+ # Resolve each positional arg as a PR ref
1105
+ opts.args.map { |ref|
1106
+ pr_num = resolve_pr.call(ref)
1107
+ next nil unless pr_num
1108
+ pinned.find { |p| p['number'].to_s == pr_num.to_s }
1109
+ }.compact
1110
+ end
1111
+
1112
+ if prs_to_fix.empty?
1113
+ puts "No PRs to fix"
1114
+ next
1115
+ end
1116
+
1117
+ q = Hiiro::Queue.current(self)
1118
+ queued_names = []
1119
+
1120
+ prs_to_fix.each do |pr|
1121
+ task_info = {
1122
+ task_name: pr['task'],
1123
+ tree_name: pr['worktree'],
1124
+ session_name: pr['tmux_session'],
1125
+ }.compact
1126
+ task_info = nil if task_info.empty?
1127
+
1128
+ result = q.add_with_frontmatter("/pr:fix #{pr['number']}", task_info: task_info)
1129
+ if result
1130
+ puts "Queued fix for ##{pr['number']}: #{pr['title']}"
1131
+ queued_names << result[:name]
1132
+ else
1133
+ STDERR.puts "Failed to queue fix for ##{pr['number']}"
1134
+ end
1135
+ end
1136
+
1137
+ unless queued_names.empty?
1138
+ puts
1139
+ puts "Queued #{queued_names.length} fix task(s)."
1140
+ if opts.run
1141
+ puts "Launching..."
1142
+ queued_names.each { |name| q.launch_task(name) }
1143
+ else
1144
+ puts "Run 'h queue run' to start."
1145
+ end
1146
+ end
1147
+ end
1148
+
1074
1149
  add_subcmd(:comment) do |ref = nil|
1075
1150
  pr_number = resolve_pr.call(ref)
1076
1151
  next unless pr_number
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.231"
2
+ VERSION = "0.1.232"
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.231
4
+ version: 0.1.232
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota