openclacky 0.7.2 → 0.7.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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.clacky/skills/commit/SKILL.md +252 -74
  3. data/CHANGELOG.md +38 -0
  4. data/bin/openclacky +2 -0
  5. data/lib/clacky/agent/message_compressor_helper.rb +1 -1
  6. data/lib/clacky/agent/system_prompt_builder.rb +9 -8
  7. data/lib/clacky/agent/tool_executor.rb +4 -13
  8. data/lib/clacky/agent.rb +28 -7
  9. data/lib/clacky/cli.rb +22 -5
  10. data/lib/clacky/default_skills/new/SKILL.md +61 -30
  11. data/lib/clacky/default_skills/new/scripts/create_rails_project.sh +176 -0
  12. data/lib/clacky/default_skills/new/scripts/rails_env_checker.sh +389 -0
  13. data/lib/clacky/default_skills/skill-add/SKILL.md +251 -34
  14. data/lib/clacky/default_skills/skill-add/scripts/install_from_github.rb +189 -0
  15. data/lib/clacky/providers.rb +13 -11
  16. data/lib/clacky/tools/invoke_skill.rb +5 -1
  17. data/lib/clacky/tools/safe_shell.rb +2 -2
  18. data/lib/clacky/tools/shell.rb +48 -20
  19. data/lib/clacky/ui2/components/input_area.rb +27 -9
  20. data/lib/clacky/ui2/components/modal_component.rb +22 -2
  21. data/lib/clacky/ui2/components/welcome_banner.rb +33 -10
  22. data/lib/clacky/ui2/layout_manager.rb +107 -26
  23. data/lib/clacky/ui2/line_editor.rb +6 -5
  24. data/lib/clacky/ui2/screen_buffer.rb +0 -15
  25. data/lib/clacky/ui2/terminal_detector.rb +119 -0
  26. data/lib/clacky/ui2/theme_manager.rb +18 -0
  27. data/lib/clacky/ui2/themes/base_theme.rb +22 -1
  28. data/lib/clacky/ui2/themes/hacker_theme.rb +22 -18
  29. data/lib/clacky/ui2/themes/minimal_theme.rb +19 -15
  30. data/lib/clacky/ui2/ui_controller.rb +66 -15
  31. data/lib/clacky/ui2.rb +1 -0
  32. data/lib/clacky/utils/limit_stack.rb +5 -0
  33. data/lib/clacky/version.rb +1 -1
  34. metadata +5 -1
@@ -446,7 +446,8 @@ module Clacky
446
446
  # Show progress indicator with dynamic elapsed time
447
447
  # @param message [String] Progress message (optional, will use random thinking verb if nil)
448
448
  # @param prefix_newline [Boolean] Whether to add a blank line before progress (default: true)
449
- def show_progress(message = nil, prefix_newline: true)
449
+ # @param output_buffer [Hash, nil] Shared output buffer for real-time command output (optional)
450
+ def show_progress(message = nil, prefix_newline: true, output_buffer: nil)
450
451
  # Stop any existing progress thread
451
452
  stop_progress_thread
452
453
 
@@ -455,10 +456,12 @@ module Clacky
455
456
 
456
457
  @progress_message = message || Clacky::THINKING_VERBS.sample
457
458
  @progress_start_time = Time.now
459
+ @progress_output_buffer = output_buffer
458
460
 
459
461
  # Show initial progress (yellow, active)
460
462
  append_output("") if prefix_newline
461
- output = @renderer.render_working("#{@progress_message}… (ctrl+c to interrupt)")
463
+ hint = output_buffer ? "(Ctrl+C to interrupt · Ctrl+O to view output)" : "(Ctrl+C to interrupt)"
464
+ output = @renderer.render_working("#{@progress_message}… #{hint}")
462
465
  append_output(output)
463
466
 
464
467
  # Start background thread to update elapsed time
@@ -468,7 +471,8 @@ module Clacky
468
471
  next unless @progress_start_time
469
472
 
470
473
  elapsed = (Time.now - @progress_start_time).to_i
471
- update_progress_line(@renderer.render_working("#{@progress_message} (ctrl+c to interrupt · #{elapsed}s)"))
474
+ hint = output_buffer ? "(Ctrl+C to interrupt · Ctrl+O to view output · #{elapsed}s)" : "(Ctrl+C to interrupt · #{elapsed}s)"
475
+ update_progress_line(@renderer.render_working("#{@progress_message}… #{hint}"))
472
476
  end
