swarm_cli 3.0.0.alpha2 → 3.0.0.alpha3

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: 54f2afe1d7e949a29c1c257d51da1c2356d72093a7dc352795b9b49649ce6068
4
- data.tar.gz: c5fc91ff7d7505d7ca44127b62100f8f0e26d92cfe497309f1589fdba6ac7894
3
+ metadata.gz: 733ba737a80d7fd602ef6e4482547167cf36e8b1ed8fdc80a78594aee0174df2
4
+ data.tar.gz: ea4acde5fddc3f37907df76ed3730a3ec4c6ed38a75340d31386802405b205d7
5
5
  SHA512:
6
- metadata.gz: cb4ed1132f74f4f010ea4410e64a697e1145558512900565dc1c71e8fdc939b582e8bb7f364b390e999dae46c1e9569616a76c97dade67ce8765c1e5a363f2e5
7
- data.tar.gz: 0db61c92971142f794bbbb238f8993aedda89dfa7e3233aa1a83715cb35da82f05bf35307a4b7c66e46cb2e150584e0b2a266e9d9a8b4787154e141b514eb8fc
6
+ metadata.gz: e329d281f641dc43edb4dc94a6aef054b72b01595030f6f52ec86e281c6bcb77331ffa806c3a8b57d958b2919ece3a06eb2a5c46628a7f06cce80eef17a3cc85
7
+ data.tar.gz: 67aa0df4a2772992df89ee3f50aa8135ee895262995603ba60553b1fa0ac1eea4dddecbc75979d305d79c7b0759892c9ba3c2b1f2479e56b8d531f6e23a52546
@@ -396,6 +396,8 @@ module SwarmCLI
396
396
  # Auto-trigger autocomplete if in auto mode
397
397
  if @autocomplete_mode == :auto
398
398
  handle_autocomplete_trigger(agent, display)
399
+ # Auto-close dropdown if exact unique match
400
+ auto_close_on_exact_match(display)
399
401
  elsif display.dropdown_active?
400
402
  # Manual mode: close dropdown on typing
401
403
  display.dropdown_close
@@ -407,6 +409,20 @@ module SwarmCLI
407
409
  end
408
410
  end
409
411
 
412
+ # Auto-close dropdown if buffer exactly matches a unique result.
413
+ # This prevents needing to press Enter twice (once to accept, once to submit).
414
+ def auto_close_on_exact_match(display)
415
+ return unless display.dropdown_active?
416
+
417
+ buffer = display.current_buffer.strip
418
+ dropdown_items = display.dropdown_items || []
419
+
420
+ # If buffer exactly matches the only item, auto-close dropdown
421
+ if dropdown_items.size == 1 && dropdown_items.first == buffer
422
+ display.dropdown_close
423
+ end
424
+ end
425
+
410
426
  # Trigger autocomplete: extract word, find matches, show dropdown
411
427
  def handle_autocomplete_trigger(agent, display)
412
428
  buffer = display.current_buffer
@@ -395,6 +395,13 @@ module SwarmCLI
395
395
  @mutex.synchronize { !@dropdown.nil? }
396
396
  end
397
397
 
398
+ # Get dropdown items if dropdown is active.
399
+ #
400
+ # @return [Array<String>, nil] dropdown items or nil if no dropdown
401
+ def dropdown_items
402
+ @mutex.synchronize { @dropdown&.items }
403
+ end
404
+
398
405
  # Return a copy of the current input buffer (thread-safe).
399
406
  #
400
407
  # @return [String]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swarm_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.alpha2
4
+ version: 3.0.0.alpha3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda