@zalom/plastic 1.0.0-alpha.3 → 1.0.0-alpha.4
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.
- package/hooks/hooks.json +0 -11
- package/package.json +1 -1
- package/scripts/hook-session-start +16 -1
- package/scripts/install.rb +5 -3
package/hooks/hooks.json
CHANGED
package/package.json
CHANGED
|
@@ -150,11 +150,22 @@ active_deprecations = deprecations.select do |dep|
|
|
|
150
150
|
!dismissed.include?(dep["id"])
|
|
151
151
|
end
|
|
152
152
|
|
|
153
|
+
# --- Check for available updates (from previous session's check) ---
|
|
154
|
+
|
|
155
|
+
update_notice = nil
|
|
156
|
+
cache_file = "#{store_root}/.cache/update-check.json"
|
|
157
|
+
if File.exist?(cache_file)
|
|
158
|
+
cache = JSON.parse(File.read(cache_file)) rescue {}
|
|
159
|
+
if cache["updateAvailable"]
|
|
160
|
+
update_notice = "Plastic update available: #{cache["current"]} -> #{cache["latest"]} — run /plastic:update"
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
153
164
|
# --- Early exit if nothing to show ---
|
|
154
165
|
|
|
155
166
|
all_active = active + project_active
|
|
156
167
|
all_future = future + project_future
|
|
157
|
-
exit 0 if all_active.empty? && stale.empty? && all_future.empty? && active_deprecations.empty?
|
|
168
|
+
exit 0 if all_active.empty? && stale.empty? && all_future.empty? && active_deprecations.empty? && update_notice.nil?
|
|
158
169
|
|
|
159
170
|
# --- Build context ---
|
|
160
171
|
|
|
@@ -215,6 +226,10 @@ if active_deprecations.any?
|
|
|
215
226
|
end
|
|
216
227
|
end
|
|
217
228
|
|
|
229
|
+
if update_notice
|
|
230
|
+
parts.unshift("! #{update_notice}\n")
|
|
231
|
+
end
|
|
232
|
+
|
|
218
233
|
payload = {
|
|
219
234
|
"hookSpecificOutput" => {
|
|
220
235
|
"hookEventName" => "SessionStart",
|
package/scripts/install.rb
CHANGED
|
@@ -365,17 +365,19 @@ def merge_claude_hooks(settings_path)
|
|
|
365
365
|
end
|
|
366
366
|
|
|
367
367
|
def purge_stale_plastic_hooks(hooks)
|
|
368
|
-
|
|
368
|
+
plastic_cmd = ->(cmd) { cmd.to_s.include?("plastic-") }
|
|
369
|
+
|
|
370
|
+
hooks.delete("statusLine")
|
|
369
371
|
|
|
370
372
|
hooks.each do |event, groups|
|
|
371
373
|
next unless groups.is_a?(Array)
|
|
372
374
|
|
|
373
375
|
hooks[event] = groups.map do |group|
|
|
374
376
|
if group.is_a?(Hash) && group["hooks"].is_a?(Array)
|
|
375
|
-
group["hooks"].reject! { |h|
|
|
377
|
+
group["hooks"].reject! { |h| plastic_cmd.call(h["command"]) }
|
|
376
378
|
group unless group["hooks"].empty?
|
|
377
379
|
elsif group.is_a?(Hash) && group["command"]
|
|
378
|
-
|
|
380
|
+
plastic_cmd.call(group["command"]) ? nil : group
|
|
379
381
|
else
|
|
380
382
|
group
|
|
381
383
|
end
|