aia 0.9.11 → 0.9.13
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/.envrc +2 -0
- data/.version +1 -1
- data/CHANGELOG.md +66 -2
- data/README.md +133 -4
- data/docs/advanced-prompting.md +721 -0
- data/docs/cli-reference.md +582 -0
- data/docs/configuration.md +347 -0
- data/docs/contributing.md +332 -0
- data/docs/directives-reference.md +490 -0
- data/docs/examples/index.md +277 -0
- data/docs/examples/mcp/index.md +479 -0
- data/docs/examples/prompts/analysis/index.md +78 -0
- data/docs/examples/prompts/automation/index.md +108 -0
- data/docs/examples/prompts/development/index.md +125 -0
- data/docs/examples/prompts/index.md +333 -0
- data/docs/examples/prompts/learning/index.md +127 -0
- data/docs/examples/prompts/writing/index.md +62 -0
- data/docs/examples/tools/index.md +292 -0
- data/docs/faq.md +414 -0
- data/docs/guides/available-models.md +366 -0
- data/docs/guides/basic-usage.md +477 -0
- data/docs/guides/chat.md +474 -0
- data/docs/guides/executable-prompts.md +417 -0
- data/docs/guides/first-prompt.md +454 -0
- data/docs/guides/getting-started.md +455 -0
- data/docs/guides/image-generation.md +507 -0
- data/docs/guides/index.md +46 -0
- data/docs/guides/models.md +507 -0
- data/docs/guides/tools.md +856 -0
- data/docs/index.md +173 -0
- data/docs/installation.md +238 -0
- data/docs/mcp-integration.md +612 -0
- data/docs/prompt_management.md +579 -0
- data/docs/security.md +629 -0
- data/docs/tools-and-mcp-examples.md +1186 -0
- data/docs/workflows-and-pipelines.md +563 -0
- data/examples/tools/mcp/github_mcp_server.json +11 -0
- data/examples/tools/mcp/imcp.json +7 -0
- data/lib/aia/chat_processor_service.rb +38 -7
- data/lib/aia/config/base.rb +224 -0
- data/lib/aia/config/cli_parser.rb +418 -0
- data/lib/aia/config/defaults.rb +88 -0
- data/lib/aia/config/file_loader.rb +131 -0
- data/lib/aia/config/validator.rb +184 -0
- data/lib/aia/config.rb +10 -860
- data/lib/aia/directive_processor.rb +27 -372
- data/lib/aia/directives/configuration.rb +114 -0
- data/lib/aia/directives/execution.rb +37 -0
- data/lib/aia/directives/models.rb +178 -0
- data/lib/aia/directives/registry.rb +120 -0
- data/lib/aia/directives/utility.rb +70 -0
- data/lib/aia/directives/web_and_file.rb +71 -0
- data/lib/aia/prompt_handler.rb +23 -3
- data/lib/aia/ruby_llm_adapter.rb +367 -130
- data/lib/aia/session.rb +54 -18
- data/lib/aia/ui_presenter.rb +206 -0
- data/lib/aia/utility.rb +12 -8
- data/lib/aia.rb +11 -2
- data/lib/extensions/ruby_llm/.irbrc +56 -0
- data/mkdocs.yml +165 -0
- metadata +79 -37
- data/_notes.txt +0 -231
- /data/{images → docs/assets/images}/aia.png +0 -0
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dewayne VanHoozer
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
41
|
+
name: async
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
@@ -52,63 +52,63 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
|
-
name:
|
55
|
+
name: faraday
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0
|
60
|
+
version: '0'
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0
|
67
|
+
version: '0'
|
68
68
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
69
|
+
name: prompt_manager
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
74
|
+
version: 0.5.8
|
75
75
|
type: :runtime
|
76
76
|
prerelease: false
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: 0.5.8
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
|
-
name: ruby_llm
|
83
|
+
name: ruby_llm
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 1.5.1
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: 1.5.1
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
|
-
name:
|
97
|
+
name: ruby_llm-mcp
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: 0.6.1
|
103
103
|
type: :runtime
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 0.6.1
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
111
|
+
name: reline
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - ">="
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- !ruby/object:Gem::Version
|
123
123
|
version: '0'
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
|
-
name:
|
125
|
+
name: shellwords
|
126
126
|
requirement: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - ">="
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
- !ruby/object:Gem::Dependency
|
139
|
-
name:
|
139
|
+
name: toml-rb
|
140
140
|
requirement: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - ">="
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- !ruby/object:Gem::Version
|
151
151
|
version: '0'
|
152
152
|
- !ruby/object:Gem::Dependency
|
153
|
-
name: tty-
|
153
|
+
name: tty-screen
|
154
154
|
requirement: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - ">="
|
@@ -164,7 +164,7 @@ dependencies:
|
|
164
164
|
- !ruby/object:Gem::Version
|
165
165
|
version: '0'
|
166
166
|
- !ruby/object:Gem::Dependency
|
167
|
-
name:
|
167
|
+
name: tty-spinner
|
168
168
|
requirement: !ruby/object:Gem::Requirement
|
169
169
|
requirements:
|
170
170
|
- - ">="
|
@@ -289,20 +289,16 @@ dependencies:
|
|
289
289
|
- - ">="
|
290
290
|
- !ruby/object:Gem::Version
|
291
291
|
version: '0'
|
292
|
-
description:
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
for developers, power users, and AI enthusiasts alike. Transform
|
303
|
-
your command line into a powerhouse of creativity and efficiency.
|
304
|
-
Elevate your workflow with AIA and unleash the full potential of
|
305
|
-
AI at your fingertips!
|
292
|
+
description: 'AIA is a revolutionary CLI console application that brings multi-model
|
293
|
+
AI capabilities to your command line, supporting 20+ providers including OpenAI,
|
294
|
+
Anthropic, and Google. Run multiple AI models simultaneously for comparison, get
|
295
|
+
consensus responses from collaborative AI teams, or compare individual outputs side-by-side.
|
296
|
+
With dynamic prompt management, embedded directives, shell and Ruby integration,
|
297
|
+
interactive chats, and comprehensive history tracking, AIA transforms how you interact
|
298
|
+
with AI. Perfect for developers and AI enthusiasts who want to harness the collective
|
299
|
+
intelligence of multiple AI models from a single, powerful interface.
|
300
|
+
|
301
|
+
'
|
306
302
|
email:
|
307
303
|
- dvanhoozer@gmail.com
|
308
304
|
executables:
|
@@ -319,8 +315,40 @@ files:
|
|
319
315
|
- LICENSE
|
320
316
|
- README.md
|
321
317
|
- Rakefile
|
322
|
-
- _notes.txt
|
323
318
|
- bin/aia
|
319
|
+
- docs/advanced-prompting.md
|
320
|
+
- docs/assets/images/aia.png
|
321
|
+
- docs/cli-reference.md
|
322
|
+
- docs/configuration.md
|
323
|
+
- docs/contributing.md
|
324
|
+
- docs/directives-reference.md
|
325
|
+
- docs/examples/index.md
|
326
|
+
- docs/examples/mcp/index.md
|
327
|
+
- docs/examples/prompts/analysis/index.md
|
328
|
+
- docs/examples/prompts/automation/index.md
|
329
|
+
- docs/examples/prompts/development/index.md
|
330
|
+
- docs/examples/prompts/index.md
|
331
|
+
- docs/examples/prompts/learning/index.md
|
332
|
+
- docs/examples/prompts/writing/index.md
|
333
|
+
- docs/examples/tools/index.md
|
334
|
+
- docs/faq.md
|
335
|
+
- docs/guides/available-models.md
|
336
|
+
- docs/guides/basic-usage.md
|
337
|
+
- docs/guides/chat.md
|
338
|
+
- docs/guides/executable-prompts.md
|
339
|
+
- docs/guides/first-prompt.md
|
340
|
+
- docs/guides/getting-started.md
|
341
|
+
- docs/guides/image-generation.md
|
342
|
+
- docs/guides/index.md
|
343
|
+
- docs/guides/models.md
|
344
|
+
- docs/guides/tools.md
|
345
|
+
- docs/index.md
|
346
|
+
- docs/installation.md
|
347
|
+
- docs/mcp-integration.md
|
348
|
+
- docs/prompt_management.md
|
349
|
+
- docs/security.md
|
350
|
+
- docs/tools-and-mcp-examples.md
|
351
|
+
- docs/workflows-and-pipelines.md
|
324
352
|
- examples/README.md
|
325
353
|
- examples/directives/ask.rb
|
326
354
|
- examples/headlines
|
@@ -337,11 +365,12 @@ files:
|
|
337
365
|
- examples/tools/incomplete/workflow_manager_tool.rb
|
338
366
|
- examples/tools/list_files.rb
|
339
367
|
- examples/tools/mcp/README.md
|
368
|
+
- examples/tools/mcp/github_mcp_server.json
|
340
369
|
- examples/tools/mcp/github_mcp_server.rb
|
370
|
+
- examples/tools/mcp/imcp.json
|
341
371
|
- examples/tools/mcp/imcp.rb
|
342
372
|
- examples/tools/read_file.rb
|
343
373
|
- examples/tools/run_shell_command.rb
|
344
|
-
- images/aia.png
|
345
374
|
- justfile
|
346
375
|
- lib/aia.rb
|
347
376
|
- lib/aia/aia_completion.bash
|
@@ -349,8 +378,19 @@ files:
|
|
349
378
|
- lib/aia/aia_completion.zsh
|
350
379
|
- lib/aia/chat_processor_service.rb
|
351
380
|
- lib/aia/config.rb
|
381
|
+
- lib/aia/config/base.rb
|
382
|
+
- lib/aia/config/cli_parser.rb
|
383
|
+
- lib/aia/config/defaults.rb
|
384
|
+
- lib/aia/config/file_loader.rb
|
385
|
+
- lib/aia/config/validator.rb
|
352
386
|
- lib/aia/context_manager.rb
|
353
387
|
- lib/aia/directive_processor.rb
|
388
|
+
- lib/aia/directives/configuration.rb
|
389
|
+
- lib/aia/directives/execution.rb
|
390
|
+
- lib/aia/directives/models.rb
|
391
|
+
- lib/aia/directives/registry.rb
|
392
|
+
- lib/aia/directives/utility.rb
|
393
|
+
- lib/aia/directives/web_and_file.rb
|
354
394
|
- lib/aia/fzf.rb
|
355
395
|
- lib/aia/history_manager.rb
|
356
396
|
- lib/aia/prompt_handler.rb
|
@@ -360,6 +400,7 @@ files:
|
|
360
400
|
- lib/aia/utility.rb
|
361
401
|
- lib/aia/version.rb
|
362
402
|
- lib/extensions/openstruct_merge.rb
|
403
|
+
- lib/extensions/ruby_llm/.irbrc
|
363
404
|
- lib/extensions/ruby_llm/modalities.rb
|
364
405
|
- lib/refinements/string.rb
|
365
406
|
- main.just
|
@@ -369,6 +410,7 @@ files:
|
|
369
410
|
- mcp_servers/launcher.json
|
370
411
|
- mcp_servers/playwright_server_definition.json
|
371
412
|
- mcp_servers/timeserver.json
|
413
|
+
- mkdocs.yml
|
372
414
|
homepage: https://github.com/MadBomber/aia
|
373
415
|
licenses:
|
374
416
|
- MIT
|
@@ -393,6 +435,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
393
435
|
requirements: []
|
394
436
|
rubygems_version: 3.7.1
|
395
437
|
specification_version: 4
|
396
|
-
summary:
|
397
|
-
workflows.
|
438
|
+
summary: Multi-model AI CLI with dynamic prompts, consensus responses, shell & Ruby
|
439
|
+
integration, and seamless chat workflows.
|
398
440
|
test_files: []
|
data/_notes.txt
DELETED
@@ -1,231 +0,0 @@
|
|
1
|
-
|
2
|
-
--- 2025-02-01 18:01:36 -0600
|
3
|
-
I have no idea where I left off in this branch. The objective is to replace all the back-end processes with AiClient.
|
4
|
-
|
5
|
-
Tests are failing.
|
6
|
-
|
7
|
-
Make a few changes. It seems to be working in its basic modes.
|
8
|
-
|
9
|
-
--- 2025-02-21 20:13:19 -0600
|
10
|
-
Implemented Stark's clean slate protocol
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
--- 2025-03-29 21:39:46 -0500
|
17
|
-
starting the refactor to take advantage of the new capability of the PromptMananger gem.
|
18
|
-
|
19
|
-
lib/aia/chat_processor_service.rb
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
--- 2025-04-03 22:17:11 -0500
|
24
|
-
i have been tring to get multi-line input to work in the chat mode but have run into all kinds of problems. I think it would be best just to invoke the users editor for that kind of operation. Alo I am not sure but I thing the same ask method is used for getting values for parameters. changes may have been committed but they should be reversed back to the original and start over.
|
25
|
-
|
26
|
-
def get_multiline_input
|
27
|
-
input_lines = []
|
28
|
-
current_line = ""
|
29
|
-
last_key_time = Time.now
|
30
|
-
waiting_printed = 0 # Track number of WAITING characters printed
|
31
|
-
|
32
|
-
STDIN.raw! # Enable raw mode for immediate keypress detection
|
33
|
-
begin
|
34
|
-
loop do
|
35
|
-
begin
|
36
|
-
r, _, _ = IO.select([STDIN], nil, nil, 0.1)
|
37
|
-
if r
|
38
|
-
char = STDIN.getc
|
39
|
-
last_key_time = Time.now
|
40
|
-
# Clear waiting characters when user types again
|
41
|
-
if waiting_printed > 0
|
42
|
-
print WAITING_ERASE * waiting_printed # Erase all waiting characters
|
43
|
-
$stdout.flush
|
44
|
-
waiting_printed = 0
|
45
|
-
end
|
46
|
-
else
|
47
|
-
if (Time.now - last_key_time >= KEYPRESS_TIMEUT) &&
|
48
|
-
waiting_printed == 0 &&
|
49
|
-
(!input_lines.empty? || !current_line.empty?)
|
50
|
-
print WAITING
|
51
|
-
$stdout.flush
|
52
|
-
waiting_printed = 1 # Record one '?' printed
|
53
|
-
end
|
54
|
-
next
|
55
|
-
end
|
56
|
-
|
57
|
-
rescue Interrupt
|
58
|
-
puts "\nInput cancelled. Discarding current input; please start over."
|
59
|
-
input_lines = []
|
60
|
-
current_line = ""
|
61
|
-
waiting_printed = 0
|
62
|
-
last_key_time = Time.now
|
63
|
-
next
|
64
|
-
end
|
65
|
-
|
66
|
-
break if char.nil? # Handle EOF (Ctrl+D)
|
67
|
-
|
68
|
-
if char == "\r" || char == "\n"
|
69
|
-
if current_line.empty? && !input_lines.empty?
|
70
|
-
break # Two Enters in a row submits
|
71
|
-
else
|
72
|
-
input_lines << current_line
|
73
|
-
current_line = ""
|
74
|
-
waiting_printed = 0 # Reset waiting on new line
|
75
|
-
print "\n\r"
|
76
|
-
$stdout.flush
|
77
|
-
end
|
78
|
-
|
79
|
-
elsif char == "\x04" # Ctrl+D
|
80
|
-
break
|
81
|
-
|
82
|
-
elsif char == "\x08" || char == "\x7F" # Backspace or Delete
|
83
|
-
if !current_line.empty?
|
84
|
-
current_line.chop!
|
85
|
-
print WAITING_ERASE
|
86
|
-
$stdout.flush
|
87
|
-
elsif waiting_printed > 0
|
88
|
-
# Clear one waiting character if current_line is empty
|
89
|
-
print "\b \b"
|
90
|
-
$stdout.flush
|
91
|
-
waiting_printed -= 1
|
92
|
-
end
|
93
|
-
|
94
|
-
else
|
95
|
-
current_line << char
|
96
|
-
print char
|
97
|
-
$stdout.flush
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
ensure
|
102
|
-
STDIN.cooked! # Restore terminal to normal mode
|
103
|
-
end
|
104
|
-
|
105
|
-
input_lines << current_line unless current_line.empty?
|
106
|
-
|
107
|
-
# Handle single-line special case
|
108
|
-
if input_lines.size == 1
|
109
|
-
if special_first_line_processing(input_lines.first)
|
110
|
-
# If special (starts with "//"), return immediately as if double return was pressed
|
111
|
-
return input_lines.first
|
112
|
-
else
|
113
|
-
# If not special, keep as is and return the full input
|
114
|
-
return input_lines.join("\n")
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
input_lines.join("\n").tap do |result|
|
119
|
-
puts "\n" if result.empty? # Clean up display if no input
|
120
|
-
end
|
121
|
-
|
122
|
-
rescue EOFError
|
123
|
-
input_lines.join("\n")
|
124
|
-
end
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
--- 2025-04-03 22:18:18 -0500
|
129
|
-
by using subl -w for multi-line input in chat mode that gives us the ability to write ERB for chat input.
|
130
|
-
|
131
|
-
def get_multiline_input
|
132
|
-
input_lines = []
|
133
|
-
current_line = ""
|
134
|
-
last_key_time = Time.now
|
135
|
-
waiting_printed = 0 # Track number of WAITING characters printed
|
136
|
-
|
137
|
-
STDIN.raw! # Enable raw mode for immediate keypress detection
|
138
|
-
begin
|
139
|
-
loop do
|
140
|
-
begin
|
141
|
-
r, _, _ = IO.select([STDIN], nil, nil, 0.1)
|
142
|
-
if r
|
143
|
-
char = STDIN.getc
|
144
|
-
last_key_time = Time.now
|
145
|
-
# Clear waiting characters when user types again
|
146
|
-
if waiting_printed > 0
|
147
|
-
print WAITING_ERASE * waiting_printed # Erase all waiting characters
|
148
|
-
$stdout.flush
|
149
|
-
waiting_printed = 0
|
150
|
-
end
|
151
|
-
else
|
152
|
-
if (Time.now - last_key_time >= KEYPRESS_TIMEUT) &&
|
153
|
-
waiting_printed == 0 &&
|
154
|
-
(!input_lines.empty? || !current_line.empty?)
|
155
|
-
print WAITING
|
156
|
-
$stdout.flush
|
157
|
-
waiting_printed = 1 # Record one '?' printed
|
158
|
-
end
|
159
|
-
next
|
160
|
-
end
|
161
|
-
|
162
|
-
rescue Interrupt
|
163
|
-
puts "\nInput cancelled. Discarding current input; please start over."
|
164
|
-
input_lines = []
|
165
|
-
current_line = ""
|
166
|
-
waiting_printed = 0
|
167
|
-
last_key_time = Time.now
|
168
|
-
next
|
169
|
-
end
|
170
|
-
|
171
|
-
break if char.nil? # Handle EOF (Ctrl+D)
|
172
|
-
|
173
|
-
if char == "\r" || char == "\n"
|
174
|
-
if current_line.empty? && !input_lines.empty?
|
175
|
-
break # Two Enters in a row submits
|
176
|
-
else
|
177
|
-
input_lines << current_line
|
178
|
-
current_line = ""
|
179
|
-
waiting_printed = 0 # Reset waiting on new line
|
180
|
-
print "\n\r"
|
181
|
-
$stdout.flush
|
182
|
-
end
|
183
|
-
|
184
|
-
elsif char == "\x04" # Ctrl+D
|
185
|
-
break
|
186
|
-
|
187
|
-
elsif char == "\x08" || char == "\x7F" # Backspace or Delete
|
188
|
-
if !current_line.empty?
|
189
|
-
current_line.chop!
|
190
|
-
print WAITING_ERASE
|
191
|
-
$stdout.flush
|
192
|
-
elsif waiting_printed > 0
|
193
|
-
# Clear one waiting character if current_line is empty
|
194
|
-
print "\b \b"
|
195
|
-
$stdout.flush
|
196
|
-
waiting_printed -= 1
|
197
|
-
end
|
198
|
-
|
199
|
-
else
|
200
|
-
current_line << char
|
201
|
-
print char
|
202
|
-
$stdout.flush
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
ensure
|
207
|
-
STDIN.cooked! # Restore terminal to normal mode
|
208
|
-
end
|
209
|
-
|
210
|
-
input_lines << current_line unless current_line.empty?
|
211
|
-
|
212
|
-
# Handle single-line special case
|
213
|
-
if input_lines.size == 1
|
214
|
-
if special_first_line_processing(input_lines.first)
|
215
|
-
# If special (starts with "//"), return immediately as if double return was pressed
|
216
|
-
return input_lines.first
|
217
|
-
else
|
218
|
-
# If not special, keep as is and return the full input
|
219
|
-
return input_lines.join("\n")
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
input_lines.join("\n").tap do |result|
|
224
|
-
puts "\n" if result.empty? # Clean up display if no input
|
225
|
-
end
|
226
|
-
|
227
|
-
rescue EOFError
|
228
|
-
input_lines.join("\n")
|
229
|
-
end
|
230
|
-
|
231
|
-
|
File without changes
|