473
477
  rescue => e
474
478
  # Silently handle thread errors
@@ -495,6 +499,7 @@ module Clacky
495
499
  # Stop the progress update thread
496
500
  def stop_progress_thread
497
501
  @progress_start_time = nil
502
+ @progress_output_buffer = nil # Clear output buffer reference
498
503
  if @progress_thread&.alive?
499
504
  @progress_thread.kill
500
505
  @progress_thread = nil
@@ -583,7 +588,7 @@ module Clacky
583
588
  # Show question in output with theme styling
584
589
  theme = ThemeManager.current_theme
585
590
  question_symbol = theme.format_symbol(:info)
586
- append_output("\n#{question_symbol} #{message}")
591
+ append_output("#{question_symbol} #{message}")
587
592
 
588
593
  # Pause InputArea
589
594
  @input_area.pause
@@ -671,6 +676,32 @@ module Clacky
671
676
  @layout.enter_fullscreen(@last_diff_lines, hint: "Press Ctrl+O to return")
672
677
  end
673
678
 
679
+ # Show fullscreen command output view
680
+ def show_command_output
681
+ return unless @progress_output_buffer
682
+ return if @layout.fullscreen_mode? # Already in fullscreen, ignore
683
+
684
+ # Get lines from LimitStack
685
+ stdout_lines = @progress_output_buffer[:stdout_lines]&.to_a || []
686
+ stderr_lines = @progress_output_buffer[:stderr_lines]&.to_a || []
687
+
688
+ lines = stdout_lines.map(&:chomp)
689
+
690
+ # Add stderr section if present
691
+ unless stderr_lines.empty?
692
+ lines << ""
693
+ lines << "--- STDERR ---"
694
+ lines += stderr_lines.map(&:chomp)
695
+ end
696
+
697
+ if lines.empty?
698
+ lines = ["(No output yet)"]
699
+ end
700
+
701
+ # Enter fullscreen mode to display command output
702
+ @layout.enter_fullscreen(lines, hint: "Press Ctrl+O to return · Output updates in real-time")
703
+ end
704
+
674
705
  private
675
706
 
676
707
  # Format tool call for display
@@ -718,7 +749,8 @@ module Clacky
718
749
  def display_welcome_banner
719
750
  content = @welcome_banner.render_full(
720
751
  working_dir: @config[:working_dir],
721
- mode: @config[:mode]
752
+ mode: @config[:mode],
753
+ width: @layout.screen.width
722
754
  )
723
755
  append_output(content)
724
756
 
@@ -743,7 +775,7 @@ module Clacky
743
775
  theme = ThemeManager.current_theme
744
776
 
745
777
  # Show logo banner only
746
- append_output(@welcome_banner.render_logo)
778
+ append_output(@welcome_banner.render_logo(width: @layout.screen.width))
747
779
 
748
780
  # Show simple header
749
781
  append_output(theme.format_text("Recent conversation:", :info))
@@ -771,6 +803,9 @@ module Clacky
771
803
  @layout.screen.enable_raw_mode
772
804
 
773
805
  while @running
806
+ # Process any pending resize events
807
+ @layout.process_pending_resize
808
+
774
809
  key = @layout.screen.read_key(timeout: 0.1)
775
810
  next unless key
776
811
 
@@ -836,8 +871,12 @@ module Clacky
836
871
  when :toggle_mode
837
872
  toggle_mode
838
873
  when :toggle_expand
839
- # Enter fullscreen diff view
840
- redisplay_diff
874
+ # If there's command output available, show it; otherwise show diff
875
+ if @progress_output_buffer
876
+ show_command_output
877
+ else
878
+ redisplay_diff
879
+ end
841
880
  when :time_machine
842
881
  # Trigger time machine callback
843
882
  @time_machine_callback&.call
@@ -862,10 +901,15 @@ module Clacky
862
901
  @layout.position_inline_input_cursor(@inline_input)
863
902
  when :submit, :cancel
864
903
  # InlineInput is done, will be cleaned up by request_confirmation after collect returns
