hiiro 0.1.302 → 0.1.304

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: f4b1074780997c84fef5f28b121523ae017f26a38a267f36ca7eda34b02cc768
4
- data.tar.gz: 31659390beed3003e810964f09f7c70d5aa2ea98ddc682b575383f4d3eb190d7
3
+ metadata.gz: 7857e9098ddc0e017149cc2410a763e05ef783ade9770470f50641547a9404fd
4
+ data.tar.gz: 345597405a5855955e94fa5e5f89d875d6a8c2feb6a5ff39942befc7cbb5168c
5
5
  SHA512:
6
- metadata.gz: e95bde2e25358eb958a0085bbf2791f35fbb270721e2f134974f156f01750698e8a48efb1989876c68adaf4eda7bc4cf0f354dfc9259548eaf888d1614372feb
7
- data.tar.gz: 9706715a0228f8732fd925d89cbfb97be6a6e76463c533d4649327992669ffef29a4a592224a1b28c2e3238be8e87f2872bbf987d32ce769400fda11e723aefa
6
+ metadata.gz: 1d570ea40f7655e4f36190cca8e1147025f95af9fff8c0f869d656ddfd38ed58b489884bb7be086b89da6ccb51f186483d856ff757ead5ed92c503b8cb4a491d
7
+ data.tar.gz: bdbe84cf4d538c42b56322bf026a9c7d55b4a5110bb0ebe608658b28cc39c472bce7933e23cbb62012596bec549236de2e592c4166d57c785ed1bb615d349d86
data/CHANGELOG.md CHANGED
@@ -1,17 +1,3 @@
1
- # Changelog
2
-
3
- ## [0.1.302] - 2026-03-30
4
-
5
- ### Fixed
6
- - Truncate output lines to terminal width in tasks plugin
7
-
8
- ## [0.1.301]
9
-
10
- ### Added
11
- - Check version delayed update functionality
12
-
13
- ### Changed
14
- - h-claude: add verbose flags and refactor glob_path handling
15
-
16
- ### Fixed
17
- - Use exact session matching to prevent tmux prefix ambiguity
1
+ Done. Updated CHANGELOG.md with v0.1.304 entry at the top, documenting the two changes since v0.1.302:
2
+ - h-notify now uses a universal log instead of per-session logging
3
+ - Todo output has been simplified
data/bin/h-notify CHANGED
@@ -33,15 +33,26 @@ CLAUDE_NOTIFICATION_CMD = %q(MSG=$(cat | jq -r '.message // "Needs input"'); h a
33
33
  CLAUDE_STOP_CMD = %q(h alert -t 'Claude Code' -m 'Work completed' -s b -c "echo switchc -t '$TMUX_PANE' | pbcopy"; h notify push -t success 'Work completed')
34
34
 
35
35
  def read_log
36
- return {} unless File.exist?(LOG_FILE)
37
- YAML.safe_load(File.read(LOG_FILE)) || {}
36
+ return [] unless File.exist?(LOG_FILE)
37
+ data = YAML.safe_load(File.read(LOG_FILE))
38
+ if data.is_a?(Hash)
39
+ backup = "#{LOG_FILE}.bak.#{Time.now.strftime('%Y%m%d%H%M%S')}"
40
+ FileUtils.cp(LOG_FILE, backup)
41
+ $stderr.puts "h notify: migrated log to flat format (backup: #{backup})"
42
+ migrated = data.values.flatten.compact.sort_by { |e| -(e['timestamp'] || 0) }
43
+ write_log(migrated)
44
+ migrated
45
+ elsif data.is_a?(Array)
46
+ data
47
+ else
48
+ []
49
+ end
38
50
  rescue
39
- {}
51
+ []
40
52
  end
41
53
 
42
54
  def write_log(data)
43
55
  FileUtils.mkdir_p(File.dirname(LOG_FILE))
44
- data.reject! { |_, entries| entries.nil? || entries.empty? }
45
56
  File.write(LOG_FILE, data.to_yaml)
46
57
  end
47
58
 
@@ -92,10 +103,9 @@ Hiiro.run(*ARGV, tasks: true) do
92
103
  }
93
104
 
94
105
  data = read_log
95
- data[session] ||= []
96
106
  # One entry per pane — replace existing, newest first
97
- data[session].reject! { |e| e['pane_id'] == pane.id }
98
- data[session].unshift(entry)
107
+ data.reject! { |e| e['pane_id'] == pane.id }
108
+ data.unshift(entry)
99
109
  write_log(data)
100
110
 
101
111
  binpath = `command -v terminal-notifier`
@@ -106,34 +116,21 @@ Hiiro.run(*ARGV, tasks: true) do
106
116
  end
107
117
 
108
118
  add_subcmd(:ls) do
