beniya 0.7.0 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5557faae4d28c2902ad33747c4c7ce60243c6a51e73fe2ade15a134f282eae9c
4
- data.tar.gz: c05318a586a1bd4993d54dcd3ef163b533417e2dc51cada66b1ffd260deff4b0
3
+ metadata.gz: 3b0ea5bde3e8a89c5d0cd771802f0dbe39bd7b56282a58c291ddf984474f722d
4
+ data.tar.gz: 2212bd6b8276cf569336aac01473b39cf38674998a554e732de2f13283e56f94
5
5
  SHA512:
6
- metadata.gz: c07a78671b8850ecae7a10cbdbc0f5232a022cc0a1fef419640558672dbc11cbec1d913271f156e24c0f9e95945ac45a5e6bc429f6879b67e1b613ec91e64a0b
7
- data.tar.gz: 5e91cccba562ae7b8f9fc2fccb124d7c0b461288816f34938ee0d7ab47f6720b0f8ace15844cabef825f1ae04a4ecd0ce0c7b7e845d13729b7a74bf2a5747661
6
+ metadata.gz: 06454beb835ed04922af61ad68ba3f400ff061db1c23566cbd4034e41d6e965d6d3e3e7532de0000fcfd1241c09ff277e014e4b01d1c3068287ac6845e0a7b4e
7
+ data.tar.gz: 484dd36cd019d4926827e6e929599db57cb5a1b10f720032736df7157ad1518bd44fd2db61c568c78c5e450aa36f89efa8717f572909f0661295bf81d27d76fb
@@ -0,0 +1,267 @@
1
+ # CHANGELOG - beniya v0.8.0
2
+
3
+ **Release Date**: 2024-12-06
4
+
5
+ ## 🚀 New Features
6
+
7
+ ### Command Mode UI Enhancements
8
+
9
+ - **Tab Completion for Commands**: Added intelligent tab completion in command mode
10
+ - Auto-completes available commands as you type
11
+ - Shows common prefix when multiple matches exist
12
+ - Complete match is filled automatically when only one option exists
13
+ - Activated by pressing `Tab` key during command input
14
+
15
+ - **Floating Window for Command Results**: Command execution results now display in an elegant floating window
16
+ - Reuses DialogRenderer from bookmark feature for consistent UI
17
+ - Color-coded results:
18
+ - **Green border**: Successful command execution
19
+ - **Red border**: Error or warning messages
20
+ - Dismissible with any key press
21
+ - Auto-sizes based on content length
22
+ - Centered on screen for optimal visibility
23
+
24
+ ### CommandModeUI Class
25
+
26
+ - **New UI Handler Class** (`lib/beniya/command_mode_ui.rb`): Dedicated class for command mode user interactions
27
+ - `autocomplete(input)`: Returns list of matching command suggestions
28
+ - `complete_command(input)`: Completes command based on current input
29
+ - `show_result(result)`: Displays command results in floating window
30
+ - `find_common_prefix(strings)`: Finds common prefix among multiple strings (private helper)
31
+
32
+ ## 🎨 UI/UX Improvements
33
+
34
+ ### Enhanced Command Mode Experience
35
+
36
+ - **Intuitive Tab Completion**:
37
+ - Type partial command name (e.g., `he`)
38
+ - Press `Tab` to see all matches or complete automatically
39
+ - Works with all registered plugin commands
40
+
41
+ - **Visual Feedback**:
42
+ - Immediate visual feedback with floating windows
43
+ - Clear distinction between success and error states
44
+ - Professional-looking centered dialogs
45
+
46
+ - **Consistent Design**:
47
+ - Matches bookmark feature's floating window style
48
+ - Maintains beniya's cohesive visual language
49
+ - Uses existing color schemes and borders
50
+
51
+ ## 🔧 Technical Improvements
52
+
53
+ ### Architecture
54
+
55
+ - **CommandModeUI Integration**:
56
+ - Integrated into `TerminalUI` class initialization
57
+ - Uses existing `DialogRenderer` for window management
58
+ - Modular design allows for easy future enhancements
59
+
60
+ - **Input Handling**:
61
+ - Added `Tab` key handler in `handle_command_input`
62
+ - Improved command execution flow with visual feedback
63
+ - Screen refresh after command execution for clean state
64
+
65
+ ### Code Organization
66
+
67
+ - **Clear Separation of Concerns**:
68
+ - `CommandMode`: Command execution logic
69
+ - `CommandModeUI`: User interface and interaction
70
+ - `DialogRenderer`: Reusable window rendering component
71
+
72
+ - **Dependency Injection**:
73
+ - CommandModeUI receives CommandMode and DialogRenderer via constructor
74
+ - Facilitates testing and maintainability
75
+
76
+ ## 🧪 Testing
77
+
78
+ ### Test-Driven Development
79
+
80
+ - **TDD Approach**: Features developed following strict TDD methodology
81
+ 1. Wrote comprehensive tests first
82
+ 2. Verified tests failed as expected
83
+ 3. Implemented features to pass tests
84
+ 4. Committed tests before implementation
85
+
86
+ ### New Tests Added
87
+
88
+ - **CommandModeUI Tests** (`test/test_command_mode_ui.rb`):
89
+ - **Tab Completion Tests**:
90
+ - `test_autocomplete_no_input`: All commands when no input
91
+ - `test_autocomplete_partial_match`: Partial matching
92
+ - `test_autocomplete_exact_prefix`: Prefix filtering
93
+ - `test_autocomplete_single_match`: Single match completion
94
+ - `test_autocomplete_no_match`: No matches handling
95
+ - `test_complete_command_single_match`: Single match auto-completion
96
+ - `test_complete_command_multiple_matches`: Common prefix completion
97
+ - `test_complete_command_no_match`: Preserves input when no match
98
+
99
+ - **Floating Window Tests**:
100
+ - `test_show_result_success`: Success message display
101
+ - `test_show_result_error`: Error message display with red color
102
+ - `test_show_result_multiline`: Multi-line result handling
103
+ - `test_show_result_nil`: Nil result handling (no display)
104
+ - `test_show_result_empty_string`: Empty string handling (no display)
105
+
106
+ - **Integration Tests**:
107
+ - `test_command_mode_ui_class_exists`: Class existence verification
108
+ - `test_command_mode_ui_initialization`: Proper initialization
109
+ - `test_prompt_command_with_autocomplete`: End-to-end autocomplete flow
110
+
111
+ ### Test Coverage
112
+
113
+ - **16 tests, 44 assertions**: Comprehensive coverage of all features
114
+ - **All tests passing**: 100% success rate
115
+ - **Mock-based testing**: Uses stubbing for UI components to avoid side effects
116
+
117
+ ## 🐛 Bug Fixes
118
+
119
+ ### Fixed Issues
120
+
121
+ - **Method Name Error**: Fixed incorrect method call `draw` → `draw_screen`
122
+ - Issue: `undefined local variable or method 'draw'` error in `execute_command`
123
+ - Fix: Changed to correct method name `draw_screen` for screen refresh
124
+ - Location: `lib/beniya/terminal_ui.rb:626`
125
+
126
+ ## 📦 Dependencies
127
+
128
+ ### No New Dependencies
129
+
130
+ - Uses existing Ruby standard library
131
+ - Leverages existing beniya components:
132
+ - `DialogRenderer`: For floating windows
133
+ - `CommandMode`: For command execution
134
+ - `TextUtils`: For text width calculations
135
+
136
+ ## 🔄 Compatibility
137
+
138
+ ### Backward Compatibility
139
+
140
+ - **No Breaking Changes**: All existing features work as before
141
+ - **Optional Enhancement**: New features enhance but don't replace existing functionality
142
+ - **Existing Keybindings Preserved**: `:` still activates command mode as before
143
+
144
+ ### Platform Support
145
+
146
+ - **macOS**: Full support ✅
147
+ - **Linux**: Full support ✅
148
+ - **Windows**: Full support ✅
149
+
150
+ ## ⚡ Performance
151
+
152
+ ### Optimizations
153
+
154
+ - **Minimal Overhead**: Tab completion uses simple prefix matching (O(n) complexity)
155
+ - **Efficient Rendering**: Reuses existing DialogRenderer without new allocation
156
+ - **No Performance Impact**: Features only active when command mode is engaged
157
+
158
+ ## 📝 Usage Examples
159
+
160
+ ### Using Tab Completion
161
+
162
+ ```bash
163
+ # Launch beniya
164
+ beniya
165
+
166
+ # Activate command mode
167
+ Press ':'
168
+
169
+ # Type partial command
170
+ :he
171
+
172
+ # Press Tab to see completions
173
+ Press 'Tab'
174
+ # Result: :he (if multiple matches like "hello", "help", "health")
175
+
176
+ # Type more specific prefix
177
+ :hel
178
+
179
+ # Press Tab again
180
+ Press 'Tab'
181
+ # Result: :hello or :help (completes to common prefix)
182
+ ```
183
+
184
+ ### Viewing Command Results
185
+
186
+ ```bash
187
+ # After activating command mode (:)
188
+ :hello
189
+
190
+ # Press Enter
191
+ # → Floating window appears with result:
192
+ # ┌────────────────────────────────┐
193
+ # │ コマンド実行結果 │
194
+ # ├────────────────────────────────┤
195
+ # │ │
196
+ # │ Hello from TestPlugin! │
197
+ # │ │
198
+ # │ Press any key to close │
199
+ # └────────────────────────────────┘
200
+
201
+ # Press any key to dismiss
202
+ ```
203
+
204
+ ### Error Handling
205
+
206
+ ```bash
207
+ # Try non-existent command
208
+ :nonexistent
209
+
210
+ # Press Enter
211
+ # → Red-bordered floating window appears:
212
+ # ┌────────────────────────────────┐
213
+ # │ コマンド実行結果 │ (Red)
214
+ # ├────────────────────────────────┤
215
+ # │ │
216
+ # │ ⚠️ コマンドが見つかりません │
217
+ # │ │
218
+ # │ Press any key to close │
219
+ # └────────────────────────────────┘
220
+ ```
221
+
222
+ ## 🔮 Future Plans
223
+
224
+ ### Planned Enhancements
225
+
226
+ - **Command History**: Navigate through previously executed commands with ↑/↓ arrows
227
+ - **Command Arguments**: Support for commands with parameters
228
+ - **Auto-complete Menu**: Visual menu showing all available completions
229
+ - **Command Aliases**: User-defined shortcuts for frequently used commands
230
+ - **Command Help**: Inline help text showing command descriptions during completion
231
+
232
+ ## 🙏 Acknowledgments
233
+
234
+ Main contributions in this version:
235
+
236
+ - **Test-Driven Development**: Strict TDD methodology ensuring code quality
237
+ - **Reusable Components**: Leveraged existing DialogRenderer for consistency
238
+ - **User Experience Focus**: Tab completion improves command discoverability
239
+ - **Visual Polish**: Floating windows provide professional command feedback
240
+
241
+ ## 📋 Detailed Changes
242
+
243
+ ### Files Modified
244
+
245
+ - `lib/beniya.rb`: Added `require_relative "beniya/command_mode_ui"`
246
+ - `lib/beniya/terminal_ui.rb`:
247
+ - Added `@dialog_renderer` and `@command_mode_ui` initialization
248
+ - Added Tab key handler for command completion
249
+ - Changed command result display to use floating windows
250
+ - Fixed `draw_screen` method call
251
+ - `test/test_command_mode_ui.rb`: Added comprehensive test suite (16 tests)
252
+
253
+ ### Files Created
254
+
255
+ - `lib/beniya/command_mode_ui.rb`: New CommandModeUI class (130 lines)
256
+
257
+ ### Lines of Code
258
+
259
+ - **Added**: ~260 lines (implementation + tests)
260
+ - **Modified**: ~15 lines
261
+ - **Removed**: ~3 lines
262
+
263
+ ---
264
+
265
+ **Note**: This version significantly improves the command mode user experience with modern UI features. The Tab completion and floating window display make command execution more intuitive and visually appealing.
266
+
267
+ **GitHub Issues**: [https://github.com/masisz/beniya/issues](https://github.com/masisz/beniya/issues)
@@ -0,0 +1,279 @@
1
+ # CHANGELOG - beniya v0.9.0
2
+
3
+ **Release Date**: 2024-12-13
4
+
5
+ ## 🚀 New Features
6
+
7
+ ### Command Mode Input Floating Window
8
+
9
+ - **Floating Window for Command Input**: Command mode input now displays in a modern floating window
10
+ - Moved from bottom line to centered floating window
11
+ - Consistent with other UI elements (bookmarks, results)
12
+ - Blue border for clear visual identification
13
+ - Always-visible keyboard shortcuts help text
14
+
15
+ - **Integrated Completion Suggestions**: Tab completion suggestions display directly in the input window
16
+ - Real-time suggestion list updates as you type
17
+ - Clear visual separation between input and suggestions
18
+ - No need to guess available commands
19
+
20
+ - **Enhanced Visual Feedback**:
21
+ - Input prompt with cursor indicator
22
+ - Automatic window sizing based on content
23
+ - Clean, uncluttered interface
24
+ - Professional appearance matching beniya's design language
25
+
26
+ ### CommandModeUI Enhancements
27
+
28
+ - **New Method** (`show_input_prompt`): Displays command input in floating window
29
+ - `show_input_prompt(input, suggestions)`: Shows input prompt with optional completion suggestions
30
+ - Automatic integration with TerminalUI
31
+ - Consistent color scheme (blue border, white content)
32
+
33
+ ## 🎨 UI/UX Improvements
34
+
35
+ ### Modern Command Input Experience
36
+
37
+ Before (v0.8.0):
38
+ ```
39
+ [File listing...]
40
+ [Footer...]
41
+ :hello█ ← Input at bottom of screen
42
+ ```
43
+
44
+ After (v0.9.0):
45
+ ```
46
+ [File listing centered behind floating window...]
47
+
48
+ ┌────────────────────────────────────┐
49
+ │ コマンドモード │ (Blue)
50
+ ├────────────────────────────────────┤
51
+ │ │
52
+ │ hello_ │
53
+ │ │
54
+ │ 補完候補: │
55
+ │ hello │
56
+ │ help │
57
+ │ health │
58
+ │ │
59
+ │ Tab: 補完 | Enter: 実行 | ESC: キャンセル │
60
+ └────────────────────────────────────┘
61
+ ```
62
+
63
+ ### Key Improvements
64
+
65
+ - **Centered Display**: Input window appears in screen center for better focus
66
+ - **Contextual Help**: Keyboard shortcuts always visible
67
+ - **Live Suggestions**: Completion suggestions update in real-time
68
+ - **Consistent Design**: Matches bookmark and result windows
69
+ - **No Screen Clutter**: Floating window doesn't interfere with file listing
70
+
71
+ ## 🔧 Technical Improvements
72
+
73
+ ### Architecture
74
+
75
+ - **Removed Legacy Methods**:
76
+ - Removed `draw_command_input`: Bottom-line input rendering (obsolete)
77
+ - Removed `draw_command_result`: Bottom-line result display (obsolete)
78
+ - Cleaner codebase with focused responsibilities
79
+
80
+ - **TextUtils Enhancement**:
81
+ - Added Unicode ranges for box drawing characters (\u2500-\u257F)
82
+ - Added Unicode ranges for block elements (\u2580-\u259F)
83
+ - Improved width calculation for special characters
84
+
85
+ ### Integration
86
+
87
+ - **Automatic Display**: Command mode floating window shows automatically when activated
88
+ - **Suggestion Integration**: Autocomplete suggestions fetched and displayed seamlessly
89
+ - **Screen Refresh**: Proper screen redraw after command execution
90
+
91
+ ## 🐛 Bug Fixes
92
+
93
+ ### Display Width Issues
94
+
95
+ - **Fixed Cursor Symbol Display**: Changed from █ (full-width block) to _ (half-width underscore)
96
+ - Resolved right border misalignment in command input window
97
+ - Full-width block characters (█) have ambiguous width in different terminals
98
+ - Underscore (_) ensures consistent width across all terminal emulators
99
+
100
+ - **Improved Character Width Detection**:
101
+ - Added support for box drawing characters in TextUtils
102
+ - Added support for block elements in TextUtils
103
+ - More accurate display width calculation
104
+
105
+ - **Removed Colon Prefix**: Removed redundant `:` from input display
106
+ - Window title already indicates "コマンドモード"
107
+ - Cleaner, less cluttered appearance
108
+
109
+ ## 🧪 Testing
110
+
111
+ ### Test-Driven Development
112
+
113
+ - **TDD Approach**: All features developed following strict TDD methodology
114
+ 1. Wrote comprehensive tests first (4 new tests)
115
+ 2. Verified tests failed as expected
116
+ 3. Implemented features to pass tests
117
+ 4. Committed tests before implementation
118
+
119
+ ### New Tests Added
120
+
121
+ - **Command Input Floating Window Tests** (`test/test_command_mode_ui.rb`):
122
+ - `test_show_input_prompt_basic`: Basic input prompt display
123
+ - `test_show_input_prompt_empty_input`: Empty input handling
124
+ - `test_show_input_prompt_with_suggestions`: Suggestions display
125
+ - `test_show_input_prompt_color`: Border color verification
126
+
127
+ ### Test Coverage
128
+
129
+ - **20 tests, 60 assertions**: Comprehensive coverage of CommandModeUI
130
+ - **261 total tests, 1137 assertions**: Full test suite
131
+ - **All tests passing**: 100% success rate
132
+
133
+ ## 📦 Dependencies
134
+
135
+ ### No New Dependencies
136
+
137
+ - Uses existing Ruby standard library
138
+ - Leverages existing beniya components:
139
+ - `DialogRenderer`: For floating window rendering
140
+ - `CommandMode`: For command execution
141
+ - `TextUtils`: For text width calculations
142
+
143
+ ## 🔄 Compatibility
144
+
145
+ ### Backward Compatibility
146
+
147
+ - **No Breaking Changes**: All existing features work as before
148
+ - **Enhanced UI**: Command mode now has better UX without changing functionality
149
+ - **Existing Keybindings Preserved**: `:` still activates command mode
150
+
151
+ ### Platform Support
152
+
153
+ - **macOS**: Full support ✅
154
+ - **Linux**: Full support ✅
155
+ - **Windows**: Full support ✅
156
+
157
+ ## ⚡ Performance
158
+
159
+ ### Optimizations
160
+
161
+ - **No Performance Impact**: Floating window rendering is fast and efficient
162
+ - **Cached Calculations**: Window dimensions calculated once per render
163
+ - **Minimal Overhead**: Features only active when command mode is engaged
164
+
165
+ ## 📝 Usage Examples
166
+
167
+ ### Using the New Command Input
168
+
169
+ ```bash
170
+ # Launch beniya
171
+ beniya
172
+
173
+ # Activate command mode
174
+ Press ':'
175
+
176
+ # Floating window appears in center:
177
+ ┌────────────────────────────────────┐
178
+ │ コマンドモード │
179
+ ├────────────────────────────────────┤
180
+ │ │
181
+ │ _ │
182
+ │ │
183
+ │ Tab: 補完 | Enter: 実行 | ESC: キャンセル │
184
+ └────────────────────────────────────┘
185
+
186
+ # Type partial command
187
+ Type "he"
188
+
189
+ # Window updates with suggestions:
190
+ ┌────────────────────────────────────┐
191
+ │ コマンドモード │
192
+ ├────────────────────────────────────┤
193
+ │ │
194
+ │ he_ │
195
+ │ │
196
+ │ 補完候補: │
197
+ │ hello │
198
+ │ help │
199
+ │ health │
200
+ │ │
201
+ │ Tab: 補完 | Enter: 実行 | ESC: キャンセル │
202
+ └────────────────────────────────────┘
203
+
204
+ # Press Tab to complete
205
+ # Press Enter to execute
206
+ # Press ESC to cancel
207
+ ```
208
+
209
+ ### Visual Improvements
210
+
211
+ **Before (v0.8.0)**: Input at bottom of screen, suggestions not visible
212
+ **After (v0.9.0)**: Input in centered floating window, suggestions always visible
213
+
214
+ ## 🔮 Future Plans
215
+
216
+ ### Planned Enhancements
217
+
218
+ - **Command History**: Navigate through previously executed commands with ↑/↓ arrows
219
+ - **Command Arguments**: Support for commands with parameters
220
+ - **Auto-complete Menu**: Visual menu showing all available completions
221
+ - **Command Aliases**: User-defined shortcuts for frequently used commands
222
+ - **Inline Help**: Show command descriptions during completion
223
+
224
+ ## 🙏 Acknowledgments
225
+
226
+ Main contributions in this version:
227
+
228
+ - **Test-Driven Development**: Strict TDD methodology ensuring code quality
229
+ - **Consistent UI/UX**: Unified floating window design across all features
230
+ - **User Experience Focus**: Improved command discoverability and feedback
231
+ - **Cross-platform Compatibility**: Cursor symbol fix for all terminal emulators
232
+
233
+ ## 📋 Detailed Changes
234
+
235
+ ### Files Modified
236
+
237
+ - `lib/beniya/command_mode_ui.rb`:
238
+ - Added `show_input_prompt` method
239
+ - Removed obsolete display code
240
+ - `lib/beniya/terminal_ui.rb`:
241
+ - Integrated floating window for command input
242
+ - Removed `draw_command_input` method
243
+ - Removed `draw_command_result` method
244
+ - `lib/beniya/text_utils.rb`:
245
+ - Enhanced character width detection
246
+ - Added box drawing and block element ranges
247
+ - `test/test_command_mode_ui.rb`:
248
+ - Added 4 new tests for input prompt display
249
+
250
+ ### Files Created
251
+
252
+ - None (all changes to existing files)
253
+
254
+ ### Lines of Code
255
+
256
+ - **Added**: ~50 lines (implementation)
257
+ - **Modified**: ~10 lines
258
+ - **Removed**: ~30 lines (obsolete methods)
259
+ - **Net Change**: ~30 lines added
260
+
261
+ ### Commit History
262
+
263
+ ```
264
+ 478971b fix: カーソル記号を█から_に変更して表示崩れを修正
265
+ d09831f fix: 罫線文字とブロック要素の表示幅を修正
266
+ 2ba2785 refactor: コマンドモード入力からコロンを削除
267
+ f89693a feat: コマンド入力をフローティングウィンドウに変更
268
+ 3ab01af test: コマンド入力フローティングウィンドウのテストを追加
269
+ ```
270
+
271
+ ## 🎯 Summary
272
+
273
+ Version 0.9.0 brings a significant UI/UX improvement to command mode by introducing a modern floating window interface for command input. This change provides better visual feedback, integrates completion suggestions directly into the input window, and maintains consistency with other beniya features. All changes were developed using TDD methodology and are fully tested with 100% test pass rate.
274
+
275
+ ---
276
+
277
+ **Note**: This version focuses on UI/UX polish and consistency. The command mode functionality remains the same, but the user experience is significantly enhanced with the new floating window interface.
278
+
279
+ **GitHub Issues**: [https://github.com/masisz/beniya/issues](https://github.com/masisz/beniya/issues)
data/README.md CHANGED
@@ -13,6 +13,7 @@ beniyaは、Yaziにインスパイアされたターミナル上で動作する
13
13
  - **軽量でシンプル**: Rubyで書かれた軽量なファイルマネージャー
14
14
  - **直感的な操作**: Vimライクなキーバインド
15
15
  - **プラグインシステム**: 拡張可能なプラグインアーキテクチャ
16
+ - **コマンドモード**: Tab補完とフローティングウィンドウを備えた強力なコマンドシステム
16
17
  - **ファイルプレビュー**: テキストファイルの内容をその場で確認
17
18
  - **ファイル選択・操作**: 複数ファイルの選択、移動、コピー、削除が可能
18
19
  - **ベースディレクトリ操作**: 起動ディレクトリへの一括ファイル移動・コピー
@@ -118,6 +119,15 @@ beniya --help # ヘルプメッセージを表示
118
119
  | ---- | ---------------------------------- |
119
120
  | `z` | zoxide履歴からディレクトリを選択移動 |
120
121
 
122
+ #### コマンドモード
123
+
124
+ | キー | 機能 |
125
+ | ------ | ---------------------------------------- |
126
+ | `:` | コマンドモードを起動 |
127
+ | `Tab` | コマンド補完(コマンドモード中) |
128
+ | `Enter`| コマンドを実行(コマンドモード中) |
129
+ | `ESC` | コマンドモードをキャンセル(コマンドモード中) |
130
+
121
131
  #### システム操作
122
132
 
123
133
  | キー | 機能 |
@@ -272,6 +282,46 @@ apt install zoxide
272
282
  - zoxideが無効な場合は適切なメッセージが表示されます
273
283
  - 履歴が空の場合も適切にハンドリングされます
274
284
 
285
+ ### コマンドモードの詳細
286
+
287
+ #### コマンドモードの起動 (`:`)
288
+
289
+ - `:`キーを押してコマンドモードを起動
290
+ - 画面最下部にコマンド入力欄が表示される
291
+ - プラグインが提供するコマンドを実行できる
292
+
293
+ #### Tab補完機能
294
+
295
+ - **インテリジェントな補完**: コマンド名の一部を入力して`Tab`キーを押すと自動補完
296
+ - **複数候補の処理**: 複数のコマンドが一致する場合は共通プレフィックスまで補完
297
+ - **単一候補の自動完成**: 一つだけマッチする場合は完全に補完される
298
+ - **リアルタイム更新**: 入力内容に応じて候補が動的に変化
299
+
300
+ #### フローティングウィンドウでの結果表示
301
+
302
+ - **視覚的フィードバック**: コマンド実行結果をモダンなフローティングウィンドウで表示
303
+ - **色分けされた結果**:
304
+ - **緑色のボーダー**: コマンドが正常に実行された場合
305
+ - **赤色のボーダー**: エラーまたは警告が発生した場合
306
+ - **中央配置**: 画面中央に自動的に配置され視認性が高い
307
+ - **自動サイズ調整**: 結果の内容に応じてウィンドウサイズが自動調整
308
+ - **簡単に閉じる**: 任意のキーを押すとウィンドウを閉じて通常操作に戻る
309
+
310
+ #### 使用例
311
+
312
+ ```
313
+ 1. : → コマンドモードを起動
314
+ 2. "he" → コマンド名の一部を入力
315
+ 3. Tab → 補完("hello", "help", "health"などが候補)
316
+ 4. Enter → コマンドを実行
317
+ 5. フローティングウィンドウで結果を確認
318
+ 6. 任意のキーを押してウィンドウを閉じる
319
+ ```
320
+
321
+ #### 利用可能なコマンド
322
+
323
+ コマンドはプラグインによって提供されます。プラグインシステムの詳細については後述の「プラグインシステム」セクションを参照してください。
324
+
275
325
  ### 必要な外部ツール
276
326
 
277
327
  検索機能・履歴機能を使用するには、以下のツールが必要です:
@@ -396,13 +446,21 @@ module Beniya
396
446
  private
397
447
 
398
448
  def say_hello
399
- puts "Hello from beniya!"
449
+ "Hello from beniya!"
400
450
  end
401
451
  end
402
452
  end
403
453
  end
404
454
  ```
405
455
 
456
+ **プラグインの使い方:**
457
+
458
+ 1. beniyaを起動
459
+ 2. `:`キーでコマンドモードを起動
460
+ 3. `hello`と入力(または`he`と入力してTabキーで補完)
461
+ 4. Enterキーで実行
462
+ 5. フローティングウィンドウに"Hello from beniya!"が表示される
463
+
406
464
  #### 外部gemに依存するプラグイン例
407
465
 
408
466
  ```ruby
@@ -435,14 +493,28 @@ module Beniya
435
493
 
436
494
  private
437
495
 
438
- def ask_ai(question)
439
- # AI処理
496
+ def ask_ai
497
+ response = @client.messages.create(
498
+ model: "claude-3-5-sonnet-20241022",
499
+ max_tokens: 1024,
500
+ messages: [{role: "user", content: "Hello, Claude!"}]
501
+ )
502
+ response.content.first.text
440
503
  end
441
504
  end
442
505
  end
443
506
  end
444
507
  ```
445
508
 
509
+ **プラグインの使い方:**
510
+
511
+ 1. 依存gemをインストール: `gem install anthropic`
512
+ 2. 環境変数を設定: `export ANTHROPIC_API_KEY=your_api_key`
513
+ 3. beniyaを起動
514
+ 4. `:`キーでコマンドモードを起動
515
+ 5. `ai`と入力してEnterキーで実行
516
+ 6. フローティングウィンドウにClaude APIからの応答が表示される
517
+
446
518
  ### プラグインの管理
447
519
 
448
520
  #### プラグインの有効/無効設定
data/bin/beniya CHANGED
@@ -3,6 +3,9 @@
3
3
 
4
4
  require_relative '../lib/beniya'
5
5
 
6
+ # プラグインを読み込む
7
+ Beniya::PluginManager.load_all
8
+
6
9
  # コマンドライン引数の処理
7
10
  if ARGV.include?('--check-health') || ARGV.include?('-c')
8
11
  # ヘルスチェック実行