hiiro 0.1.231 → 0.1.233

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 +77 -1
  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: 998294642c1d69a195fe30bdc06fb48b26825bcf47454dd6b57748877f819dac
4
+ data.tar.gz: 5e74e47755731485eeab5340e09f673aed515d5fe10f87c46283ad88ae945063
5
5
  SHA512:
6
- metadata.gz: e6fa5471a21551ee74ac7764f040ce6d3874f022afd43831411e5d32236bce24636c6537b819cd0d06ee35b001bee02f5b4b13810a7d7bd99d589d3e0f6ed92b
7
- data.tar.gz: e1f351cc92d23a2345c9e5f4823af94f9b6d59d83bd937f75e0657990a0ae57f2330cf2da3db56c2a0eca8719192fd0f3d848e38d6badc504693bdfa817ff3e7
6
+ metadata.gz: b9c0145e7765252e6d77f17cfd787d152caa7dc0e29d33b5759ba7960a58100c9ba3bb8b3a9e94a5b31cf8b70170546107a3da195797f68546bdb3e42c2c423f
7
+ data.tar.gz: 5dd5b16bee94ad2d442ed42ba4cf8869d33e6a4ca4d357172f1958620860a46029c3f64eb82bb5b0890954357de0818d0f7a9747557ad1bc11027f5967467210
data/bin/h-pr CHANGED
@@ -368,7 +368,8 @@ class PinnedPRManager
368
368
 
369
369
  as_str = as > 0 ? "\e[30;102m#{as}\e[0m" : '-'
370
370
  crs_str = crs > 0 ? "\e[30;103m#{crs}\e[0m" : '-'
371
- reviews_str = "#{as_str}a/#{crs_str}cr"
371
+ conflict_str = pr['mergeable'] == 'CONFLICTING' ? " \e[30;101m[conflicts]\e[0m" : ""
372
+ reviews_str = "#{as_str}a/#{crs_str}cr#{conflict_str}"
372
373
 
373
374
  repo = pr_repo(pr)
374
375
  repo_label = (repo && repo != 'instacart/carrot') ? " [#{repo}]" : ""
@@ -1071,6 +1072,81 @@ Hiiro.run(*ARGV, plugins: [Pins]) do
1071
1072
  system('gh', 'pr', 'merge', pr_number.to_s, *merge_args)
1072
1073
  end
1073
1074
 
1075
+ add_subcmd(:fix) do |*fix_args|
1076
+ opts = Hiiro::Options.parse(fix_args) do
1077
+ flag(:red, short: :r, desc: 'Fix all PRs with failing checks')
1078
+ flag(:run, short: :R, desc: 'Launch queue tasks immediately after queuing')
1079
+ end
1080
+
1081
+ pinned = pinned_manager.load_pinned
1082
+
1083
+ prs_to_fix = if opts.red
1084
+ failing = pinned.select { |pr| (c = pr['checks']) && c['failed'].to_i > 0 }
1085
+ if failing.empty?
1086
+ puts "No PRs with failing checks"
1087
+ next
1088
+ end
1089
+ failing
1090
+ elsif opts.args.empty?
1091
+ # Default: fuzzy-select from failing PRs, fall back to all tracked
1092
+ failing = pinned.select { |pr| (c = pr['checks']) && c['failed'].to_i > 0 }
1093
+ candidates = failing.empty? ? pinned : failing
1094
+ if candidates.empty?
1095
+ puts "No tracked PRs"
1096
+ next
1097
+ end
1098
+ lines = candidates.each_with_index.each_with_object({}) do |(pr, idx), h|
1099
+ h[pinned_manager.display_pinned(pr, idx)] = pr
1100
+ end
1101
+ selected = fuzzyfind_from_map(lines)
1102
+ next unless selected
1103
+ [selected]
1104
+ else
1105
+ # Resolve each positional arg as a PR ref
1106
+ opts.args.map { |ref|
1107
+ pr_num = resolve_pr.call(ref)
1108
+ next nil unless pr_num
1109
+ pinned.find { |p| p['number'].to_s == pr_num.to_s }
1110
+ }.compact
1111
+ end
1112
+
1113
+ if prs_to_fix.empty?
1114
+ puts "No PRs to fix"
1115
+ next
1116
+ end
1117
+
1118
+ q = Hiiro::Queue.current(self)
1119
+ queued_names = []
1120
+
1121
+ prs_to_fix.each do |pr|
1122
+ task_info = {
1123
+ task_name: pr['task'],
1124
+ tree_name: pr['worktree'],
1125
+ session_name: pr['tmux_session'],
1126
+ }.compact
1127
+ task_info = nil if task_info.empty?
1128
+
1129
+ result = q.add_with_frontmatter("/pr:fix #{pr['number']}", task_info: task_info)
1130
+ if result
1131
+ puts "Queued fix for ##{pr['number']}: #{pr['title']}"
1132
+ queued_names << result[:name]
1133
+ else
1134
+ STDERR.puts "Failed to queue fix for ##{pr['number']}"
1135
+ end
1136
+ end
1137
+
1138
+ unless queued_names.empty?
1139
+ puts
1140
+ puts "Queued #{queued_names.length} fix task(s)."
1141
+ if opts.run
1142
+ puts "Launching..."
1143
+ queued_names.each { |name| q.launch_task(name) }
1144
+ else
1145
+ puts "Run 'h queue run' to start."
1146
+ end
1147
+ end
1148
+ end
1149
+
1074
1150
  add_subcmd(:comment) do |ref = nil|
1075
1151
  pr_number = resolve_pr.call(ref)
1076
1152
  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.233"
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.233
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota