claude-inbox 0.14.1 → 0.14.2

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: 6f7809d0909d4391440edb2d01d0452b976b28ed59832d21a05518a11ef164b1
4
- data.tar.gz: 106434e33d35e297d312b441bfa1ff333a16a7faddd54443c65ba006a6dcf95e
3
+ metadata.gz: d987ed72f80dde3f91bd8ddeb3486aa867fb25e8b4ac5be91305654be021c9b0
4
+ data.tar.gz: 5a4874f4eee5a49c7bf56921db71f966f935397001a20a58c53a71bec69b013b
5
5
  SHA512:
6
- metadata.gz: cf8d43ffd7d434977f4bcb18acb1d06817854e92973cad5e5e8d7d8efd8e611e82dc1820499f65c50c99f0b12a5b6d3d7d3a18235c1ad693c0efa2325be348a6
7
- data.tar.gz: c0560e7bd6444fbf325618d8b2eb7172d74b0d63d331058cf9aca5afbcf88da1f0fd5a4d31c1576e808a4b022cf3933247bc61c5ba229f4543b171805e2aa3df
6
+ metadata.gz: c75cc50ea18dd72da00508eb50066dc6f0a7b9b20a1e8bb6ed042272bac0c45cd963ec31efe570b080dfaf9b4ec191c56143de05a229c2f83212b7baad551728
7
+ data.tar.gz: 5ed8c579ff1405d26327bc6c39acc95cd79a5c0eb3706314aeab91f006bdc940d699e6ba41f35396e3af9b372900329ec8978d122e6026a8f766554a7501c806
@@ -74,7 +74,8 @@ module ClaudeInbox
74
74
  end
75
75
 
76
76
  # `o` open and `y` copy on a session with several PRs: the headline
77
- # first, and the same key again takes it. The PR is read from `choice`.
77
+ # first, then the rest in Session#prs_by_status order; the same key
78
+ # again takes the headline. The PR is read from `choice`.
78
79
  class PrPicker < Dialog
79
80
  MARGIN = 6
80
81
  KEYS = {open: "o", copy: "y"}.freeze
@@ -83,7 +84,7 @@ module ClaudeInbox
83
84
 
84
85
  def initialize(kind, session)
85
86
  super(kind, session.key)
86
- @prs = [session.pr, *session.prs.reject { |pr| pr.equal?(session.pr) }].first(9)
87
+ @prs = [session.pr, *session.prs_by_status.reject { |pr| pr.equal?(session.pr) }].first(9)
87
88
  end
88
89
 
89
90
  def title = " #{kind.to_s.capitalize} pull request "
@@ -99,19 +99,34 @@ module ClaudeInbox
99
99
 
100
100
  def project = cwd ? File.basename(cwd) : ""
101
101
 
102
- # The PR you would act on. One resolved before the session began was
103
- # only mentioned (as Row#settled? judges), so it loses to any live one.
102
+ # The PR you would act on. One only mentioned loses to any live one.
104
103
  def pr = prs.each_with_index.min_by { |pr, i| [headline_rank(pr), i] }&.first
105
104
 
105
+ # Oldest first so a stack reads up from its base; trouble is the
106
+ # headline's job, not this order's.
107
+ def prs_by_status = prs.each_with_index.sort_by { |pr, i| [*status_order(pr), i] }.map(&:first)
108
+
106
109
  private
107
110
 
108
111
  def headline_rank(pr)
109
- if !pr.known? || pr.resolved_before?(created_at) then 4
112
+ if mentioned?(pr) then 4
110
113
  elsif pr.needs_you? then 0
111
114
  elsif pr.health == "CONFLICTING" then 1
112
115
  elsif !pr.resolved? then 2
113
116
  else 3
114
117
  end
115
118
  end
119
+
120
+ def status_order(pr)
121
+ age = pr.number.to_i
122
+ if mentioned?(pr) then [3, age]
123
+ elsif pr.state == "OPEN" then [0, age]
124
+ elsif pr.state == "DRAFT" then [1, age]
125
+ else [2, -age]
126
+ end
127
+ end
128
+
129
+ # Unknown, or resolved before the session began (as Row#settled? judges).
130
+ def mentioned?(pr) = !pr.known? || pr.resolved_before?(created_at)
116
131
  end
117
132
  end
data/lib/claude_inbox.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClaudeInbox
4
- VERSION = "0.14.1"
4
+ VERSION = "0.14.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude-inbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Byron