865
- nil
904
+ # Don't render anything here - let request_confirmation handle cleanup
905
+ return
866
906
  when :toggle_expand
867
- # Enter fullscreen diff view (will return when user presses Ctrl+O)
868
- redisplay_diff
907
+ # If there's command output available, show it; otherwise show diff
908
+ if @progress_output_buffer
909
+ show_command_output
910
+ else
911
+ redisplay_diff
912
+ end
869
913
  when :toggle_mode
870
914
  # Update mode and session bar info, but don't render yet
871
915
  current_mode = @config[:mode]
@@ -939,7 +983,11 @@ module Clacky
939
983
  choices << { name: "[X] Close", value: { action: :close } }
940
984
 
941
985
  # Show menu
942
- result = modal.show(title: "Model Configuration", choices: choices)
986
+ result = modal.show(
987
+ title: "Model Configuration",
988
+ choices: choices,
989
+ on_close: -> { @layout.rerender_all }
990
+ )
943
991
 
944
992
  return nil if result.nil?
945
993
 
@@ -1037,7 +1085,8 @@ module Clacky
1037
1085
  # Show modal
1038
1086
  result = modal.show(
1039
1087
  title: "Time Machine - Select Task to Navigate",
1040
- choices: choices
1088
+ choices: choices,
1089
+ on_close: -> { @layout.rerender_all }
1041
1090
  )
1042
1091
 
1043
1092
  result # Return selected task_id or nil
@@ -1065,7 +1114,8 @@ module Clacky
1065
1114
  # Show provider selection
1066
1115
  selected_provider = modal.show(
1067
1116
  title: "Select Provider",
1068
- choices: provider_choices
1117
+ choices: provider_choices,
1118
+ on_close: -> { @layout.rerender_all }
1069
1119
  )
1070
1120
 
1071
1121
  # User cancelled
@@ -1157,7 +1207,8 @@ module Clacky
1157
1207
  result = modal.show(
1158
1208
  title: modal_title,
1159
1209
  fields: fields,
1160
- validator: validator
1210
+ validator: validator,
1211
+ on_close: -> { @layout.rerender_all }
1161
1212
  )
1162
1213
 
1163
1214
  return nil if result.nil?
data/lib/clacky/ui2.rb CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  require_relative "ui2/thinking_verbs"
7
7
  require_relative "ui2/progress_indicator"
8
+ require_relative "ui2/terminal_detector"
8
9
  require_relative "ui2/theme_manager"
9
10
  require_relative "ui2/screen_buffer"
10
11
  require_relative "ui2/layout_manager"
@@ -31,6 +31,11 @@ module Clacky
31
31
  self
32
32
  end
33
33
 
34
+ # Remove and return the last element
35
+ def pop
36
+ @items.pop
37
+ end
38
+
34
39
  # Get last N elements
35
40
  def last(n = nil)
36
41
  n ? @items.last(n) : @items.last
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clacky
4
- VERSION = "0.7.2"
4
+ VERSION = "0.7.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openclacky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - windy
@@ -198,7 +198,10 @@ files:
198
198
  - lib/clacky/default_skills/deploy/tools/report_deploy_status.rb
199
199
  - lib/clacky/default_skills/deploy/tools/set_deploy_variables.rb
200
200
  - lib/clacky/default_skills/new/SKILL.md
201
+ - lib/clacky/default_skills/new/scripts/create_rails_project.sh
202
+ - lib/clacky/default_skills/new/scripts/rails_env_checker.sh
201
203
  - lib/clacky/default_skills/skill-add/SKILL.md
204
+ - lib/clacky/default_skills/skill-add/scripts/install_from_github.rb
202
205
  - lib/clacky/json_ui_controller.rb
203
206
  - lib/clacky/providers.rb
204
207
  - lib/clacky/session_manager.rb
@@ -239,6 +242,7 @@ files:
239
242
  - lib/clacky/ui2/markdown_renderer.rb
240
243
  - lib/clacky/ui2/progress_indicator.rb
241
244
  - lib/clacky/ui2/screen_buffer.rb
245
+ - lib/clacky/ui2/terminal_detector.rb
242
246
  - lib/clacky/ui2/theme_manager.rb
243
247
  - lib/clacky/ui2/themes/base_theme.rb
244
248
  - lib/clacky/ui2/themes/hacker_theme.rb