109
- ls_opts = Hiiro::Options.parse(@opts.args) do
110
- flag(:all, short: 'a', desc: 'Show all sessions')
111
- end
112
-
113
- data = read_log
114
- sessions = ls_opts.all ? data.keys : [Hiiro::Tmux::Session.current&.name].compact
115
-
116
- any = false
117
- sessions.each do |sess|
118
- entries = data[sess] || []
119
- next if entries.empty?
119
+ data = read_log
120
120
 
121
- puts "=== #{sess} ===" if ls_opts.all
122
- entries.each_with_index do |e, i|
121
+ if data.empty?
122
+ puts "No notifications."
123
+ else
124
+ data.each_with_index do |e, i|
123
125
  time_str = Time.at(e['timestamp']).strftime('%H:%M:%S')
124
126
  prefix = TYPE_PRESETS[e['type']]&.dig(:prefix) || '[INFO]'
125
- puts "%3d) %s [%s] %s: %s (%s)" % [i, prefix, e['pane_id'], e['pane_cmd'], e['message'], time_str]
127
+ puts "%3d) %s [%s/%s] %s: %s (%s)" % [i, prefix, e['session'], e['pane_id'], e['pane_cmd'], e['message'], time_str]
126
128
  end
127
- any = true
128
129
  end
129
-
130
- puts "No notifications." unless any
131
130
  end
132
131
 
133
132
  add_subcmd(:menu) do
134
- session = Hiiro::Tmux::Session.current&.name
135
- data = read_log
136
- entries = data[session] || []
133
+ entries = read_log
137
134
 
138
135
  if entries.empty?
139
136
  next
@@ -159,20 +156,15 @@ Hiiro.run(*ARGV, tasks: true) do
159
156
  next
160
157
  end
161
158
 
162
- index = index_str.to_i
163
- session = Hiiro::Tmux::Session.current&.name
164
- data = read_log
165
- entries = data[session] || []
159
+ index = index_str.to_i
160
+ data = read_log
166
161
 
167
- if index >= entries.length
168
- next
169
- end
162
+ next if index >= data.length
170
163
 
171
- entry = entries[index]
164
+ entry = data[index]
172
165
 
173
166
  unless pane_exists?(entry['pane_id'])
174
- entries.delete_at(index)
175
- data[session] = entries
167
+ data.delete_at(index)
176
168
  write_log(data)
177
169
  next
178
170
  end
@@ -180,23 +172,19 @@ Hiiro.run(*ARGV, tasks: true) do
180
172
  tmux_client.select_window(entry['window_id'])
181
173
  tmux_client.select_pane(entry['pane_id'])
182
174
 
183
- entries.delete_at(index)
184
- data[session] = entries
175
+ data.delete_at(index)
185
176
  write_log(data)
186
177
  end
187
178
 
188
179
  add_subcmd(:clear) do
189
- session = Hiiro::Tmux::Session.current&.name
190
- data = read_log
191
- data.delete(session)
192
- write_log(data)
180
+ write_log([])
193
181
  end
194
182
 
195
183
  # Called by tmux hook: after-kill-pane
196
184
  add_subcmd(:remove_pane) do |pane_id = nil|
197
185
  next unless pane_id
198
186
  data = read_log
199
- data.each_value { |entries| entries.reject! { |e| e['pane_id'] == pane_id } }
187
+ data.reject! { |e| e['pane_id'] == pane_id }
200
188
  write_log(data)
201
189
  end
202
190
 
@@ -204,7 +192,7 @@ Hiiro.run(*ARGV, tasks: true) do
204
192
  add_subcmd(:remove_window) do |window_id = nil|
205
193
  next unless window_id
206
194
  data = read_log
207
- data.each_value { |entries| entries.reject! { |e| e['window_id'] == window_id } }
195
+ data.reject! { |e| e['window_id'] == window_id }
208
196
  write_log(data)
209
197
  end
210
198
 
@@ -212,7 +200,7 @@ Hiiro.run(*ARGV, tasks: true) do
212
200
  add_subcmd(:remove_session) do |sess = nil|
213
201
  next unless sess
214
202
  data = read_log
215
- data.delete(sess)
203
+ data.reject! { |e| e['session'] == sess }
216
204
  write_log(data)
217
205
  end
218
206
 
data/lib/hiiro/todo.rb CHANGED
@@ -148,7 +148,10 @@ class Hiiro
148
148
 
149
149
  def find(id)
150
150
  id_int = id.to_i
151
- items.find { |item| item.id == id_int }
151
+ items.find { |item|
152
+ item.id == id_int ||
153
+ item.id.to_s.end_with?(id.to_s)
154
+ }
152
155
  end
153
156
 
154
157
  def find_by_index(index)
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.302"
2
+ VERSION = "0.1.304"
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.302
4
+ version: 0.1.304
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota