fantasy-cli 1.2.14 → 1.3.0
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 +4 -4
- data/README.md +8 -1
- data/lib/gsd/agents/communication.rb +260 -0
- data/lib/gsd/agents/swarm.rb +341 -0
- data/lib/gsd/lsp/client.rb +394 -0
- data/lib/gsd/lsp/completion.rb +266 -0
- data/lib/gsd/lsp/diagnostics.rb +259 -0
- data/lib/gsd/lsp/hover.rb +244 -0
- data/lib/gsd/lsp/protocol.rb +434 -0
- data/lib/gsd/lsp/server_manager.rb +290 -0
- data/lib/gsd/lsp/symbols.rb +368 -0
- data/lib/gsd/plugins/api.rb +340 -0
- data/lib/gsd/plugins/hooks.rb +117 -95
- data/lib/gsd/plugins/hot_reload.rb +293 -0
- data/lib/gsd/plugins/registry.rb +273 -0
- data/lib/gsd/tui/agent_panel.rb +182 -0
- data/lib/gsd/tui/animations.rb +320 -0
- data/lib/gsd/tui/app.rb +442 -2
- data/lib/gsd/tui/colors.rb +15 -0
- data/lib/gsd/tui/effects.rb +263 -0
- data/lib/gsd/tui/header.rb +13 -5
- data/lib/gsd/tui/input_box.rb +10 -7
- data/lib/gsd/tui/mouse.rb +388 -0
- data/lib/gsd/tui/persistence.rb +192 -0
- data/lib/gsd/tui/session.rb +273 -0
- data/lib/gsd/tui/status_bar.rb +63 -15
- data/lib/gsd/tui/tab.rb +112 -0
- data/lib/gsd/tui/tab_manager.rb +191 -0
- data/lib/gsd/tui/transitions.rb +262 -0
- data/lib/gsd/version.rb +1 -1
- metadata +22 -1
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Gsd
|
|
4
|
+
module TUI
|
|
5
|
+
# Transitions - Gerenciamento de transições entre estados/telas
|
|
6
|
+
#
|
|
7
|
+
# Suporta:
|
|
8
|
+
# - Fade transitions
|
|
9
|
+
# - Slide transitions
|
|
10
|
+
# - Wipe effects
|
|
11
|
+
# - Cross-fade entre componentes
|
|
12
|
+
class Transition
|
|
13
|
+
attr_reader :type, :duration, :from_state, :to_state, :progress
|
|
14
|
+
|
|
15
|
+
TYPES = %i[fade slide_left slide_right slide_up slide_down wipe crossfade].freeze
|
|
16
|
+
|
|
17
|
+
def initialize(type:, duration: 0.3, from: nil, to: nil, &block)
|
|
18
|
+
@type = type
|
|
19
|
+
@duration = duration
|
|
20
|
+
@from_state = from
|
|
21
|
+
@to_state = to
|
|
22
|
+
@progress = 0.0
|
|
23
|
+
@running = false
|
|
24
|
+
@callback = block
|
|
25
|
+
@thread = nil
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def start
|
|
29
|
+
return if @running
|
|
30
|
+
|
|
31
|
+
@running = true
|
|
32
|
+
@progress = 0.0
|
|
33
|
+
start_time = Time.now
|
|
34
|
+
|
|
35
|
+
@thread = Thread.new do
|
|
36
|
+
loop do
|
|
37
|
+
elapsed = Time.now - start_time
|
|
38
|
+
@progress = [elapsed / @duration, 1.0].min
|
|
39
|
+
|
|
40
|
+
@callback&.call(@progress, self)
|
|
41
|
+
|
|
42
|
+
if @progress >= 1.0
|
|
43
|
+
@running = false
|
|
44
|
+
break
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
sleep(1.0 / 60)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
self
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def stop
|
|
55
|
+
@running = false
|
|
56
|
+
@thread&.kill
|
|
57
|
+
@thread = nil
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def finished?
|
|
61
|
+
!@running && @progress >= 1.0
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Easing para transições suaves
|
|
65
|
+
def eased_progress
|
|
66
|
+
return 0.0 if @progress <= 0.0
|
|
67
|
+
return 1.0 if @progress >= 1.0
|
|
68
|
+
|
|
69
|
+
# Cubic ease-in-out
|
|
70
|
+
p = @progress
|
|
71
|
+
p < 0.5 ? 4 * p * p * p : 1 - ((-2 * p + 2)**3) / 2
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# TransitionManager - Gerencia transições entre diferentes views/estados
|
|
76
|
+
class TransitionManager
|
|
77
|
+
def initialize
|
|
78
|
+
@current_transition = nil
|
|
79
|
+
@state_stack = []
|
|
80
|
+
@mutex = Mutex.new
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Inicia transição para novo estado
|
|
84
|
+
def transition_to(new_state, type: :fade, duration: 0.3, &block)
|
|
85
|
+
@mutex.synchronize do
|
|
86
|
+
@current_transition&.stop
|
|
87
|
+
|
|
88
|
+
old_state = @state_stack.last
|
|
89
|
+
@state_stack << new_state
|
|
90
|
+
|
|
91
|
+
@current_transition = Transition.new(
|
|
92
|
+
type: type,
|
|
93
|
+
duration: duration,
|
|
94
|
+
from: old_state,
|
|
95
|
+
to: new_state
|
|
96
|
+
) do |progress, trans|
|
|
97
|
+
block&.call(progress, trans.from_state, trans.to_state)
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
@current_transition.start
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Volta para estado anterior
|
|
105
|
+
def go_back(type: :fade, duration: 0.3, &block)
|
|
106
|
+
@mutex.synchronize do
|
|
107
|
+
return false if @state_stack.length <= 1
|
|
108
|
+
|
|
109
|
+
@current_transition&.stop
|
|
110
|
+
to_state = @state_stack[-2]
|
|
111
|
+
from_state = @state_stack.pop
|
|
112
|
+
|
|
113
|
+
@current_transition = Transition.new(
|
|
114
|
+
type: type,
|
|
115
|
+
duration: duration,
|
|
116
|
+
from: from_state,
|
|
117
|
+
to: to_state
|
|
118
|
+
) do |progress, trans|
|
|
119
|
+
block&.call(progress, trans.from_state, trans.to_state)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
@current_transition.start
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Substitui estado atual sem animação
|
|
127
|
+
def replace_state(new_state)
|
|
128
|
+
@mutex.synchronize do
|
|
129
|
+
@state_stack.pop
|
|
130
|
+
@state_stack << new_state
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# Estado atual
|
|
135
|
+
def current_state
|
|
136
|
+
@mutex.synchronize { @state_stack.last }
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Pilha de estados
|
|
140
|
+
def state_stack
|
|
141
|
+
@mutex.synchronize { @state_stack.dup }
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Limpa todas as transições
|
|
145
|
+
def clear
|
|
146
|
+
@mutex.synchronize do
|
|
147
|
+
@current_transition&.stop
|
|
148
|
+
@current_transition = nil
|
|
149
|
+
@state_stack.clear
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Verifica se há transição em andamento
|
|
154
|
+
def transitioning?
|
|
155
|
+
@current_transition&.running || false
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
# Progresso da transição atual
|
|
159
|
+
def transition_progress
|
|
160
|
+
@current_transition&.progress || 0.0
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# ViewTransition - Transições específicas para views do TUI
|
|
165
|
+
class ViewTransition
|
|
166
|
+
def initialize(app)
|
|
167
|
+
@app = app
|
|
168
|
+
@manager = TransitionManager.new
|
|
169
|
+
@overlay_buffer = []
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Transição para command palette
|
|
173
|
+
def show_palette(&block)
|
|
174
|
+
@manager.transition_to(:palette, type: :fade, duration: 0.15) do |progress, from, to|
|
|
175
|
+
@app.instance_variable_set(:@palette_opacity, progress)
|
|
176
|
+
block&.call(progress)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Transição para agent panel
|
|
181
|
+
def show_agent_panel(&block)
|
|
182
|
+
@manager.transition_to(:agent_panel, type: :slide_right, duration: 0.2) do |progress, from, to|
|
|
183
|
+
@app.instance_variable_set(:@panel_offset, (1 - progress) * 60)
|
|
184
|
+
block&.call(progress)
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Transição de mensagens (fade in)
|
|
189
|
+
def message_appear(message_id, &block)
|
|
190
|
+
Animation.new(type: :fade_in, duration: 0.3) do |event, anim|
|
|
191
|
+
if event == :frame
|
|
192
|
+
opacity = anim.ease_out
|
|
193
|
+
@app.instance_variable_set(:@message_opacities, {}) unless @app.instance_variable_get(:@message_opacities)
|
|
194
|
+
@app.instance_variable_get(:@message_opacities)[message_id] = opacity
|
|
195
|
+
block&.call(opacity)
|
|
196
|
+
end
|
|
197
|
+
end.start
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Wipe transition para novas abas
|
|
201
|
+
def tab_switch(from_tab, to_tab, &block)
|
|
202
|
+
@manager.transition_to(to_tab, type: :wipe, duration: 0.2) do |progress, from, to|
|
|
203
|
+
block&.call(progress, from, to)
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Crossfade entre temas
|
|
208
|
+
def theme_change(from_theme, to_theme, &block)
|
|
209
|
+
@manager.transition_to(to_theme, type: :crossfade, duration: 0.4) do |progress, from, to|
|
|
210
|
+
block&.call(progress, from, to)
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Render helper para transições
|
|
215
|
+
def render_transition_overlay
|
|
216
|
+
return unless @manager.transitioning?
|
|
217
|
+
|
|
218
|
+
progress = @manager.transition_progress
|
|
219
|
+
eased = @manager.instance_variable_get(:@current_transition)&.eased_progress || progress
|
|
220
|
+
|
|
221
|
+
# Efeito de fade baseado no progresso
|
|
222
|
+
alpha = (eased * 255).round
|
|
223
|
+
dim_level = 255 - alpha
|
|
224
|
+
|
|
225
|
+
"#{Colors::ESC}[38;2;#{dim_level};#{dim_level};#{dim_level}m"
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# PageFlip - Efeito de "virar página" para histórico
|
|
230
|
+
class PageFlip
|
|
231
|
+
def initialize(lines:, &block)
|
|
232
|
+
@lines = lines
|
|
233
|
+
@callback = block
|
|
234
|
+
@frame = 0
|
|
235
|
+
@running = false
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def start
|
|
239
|
+
return if @running
|
|
240
|
+
|
|
241
|
+
@running = true
|
|
242
|
+
@frame = 0
|
|
243
|
+
|
|
244
|
+
Thread.new do
|
|
245
|
+
while @running && @frame < @lines.length
|
|
246
|
+
visible = @lines[0..@frame]
|
|
247
|
+
@callback&.call(visible, @frame)
|
|
248
|
+
@frame += 1
|
|
249
|
+
sleep(0.05)
|
|
250
|
+
end
|
|
251
|
+
@running = false
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
self
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
def stop
|
|
258
|
+
@running = false
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
end
|
data/lib/gsd/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fantasy-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fantasy Team
|
|
@@ -112,7 +112,9 @@ files:
|
|
|
112
112
|
- bin/gsd-core-windows-arm64.exe
|
|
113
113
|
- bin/gsd-core.exe
|
|
114
114
|
- lib/gsd/agents.rb
|
|
115
|
+
- lib/gsd/agents/communication.rb
|
|
115
116
|
- lib/gsd/agents/coordinator.rb
|
|
117
|
+
- lib/gsd/agents/swarm.rb
|
|
116
118
|
- lib/gsd/agents/task_manager.rb
|
|
117
119
|
- lib/gsd/agents/worker.rb
|
|
118
120
|
- lib/gsd/ai/chat.rb
|
|
@@ -167,18 +169,28 @@ files:
|
|
|
167
169
|
- lib/gsd/frontmatter.rb
|
|
168
170
|
- lib/gsd/go/bridge.rb
|
|
169
171
|
- lib/gsd/history.rb
|
|
172
|
+
- lib/gsd/lsp/client.rb
|
|
173
|
+
- lib/gsd/lsp/completion.rb
|
|
174
|
+
- lib/gsd/lsp/diagnostics.rb
|
|
175
|
+
- lib/gsd/lsp/hover.rb
|
|
176
|
+
- lib/gsd/lsp/protocol.rb
|
|
177
|
+
- lib/gsd/lsp/server_manager.rb
|
|
178
|
+
- lib/gsd/lsp/symbols.rb
|
|
170
179
|
- lib/gsd/milestone.rb
|
|
171
180
|
- lib/gsd/output.rb
|
|
172
181
|
- lib/gsd/phase.rb
|
|
173
182
|
- lib/gsd/plugins.rb
|
|
183
|
+
- lib/gsd/plugins/api.rb
|
|
174
184
|
- lib/gsd/plugins/base.rb
|
|
175
185
|
- lib/gsd/plugins/cli.rb
|
|
176
186
|
- lib/gsd/plugins/config.rb
|
|
177
187
|
- lib/gsd/plugins/hooks.rb
|
|
188
|
+
- lib/gsd/plugins/hot_reload.rb
|
|
178
189
|
- lib/gsd/plugins/installer.rb
|
|
179
190
|
- lib/gsd/plugins/loader.rb
|
|
180
191
|
- lib/gsd/plugins/manager.rb
|
|
181
192
|
- lib/gsd/plugins/marketplace.rb
|
|
193
|
+
- lib/gsd/plugins/registry.rb
|
|
182
194
|
- lib/gsd/plugins/sandbox.rb
|
|
183
195
|
- lib/gsd/plugins/search.rb
|
|
184
196
|
- lib/gsd/plugins/validator.rb
|
|
@@ -212,14 +224,23 @@ files:
|
|
|
212
224
|
- lib/gsd/tools/todo_write.rb
|
|
213
225
|
- lib/gsd/tools/web.rb
|
|
214
226
|
- lib/gsd/tui.rb
|
|
227
|
+
- lib/gsd/tui/agent_panel.rb
|
|
228
|
+
- lib/gsd/tui/animations.rb
|
|
215
229
|
- lib/gsd/tui/app.rb
|
|
216
230
|
- lib/gsd/tui/auto_complete.rb
|
|
217
231
|
- lib/gsd/tui/colors.rb
|
|
218
232
|
- lib/gsd/tui/command_palette.rb
|
|
233
|
+
- lib/gsd/tui/effects.rb
|
|
219
234
|
- lib/gsd/tui/header.rb
|
|
220
235
|
- lib/gsd/tui/input_box.rb
|
|
236
|
+
- lib/gsd/tui/mouse.rb
|
|
237
|
+
- lib/gsd/tui/persistence.rb
|
|
238
|
+
- lib/gsd/tui/session.rb
|
|
221
239
|
- lib/gsd/tui/spinner.rb
|
|
222
240
|
- lib/gsd/tui/status_bar.rb
|
|
241
|
+
- lib/gsd/tui/tab.rb
|
|
242
|
+
- lib/gsd/tui/tab_manager.rb
|
|
243
|
+
- lib/gsd/tui/transitions.rb
|
|
223
244
|
- lib/gsd/validator.rb
|
|
224
245
|
- lib/gsd/verify.rb
|
|
225
246
|
- lib/gsd/version.rb
|