beniya 0.6.3 → 0.7.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/CHANGELOG.md +24 -0
- data/CHANGELOG_v0.7.0.md +280 -0
- data/README.md +162 -0
- data/README_EN.md +162 -0
- data/lib/beniya/plugin.rb +89 -0
- data/lib/beniya/plugin_config.rb +59 -0
- data/lib/beniya/plugin_manager.rb +84 -0
- data/lib/beniya/plugins/file_operations.rb +44 -0
- data/lib/beniya/text_utils.rb +27 -11
- data/lib/beniya/version.rb +1 -1
- data/lib/beniya.rb +5 -0
- metadata +7 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5557faae4d28c2902ad33747c4c7ce60243c6a51e73fe2ade15a134f282eae9c
|
|
4
|
+
data.tar.gz: c05318a586a1bd4993d54dcd3ef163b533417e2dc51cada66b1ffd260deff4b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c07a78671b8850ecae7a10cbdbc0f5232a022cc0a1fef419640558672dbc11cbec1d913271f156e24c0f9e95945ac45a5e6bc429f6879b67e1b613ec91e64a0b
|
|
7
|
+
data.tar.gz: 5e91cccba562ae7b8f9fc2fccb124d7c0b461288816f34938ee0d7ab47f6720b0f8ace15844cabef825f1ae04a4ecd0ce0c7b7e845d13729b7a74bf2a5747661
|
data/CHANGELOG.md
CHANGED
|
@@ -20,6 +20,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
20
20
|
- Comprehensive test suite for escape key functionality
|
|
21
21
|
- Support for multi-byte characters (Japanese, etc.) in filename/directory input
|
|
22
22
|
|
|
23
|
+
## [0.7.0] - 2024-11-29
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **🔌 Plugin System**: Complete extensible plugin architecture for beniya
|
|
27
|
+
- **Plugin Base Class**: Simple API for creating plugins with automatic registration
|
|
28
|
+
- **Plugin Manager**: Automatic plugin discovery and loading from built-in and user directories
|
|
29
|
+
- **Plugin Configuration**: Enable/disable plugins via `~/.beniya/config.yml`
|
|
30
|
+
- **Dependency Management**: Plugins can declare gem dependencies with automatic checking
|
|
31
|
+
- **Built-in Plugins**: FileOperations plugin for basic file operations
|
|
32
|
+
- **Error Handling**: Graceful degradation when plugin dependencies are missing
|
|
33
|
+
- **Plugin Distribution**: Support for GitHub Gist and repository-based plugin sharing
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- **Documentation Updates**: Comprehensive plugin system documentation in README.md and README_EN.md
|
|
37
|
+
- **Test Suite**: Complete TDD implementation with full test coverage for plugin system
|
|
38
|
+
|
|
39
|
+
### Technical Details
|
|
40
|
+
- New `Plugin` base class with auto-registration mechanism
|
|
41
|
+
- New `PluginManager` for plugin lifecycle management
|
|
42
|
+
- New `PluginConfig` for configuration file handling
|
|
43
|
+
- Plugin directory structure: `lib/beniya/plugins/` and `~/.beniya/plugins/`
|
|
44
|
+
- Case-insensitive plugin name matching in configuration
|
|
45
|
+
- **Detailed changelog**: [CHANGELOG_v0.7.0.md](./CHANGELOG_v0.7.0.md)
|
|
46
|
+
|
|
23
47
|
## [0.6.0] - 2025-01-XX
|
|
24
48
|
|
|
25
49
|
### Added
|
data/CHANGELOG_v0.7.0.md
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# CHANGELOG - beniya v0.7.0
|
|
2
|
+
|
|
3
|
+
**Release Date**: 2024-11-29
|
|
4
|
+
|
|
5
|
+
## 🚀 New Features
|
|
6
|
+
|
|
7
|
+
### Plugin System
|
|
8
|
+
|
|
9
|
+
- **Extensible Plugin Architecture**: beniya now supports a plugin system that allows users to add custom functionality
|
|
10
|
+
- **Two Plugin Locations**:
|
|
11
|
+
- **Built-in Plugins** (`lib/beniya/plugins/*.rb`): Core plugins bundled with beniya
|
|
12
|
+
- **User Plugins** (`~/.beniya/plugins/*.rb`): User-created plugins for custom extensions
|
|
13
|
+
- **Automatic Plugin Registration**: Plugins are automatically registered when inheriting from the `Plugin` base class
|
|
14
|
+
- **Dependency Management**: Plugins can declare gem dependencies using `requires` method
|
|
15
|
+
- **Plugin Configuration**: Enable/disable plugins via `~/.beniya/config.yml`
|
|
16
|
+
- **Graceful Error Handling**: Missing dependencies show warnings but don't prevent beniya from starting
|
|
17
|
+
|
|
18
|
+
### Plugin Base Class
|
|
19
|
+
|
|
20
|
+
- **Simple Plugin Creation**: Easy-to-use base class for creating plugins
|
|
21
|
+
- **Required Methods**:
|
|
22
|
+
- `name`: Plugin name (required)
|
|
23
|
+
- `description`: Plugin description (optional, default: "")
|
|
24
|
+
- `version`: Plugin version (optional, default: "1.0.0")
|
|
25
|
+
- `commands`: Command definitions (optional, default: {})
|
|
26
|
+
- **Dependency Declaration**: Use `requires 'gem_name'` to declare gem dependencies
|
|
27
|
+
- **Automatic Dependency Checking**: Dependencies are checked on plugin initialization
|
|
28
|
+
- **DependencyError**: Custom error class for missing dependencies
|
|
29
|
+
|
|
30
|
+
### Plugin Manager
|
|
31
|
+
|
|
32
|
+
- **Plugin Discovery**: Automatically loads plugins from built-in and user directories
|
|
33
|
+
- **Plugin Lifecycle Management**: Handles plugin loading, initialization, and error recovery
|
|
34
|
+
- **Configuration Integration**: Respects plugin enable/disable settings from config file
|
|
35
|
+
- **Error Isolation**: Plugin errors don't crash the application
|
|
36
|
+
|
|
37
|
+
### Plugin Configuration
|
|
38
|
+
|
|
39
|
+
- **YAML Configuration**: Configure plugins via `~/.beniya/config.yml`
|
|
40
|
+
- **Enable/Disable Control**: Fine-grained control over which plugins are active
|
|
41
|
+
- **Case-Insensitive Names**: Plugin names are matched case-insensitively
|
|
42
|
+
- **Default Behavior**: All plugins enabled by default if not specified in config
|
|
43
|
+
|
|
44
|
+
### Built-in Plugins
|
|
45
|
+
|
|
46
|
+
- **FileOperations Plugin**: Basic file operations (copy, move, delete)
|
|
47
|
+
- No external dependencies
|
|
48
|
+
- Stub implementation ready for future enhancements
|
|
49
|
+
|
|
50
|
+
## 🎨 UI/UX Improvements
|
|
51
|
+
|
|
52
|
+
### Documentation
|
|
53
|
+
|
|
54
|
+
- **Plugin System Documentation**: Comprehensive documentation added to README.md and README_EN.md
|
|
55
|
+
- Plugin creation guides with examples
|
|
56
|
+
- Simple plugin example (Hello plugin)
|
|
57
|
+
- Plugin with external dependencies example (AI Helper)
|
|
58
|
+
- Plugin distribution methods (GitHub Gist, GitHub Repository)
|
|
59
|
+
- Plugin management instructions
|
|
60
|
+
- Plugin key features explanation
|
|
61
|
+
|
|
62
|
+
## 📖 Documentation Updates
|
|
63
|
+
|
|
64
|
+
### README Updates
|
|
65
|
+
|
|
66
|
+
**Japanese Version (README.md)**:
|
|
67
|
+
|
|
68
|
+
- Added "Plugin System" to Features section
|
|
69
|
+
- New comprehensive "Plugin System" section including:
|
|
70
|
+
- Plugin location explanation
|
|
71
|
+
- Plugin creation methods with code examples
|
|
72
|
+
- Plugin management (enable/disable via config.yml)
|
|
73
|
+
- Plugin distribution methods
|
|
74
|
+
- Plugin key features
|
|
75
|
+
|
|
76
|
+
**English Version (README_EN.md)**:
|
|
77
|
+
|
|
78
|
+
- Added "Plugin System" to Features section
|
|
79
|
+
- New comprehensive "Plugin System" section with:
|
|
80
|
+
- Plugin locations
|
|
81
|
+
- Creating plugins guide
|
|
82
|
+
- Simple and advanced plugin examples
|
|
83
|
+
- Plugin management instructions
|
|
84
|
+
- Distribution methods
|
|
85
|
+
- Key features documentation
|
|
86
|
+
|
|
87
|
+
## 🔧 Technical Improvements
|
|
88
|
+
|
|
89
|
+
### Architecture
|
|
90
|
+
|
|
91
|
+
- **Plugin Module**: New `Beniya::Plugins` module for organizing plugins
|
|
92
|
+
- **Plugin Base Class** (`lib/beniya/plugin.rb`):
|
|
93
|
+
- `Plugin.inherited`: Auto-registration mechanism
|
|
94
|
+
- `Plugin.requires`: Dependency declaration
|
|
95
|
+
- `Plugin.required_gems`: Dependency listing
|
|
96
|
+
- `check_dependencies!`: Automatic dependency verification
|
|
97
|
+
- `DependencyError`: Custom exception for missing dependencies
|
|
98
|
+
|
|
99
|
+
- **PluginManager Class** (`lib/beniya/plugin_manager.rb`):
|
|
100
|
+
- `PluginManager.plugins`: Registry of all plugin classes
|
|
101
|
+
- `PluginManager.register`: Plugin registration
|
|
102
|
+
- `PluginManager.load_all`: Load all plugins from both locations
|
|
103
|
+
- `PluginManager.enabled_plugins`: Get list of active plugin instances
|
|
104
|
+
- `load_builtin_plugins`: Load from `lib/beniya/plugins/`
|
|
105
|
+
- `load_user_plugins`: Load from `~/.beniya/plugins/`
|
|
106
|
+
|
|
107
|
+
- **PluginConfig Class** (`lib/beniya/plugin_config.rb`):
|
|
108
|
+
- `PluginConfig.load`: Load configuration from `~/.beniya/config.yml`
|
|
109
|
+
- `PluginConfig.plugin_enabled?`: Check if plugin is enabled
|
|
110
|
+
- Case-insensitive plugin name matching
|
|
111
|
+
- Graceful handling of missing config files
|
|
112
|
+
|
|
113
|
+
### Integration
|
|
114
|
+
|
|
115
|
+
- **Main Library Integration**: Plugin system integrated into `lib/beniya.rb`
|
|
116
|
+
- **Automatic Loading**: Plugins loaded at beniya startup
|
|
117
|
+
- **Error Recovery**: Plugin failures don't prevent application startup
|
|
118
|
+
|
|
119
|
+
## 🧪 Testing
|
|
120
|
+
|
|
121
|
+
### Test-Driven Development
|
|
122
|
+
|
|
123
|
+
- **TDD Approach**: All plugin system features developed using TDD methodology
|
|
124
|
+
- **Comprehensive Test Coverage**: Full test suite for plugin system
|
|
125
|
+
|
|
126
|
+
### New Tests Added
|
|
127
|
+
|
|
128
|
+
- **Plugin Base Class Tests** (`test/test_plugin.rb`):
|
|
129
|
+
- Plugin registration tests
|
|
130
|
+
- Dependency declaration tests
|
|
131
|
+
- Dependency checking tests
|
|
132
|
+
- Method override tests
|
|
133
|
+
- DependencyError tests
|
|
134
|
+
|
|
135
|
+
- **PluginManager Tests** (`test/test_plugin_manager.rb`):
|
|
136
|
+
- Plugin registration tests
|
|
137
|
+
- Built-in plugin loading tests
|
|
138
|
+
- User plugin loading tests
|
|
139
|
+
- Enabled plugins filtering tests
|
|
140
|
+
- Error handling tests
|
|
141
|
+
- Missing dependency handling tests
|
|
142
|
+
|
|
143
|
+
- **PluginConfig Tests** (`test/test_plugin_config.rb`):
|
|
144
|
+
- Configuration file loading tests
|
|
145
|
+
- Plugin enable/disable tests
|
|
146
|
+
- Case-insensitive name matching tests
|
|
147
|
+
- Default behavior tests
|
|
148
|
+
- Malformed YAML handling tests
|
|
149
|
+
|
|
150
|
+
- **FileOperations Plugin Tests** (`test/test_plugins_file_operations.rb`):
|
|
151
|
+
- Plugin existence tests
|
|
152
|
+
- Command registration tests
|
|
153
|
+
- Dependency verification tests
|
|
154
|
+
|
|
155
|
+
## 📦 Dependencies
|
|
156
|
+
|
|
157
|
+
### No New Required Dependencies
|
|
158
|
+
|
|
159
|
+
- Plugin system uses only Ruby standard library
|
|
160
|
+
- External gem dependencies are optional and plugin-specific
|
|
161
|
+
|
|
162
|
+
### Dependency Management
|
|
163
|
+
|
|
164
|
+
- **Gem::Specification**: Used for dependency checking (Ruby standard library)
|
|
165
|
+
- **YAML**: Used for configuration file parsing (Ruby standard library)
|
|
166
|
+
|
|
167
|
+
## 🔄 Compatibility
|
|
168
|
+
|
|
169
|
+
### Backward Compatibility
|
|
170
|
+
|
|
171
|
+
- **No Breaking Changes**: All existing beniya features work as before
|
|
172
|
+
- **Optional Feature**: Plugin system is completely optional
|
|
173
|
+
- **Configuration File Compatibility**: Existing config files remain valid
|
|
174
|
+
- **No Impact on Core Functionality**: Plugins don't affect core file manager operations
|
|
175
|
+
|
|
176
|
+
### Platform Support
|
|
177
|
+
|
|
178
|
+
- **macOS**: Full support
|
|
179
|
+
- **Linux**: Full support
|
|
180
|
+
- **Windows**: Full support
|
|
181
|
+
|
|
182
|
+
## ⚡ Performance
|
|
183
|
+
|
|
184
|
+
### Optimizations
|
|
185
|
+
|
|
186
|
+
- **Lazy Loading**: Plugins loaded only when needed
|
|
187
|
+
- **Error Isolation**: Plugin errors don't impact core performance
|
|
188
|
+
- **Minimal Overhead**: Plugin system adds negligible startup time
|
|
189
|
+
|
|
190
|
+
## 🐛 Bug Fixes
|
|
191
|
+
|
|
192
|
+
### Fixed Issues
|
|
193
|
+
|
|
194
|
+
- **Test Compatibility**: Fixed test suite for Ruby 3.4+ compatibility
|
|
195
|
+
- Replaced `assert_nothing_raised` with direct assertions
|
|
196
|
+
- Fixed module constant cleanup in tests
|
|
197
|
+
- Improved test isolation
|
|
198
|
+
|
|
199
|
+
## 🔮 Future Plans
|
|
200
|
+
|
|
201
|
+
### Planned for Next Version
|
|
202
|
+
|
|
203
|
+
- **Plugin API Extensions**: Additional hooks and events for plugins
|
|
204
|
+
- **Plugin Repository**: Central repository for sharing beniya plugins
|
|
205
|
+
- **Plugin CLI Commands**: Built-in commands for managing plugins
|
|
206
|
+
- **Plugin Dependencies**: Support for inter-plugin dependencies
|
|
207
|
+
- **Plugin Templates**: Scaffolding tools for creating new plugins
|
|
208
|
+
|
|
209
|
+
## 📝 Usage Examples
|
|
210
|
+
|
|
211
|
+
### Creating a Simple Plugin
|
|
212
|
+
|
|
213
|
+
```ruby
|
|
214
|
+
# ~/.beniya/plugins/hello.rb
|
|
215
|
+
module Beniya
|
|
216
|
+
module Plugins
|
|
217
|
+
class Hello < Plugin
|
|
218
|
+
def name
|
|
219
|
+
'Hello'
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def description
|
|
223
|
+
'Simple greeting plugin'
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def commands
|
|
227
|
+
{
|
|
228
|
+
hello: method(:say_hello)
|
|
229
|
+
}
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
private
|
|
233
|
+
|
|
234
|
+
def say_hello
|
|
235
|
+
puts "Hello from beniya!"
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Installing a Plugin
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Create plugins directory
|
|
246
|
+
mkdir -p ~/.beniya/plugins
|
|
247
|
+
|
|
248
|
+
# Download plugin from GitHub Gist
|
|
249
|
+
curl -o ~/.beniya/plugins/my_plugin.rb [RAW_URL]
|
|
250
|
+
|
|
251
|
+
# Launch beniya (plugin will be loaded automatically)
|
|
252
|
+
beniya
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Configuring Plugins
|
|
256
|
+
|
|
257
|
+
```yaml
|
|
258
|
+
# ~/.beniya/config.yml
|
|
259
|
+
plugins:
|
|
260
|
+
fileoperations:
|
|
261
|
+
enabled: true
|
|
262
|
+
hello:
|
|
263
|
+
enabled: true
|
|
264
|
+
my_custom_plugin:
|
|
265
|
+
enabled: false
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## 🙏 Acknowledgments
|
|
269
|
+
|
|
270
|
+
Main contributions in this version:
|
|
271
|
+
|
|
272
|
+
- **Test-Driven Development**: Complete TDD approach for plugin system
|
|
273
|
+
- **Ruby Standard Library**: Extensive use of built-in modules for reliability
|
|
274
|
+
- **Community Feedback**: Design inspired by popular plugin systems
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
**Note**: This version introduces the foundational plugin system for beniya. The plugin API is stable but may be extended in future versions based on community feedback.
|
|
279
|
+
|
|
280
|
+
**GitHub Issues**: [https://github.com/masisz/beniya/issues](https://github.com/masisz/beniya/issues)
|
data/README.md
CHANGED
|
@@ -12,6 +12,7 @@ beniyaは、Yaziにインスパイアされたターミナル上で動作する
|
|
|
12
12
|
|
|
13
13
|
- **軽量でシンプル**: Rubyで書かれた軽量なファイルマネージャー
|
|
14
14
|
- **直感的な操作**: Vimライクなキーバインド
|
|
15
|
+
- **プラグインシステム**: 拡張可能なプラグインアーキテクチャ
|
|
15
16
|
- **ファイルプレビュー**: テキストファイルの内容をその場で確認
|
|
16
17
|
- **ファイル選択・操作**: 複数ファイルの選択、移動、コピー、削除が可能
|
|
17
18
|
- **ベースディレクトリ操作**: 起動ディレクトリへの一括ファイル移動・コピー
|
|
@@ -351,6 +352,167 @@ COLORS = {
|
|
|
351
352
|
- `selected`: 選択中の項目の色
|
|
352
353
|
- `preview`: プレビューパネルの色
|
|
353
354
|
|
|
355
|
+
## プラグインシステム
|
|
356
|
+
|
|
357
|
+
beniyaは拡張可能なプラグインシステムを備えており、独自の機能を簡単に追加できます。
|
|
358
|
+
|
|
359
|
+
### プラグインの配置場所
|
|
360
|
+
|
|
361
|
+
#### 1. 本体同梱プラグイン
|
|
362
|
+
```
|
|
363
|
+
lib/beniya/plugins/*.rb
|
|
364
|
+
```
|
|
365
|
+
beniyaに標準で含まれるプラグイン。外部gem依存なしの基本機能を提供。
|
|
366
|
+
|
|
367
|
+
#### 2. ユーザープラグイン
|
|
368
|
+
```
|
|
369
|
+
~/.beniya/plugins/*.rb
|
|
370
|
+
```
|
|
371
|
+
ユーザーが自由に追加できるプラグイン。GitHub GistやrawURLから取得可能。
|
|
372
|
+
|
|
373
|
+
### プラグインの作成方法
|
|
374
|
+
|
|
375
|
+
#### シンプルなプラグイン例
|
|
376
|
+
|
|
377
|
+
```ruby
|
|
378
|
+
# ~/.beniya/plugins/hello.rb
|
|
379
|
+
module Beniya
|
|
380
|
+
module Plugins
|
|
381
|
+
class Hello < Plugin
|
|
382
|
+
def name
|
|
383
|
+
'Hello'
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
def description
|
|
387
|
+
'シンプルな挨拶プラグイン'
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
def commands
|
|
391
|
+
{
|
|
392
|
+
hello: method(:say_hello)
|
|
393
|
+
}
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
private
|
|
397
|
+
|
|
398
|
+
def say_hello
|
|
399
|
+
puts "Hello from beniya!"
|
|
400
|
+
end
|
|
401
|
+
end
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
#### 外部gemに依存するプラグイン例
|
|
407
|
+
|
|
408
|
+
```ruby
|
|
409
|
+
# ~/.beniya/plugins/ai_helper.rb
|
|
410
|
+
module Beniya
|
|
411
|
+
module Plugins
|
|
412
|
+
class AiHelper < Plugin
|
|
413
|
+
requires 'anthropic' # 依存gem宣言
|
|
414
|
+
|
|
415
|
+
def name
|
|
416
|
+
'AiHelper'
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
def description
|
|
420
|
+
'Claude APIを使ったAIアシスタント'
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
def commands
|
|
424
|
+
{
|
|
425
|
+
ai: method(:ask_ai)
|
|
426
|
+
}
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
def initialize
|
|
430
|
+
super # 依存チェック実行
|
|
431
|
+
@client = Anthropic::Client.new(
|
|
432
|
+
api_key: ENV['ANTHROPIC_API_KEY']
|
|
433
|
+
)
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
private
|
|
437
|
+
|
|
438
|
+
def ask_ai(question)
|
|
439
|
+
# AI処理
|
|
440
|
+
end
|
|
441
|
+
end
|
|
442
|
+
end
|
|
443
|
+
end
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### プラグインの管理
|
|
447
|
+
|
|
448
|
+
#### プラグインの有効/無効設定
|
|
449
|
+
|
|
450
|
+
`~/.beniya/config.yml`でプラグインの有効/無効を制御できます:
|
|
451
|
+
|
|
452
|
+
```yaml
|
|
453
|
+
plugins:
|
|
454
|
+
fileoperations:
|
|
455
|
+
enabled: true
|
|
456
|
+
ai_helper:
|
|
457
|
+
enabled: true
|
|
458
|
+
my_custom:
|
|
459
|
+
enabled: false
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
#### デフォルト動作
|
|
463
|
+
|
|
464
|
+
- `config.yml`が存在しない → 全プラグイン有効
|
|
465
|
+
- プラグインの設定がない → 有効とみなす
|
|
466
|
+
- `enabled: false`が明示的に設定されている → 無効
|
|
467
|
+
|
|
468
|
+
### プラグインの配布方法
|
|
469
|
+
|
|
470
|
+
#### GitHub Gistで共有
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
# プラグイン作者
|
|
474
|
+
1. GitHub Gistに.rbファイルをアップロード
|
|
475
|
+
2. Raw URLをユーザーに共有
|
|
476
|
+
|
|
477
|
+
# ユーザー
|
|
478
|
+
$ mkdir -p ~/.beniya/plugins
|
|
479
|
+
$ curl -o ~/.beniya/plugins/my_plugin.rb [RAW_URL]
|
|
480
|
+
$ beniya
|
|
481
|
+
✓ my_plugin 読み込み完了
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
#### GitHubリポジトリで共有
|
|
485
|
+
|
|
486
|
+
```bash
|
|
487
|
+
# プラグイン作者
|
|
488
|
+
beniya-plugins/
|
|
489
|
+
├── plugin1.rb
|
|
490
|
+
└── plugin2.rb
|
|
491
|
+
|
|
492
|
+
# ユーザー
|
|
493
|
+
$ curl -o ~/.beniya/plugins/plugin1.rb https://raw.githubusercontent.com/user/beniya-plugins/main/plugin1.rb
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### プラグインの主要機能
|
|
497
|
+
|
|
498
|
+
#### 必須メソッド
|
|
499
|
+
|
|
500
|
+
- `name`: プラグイン名(必須)
|
|
501
|
+
- `description`: プラグインの説明(オプション、デフォルト: "")
|
|
502
|
+
- `version`: プラグインのバージョン(オプション、デフォルト: "1.0.0")
|
|
503
|
+
- `commands`: コマンド定義(オプション、デフォルト: {})
|
|
504
|
+
|
|
505
|
+
#### 依存gem管理
|
|
506
|
+
|
|
507
|
+
- `requires 'gem_name'`: 依存gemを宣言
|
|
508
|
+
- 依存gemが不足している場合、警告を表示してプラグインを無効化
|
|
509
|
+
- beniya本体は正常に起動継続
|
|
510
|
+
|
|
511
|
+
#### 自動登録機能
|
|
512
|
+
|
|
513
|
+
- `Plugin`クラスを継承すると自動的に`PluginManager`に登録
|
|
514
|
+
- 複雑な登録処理は不要
|
|
515
|
+
|
|
354
516
|
## 開発
|
|
355
517
|
|
|
356
518
|
### 必要な環境
|
data/README_EN.md
CHANGED
|
@@ -12,6 +12,7 @@ beniya is a terminal-based file manager inspired by Yazi. It's implemented in Ru
|
|
|
12
12
|
|
|
13
13
|
- **Lightweight & Simple**: A lightweight file manager written in Ruby
|
|
14
14
|
- **Intuitive Operation**: Vim-like key bindings
|
|
15
|
+
- **Plugin System**: Extensible plugin architecture
|
|
15
16
|
- **File Preview**: View text file contents on the fly
|
|
16
17
|
- **File Selection & Operations**: Select multiple files, move, copy, and delete
|
|
17
18
|
- **Base Directory Operations**: Batch file operations to startup directory
|
|
@@ -352,6 +353,167 @@ COLORS = {
|
|
|
352
353
|
- `selected`: Selected item color
|
|
353
354
|
- `preview`: Preview panel color
|
|
354
355
|
|
|
356
|
+
## Plugin System
|
|
357
|
+
|
|
358
|
+
beniya features an extensible plugin system that allows you to easily add custom functionality.
|
|
359
|
+
|
|
360
|
+
### Plugin Locations
|
|
361
|
+
|
|
362
|
+
#### 1. Built-in Plugins
|
|
363
|
+
```
|
|
364
|
+
lib/beniya/plugins/*.rb
|
|
365
|
+
```
|
|
366
|
+
Plugins included with beniya by default. Provides basic functionality without external gem dependencies.
|
|
367
|
+
|
|
368
|
+
#### 2. User Plugins
|
|
369
|
+
```
|
|
370
|
+
~/.beniya/plugins/*.rb
|
|
371
|
+
```
|
|
372
|
+
Plugins you can freely add. Can be obtained from GitHub Gist or raw URLs.
|
|
373
|
+
|
|
374
|
+
### Creating Plugins
|
|
375
|
+
|
|
376
|
+
#### Simple Plugin Example
|
|
377
|
+
|
|
378
|
+
```ruby
|
|
379
|
+
# ~/.beniya/plugins/hello.rb
|
|
380
|
+
module Beniya
|
|
381
|
+
module Plugins
|
|
382
|
+
class Hello < Plugin
|
|
383
|
+
def name
|
|
384
|
+
'Hello'
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
def description
|
|
388
|
+
'Simple greeting plugin'
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
def commands
|
|
392
|
+
{
|
|
393
|
+
hello: method(:say_hello)
|
|
394
|
+
}
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
private
|
|
398
|
+
|
|
399
|
+
def say_hello
|
|
400
|
+
puts "Hello from beniya!"
|
|
401
|
+
end
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
#### Plugin with External Gem Dependencies
|
|
408
|
+
|
|
409
|
+
```ruby
|
|
410
|
+
# ~/.beniya/plugins/ai_helper.rb
|
|
411
|
+
module Beniya
|
|
412
|
+
module Plugins
|
|
413
|
+
class AiHelper < Plugin
|
|
414
|
+
requires 'anthropic' # Declare gem dependency
|
|
415
|
+
|
|
416
|
+
def name
|
|
417
|
+
'AiHelper'
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
def description
|
|
421
|
+
'AI assistant using Claude API'
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
def commands
|
|
425
|
+
{
|
|
426
|
+
ai: method(:ask_ai)
|
|
427
|
+
}
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
def initialize
|
|
431
|
+
super # Run dependency check
|
|
432
|
+
@client = Anthropic::Client.new(
|
|
433
|
+
api_key: ENV['ANTHROPIC_API_KEY']
|
|
434
|
+
)
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
private
|
|
438
|
+
|
|
439
|
+
def ask_ai(question)
|
|
440
|
+
# AI processing
|
|
441
|
+
end
|
|
442
|
+
end
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### Plugin Management
|
|
448
|
+
|
|
449
|
+
#### Enable/Disable Plugins
|
|
450
|
+
|
|
451
|
+
You can control plugin activation in `~/.beniya/config.yml`:
|
|
452
|
+
|
|
453
|
+
```yaml
|
|
454
|
+
plugins:
|
|
455
|
+
fileoperations:
|
|
456
|
+
enabled: true
|
|
457
|
+
ai_helper:
|
|
458
|
+
enabled: true
|
|
459
|
+
my_custom:
|
|
460
|
+
enabled: false
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
#### Default Behavior
|
|
464
|
+
|
|
465
|
+
- No `config.yml` → All plugins enabled
|
|
466
|
+
- Plugin not in config → Enabled by default
|
|
467
|
+
- `enabled: false` explicitly set → Disabled
|
|
468
|
+
|
|
469
|
+
### Plugin Distribution
|
|
470
|
+
|
|
471
|
+
#### Share via GitHub Gist
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
# Plugin author
|
|
475
|
+
1. Upload .rb file to GitHub Gist
|
|
476
|
+
2. Share Raw URL with users
|
|
477
|
+
|
|
478
|
+
# User
|
|
479
|
+
$ mkdir -p ~/.beniya/plugins
|
|
480
|
+
$ curl -o ~/.beniya/plugins/my_plugin.rb [RAW_URL]
|
|
481
|
+
$ beniya
|
|
482
|
+
✓ my_plugin loaded successfully
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
#### Share via GitHub Repository
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
# Plugin author
|
|
489
|
+
beniya-plugins/
|
|
490
|
+
├── plugin1.rb
|
|
491
|
+
└── plugin2.rb
|
|
492
|
+
|
|
493
|
+
# User
|
|
494
|
+
$ curl -o ~/.beniya/plugins/plugin1.rb https://raw.githubusercontent.com/user/beniya-plugins/main/plugin1.rb
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### Plugin Key Features
|
|
498
|
+
|
|
499
|
+
#### Required Methods
|
|
500
|
+
|
|
501
|
+
- `name`: Plugin name (required)
|
|
502
|
+
- `description`: Plugin description (optional, default: "")
|
|
503
|
+
- `version`: Plugin version (optional, default: "1.0.0")
|
|
504
|
+
- `commands`: Command definitions (optional, default: {})
|
|
505
|
+
|
|
506
|
+
#### Dependency Management
|
|
507
|
+
|
|
508
|
+
- `requires 'gem_name'`: Declare gem dependencies
|
|
509
|
+
- If dependencies are missing, displays warning and disables plugin
|
|
510
|
+
- beniya continues to start normally
|
|
511
|
+
|
|
512
|
+
#### Auto-registration
|
|
513
|
+
|
|
514
|
+
- Inheriting from `Plugin` class automatically registers with `PluginManager`
|
|
515
|
+
- No complex registration process needed
|
|
516
|
+
|
|
355
517
|
## Development
|
|
356
518
|
|
|
357
519
|
### Requirements
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Beniya
|
|
4
|
+
# プラグインを格納するモジュール
|
|
5
|
+
module Plugins
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# プラグインの基底クラス
|
|
9
|
+
class Plugin
|
|
10
|
+
# 依存gemが不足している場合に投げられるエラー
|
|
11
|
+
class DependencyError < StandardError; end
|
|
12
|
+
|
|
13
|
+
class << self
|
|
14
|
+
# 継承時に自動的にPluginManagerに登録する
|
|
15
|
+
def inherited(subclass)
|
|
16
|
+
super
|
|
17
|
+
PluginManager.register(subclass)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# 依存gemを宣言する
|
|
21
|
+
def requires(*gems)
|
|
22
|
+
@required_gems ||= []
|
|
23
|
+
@required_gems.concat(gems)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# 宣言された依存gemのリストを取得する
|
|
27
|
+
def required_gems
|
|
28
|
+
@required_gems || []
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# 初期化時に依存gemをチェックする
|
|
33
|
+
def initialize
|
|
34
|
+
check_dependencies!
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# プラグイン名(必須オーバーライド)
|
|
38
|
+
def name
|
|
39
|
+
raise NotImplementedError, "#{self.class}#name must be implemented"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# プラグインの説明(オプション)
|
|
43
|
+
def description
|
|
44
|
+
""
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# プラグインのバージョン(オプション)
|
|
48
|
+
def version
|
|
49
|
+
"1.0.0"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# コマンド定義(オプション)
|
|
53
|
+
# { command_name: method(:method_name) } の形式で返す
|
|
54
|
+
def commands
|
|
55
|
+
{}
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
# 依存gemが全て利用可能かチェックする
|
|
61
|
+
def check_dependencies!
|
|
62
|
+
required_gems = self.class.required_gems
|
|
63
|
+
return if required_gems.empty?
|
|
64
|
+
|
|
65
|
+
missing_gems = []
|
|
66
|
+
|
|
67
|
+
required_gems.each do |gem_name|
|
|
68
|
+
begin
|
|
69
|
+
Gem::Specification.find_by_name(gem_name)
|
|
70
|
+
rescue Gem::LoadError
|
|
71
|
+
missing_gems << gem_name
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
return if missing_gems.empty?
|
|
76
|
+
|
|
77
|
+
# 不足しているgemがある場合はエラーを投げる
|
|
78
|
+
error_message = <<~ERROR
|
|
79
|
+
Plugin '#{name}' は以下のgemに依存していますが、インストールされていません:
|
|
80
|
+
- #{missing_gems.join("\n - ")}
|
|
81
|
+
|
|
82
|
+
以下のコマンドでインストールしてください:
|
|
83
|
+
gem install #{missing_gems.join(' ')}
|
|
84
|
+
ERROR
|
|
85
|
+
|
|
86
|
+
raise DependencyError, error_message
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'yaml'
|
|
4
|
+
|
|
5
|
+
module Beniya
|
|
6
|
+
# プラグインの設定を管理するクラス
|
|
7
|
+
class PluginConfig
|
|
8
|
+
class << self
|
|
9
|
+
# 設定ファイルを読み込む
|
|
10
|
+
def load
|
|
11
|
+
config_path = File.expand_path('~/.beniya/config.yml')
|
|
12
|
+
|
|
13
|
+
if File.exist?(config_path)
|
|
14
|
+
begin
|
|
15
|
+
@config = YAML.load_file(config_path) || {}
|
|
16
|
+
rescue StandardError => e
|
|
17
|
+
warn "⚠️ Failed to load config file: #{e.message}"
|
|
18
|
+
@config = {}
|
|
19
|
+
end
|
|
20
|
+
else
|
|
21
|
+
# 設定ファイルが存在しない場合はデフォルト設定(空のハッシュ)
|
|
22
|
+
@config = {}
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# プラグインが有効かどうかをチェックする
|
|
27
|
+
def plugin_enabled?(name)
|
|
28
|
+
# 設定が未読み込みの場合は読み込む
|
|
29
|
+
load if @config.nil?
|
|
30
|
+
|
|
31
|
+
# pluginsセクションがない場合は全プラグイン有効
|
|
32
|
+
return true unless @config.is_a?(Hash) && @config['plugins']
|
|
33
|
+
|
|
34
|
+
plugins_config = @config['plugins']
|
|
35
|
+
return true unless plugins_config.is_a?(Hash)
|
|
36
|
+
|
|
37
|
+
# プラグイン名を小文字に統一して検索
|
|
38
|
+
normalized_name = name.to_s.downcase
|
|
39
|
+
|
|
40
|
+
# 設定のキーも小文字に変換して検索
|
|
41
|
+
plugin_setting = nil
|
|
42
|
+
plugins_config.each do |key, value|
|
|
43
|
+
if key.downcase == normalized_name
|
|
44
|
+
plugin_setting = value
|
|
45
|
+
break
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# 設定が存在しない場合は有効とみなす
|
|
50
|
+
return true if plugin_setting.nil?
|
|
51
|
+
|
|
52
|
+
# enabled設定を確認(デフォルトはtrue)
|
|
53
|
+
return true unless plugin_setting.is_a?(Hash)
|
|
54
|
+
|
|
55
|
+
plugin_setting.fetch('enabled', true)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Beniya
|
|
4
|
+
# プラグインを管理するクラス
|
|
5
|
+
class PluginManager
|
|
6
|
+
class << self
|
|
7
|
+
# 登録済みプラグインクラスのリスト
|
|
8
|
+
def plugins
|
|
9
|
+
@plugins ||= []
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# プラグインを登録する
|
|
13
|
+
def register(plugin_class)
|
|
14
|
+
@plugins ||= []
|
|
15
|
+
@plugins << plugin_class unless @plugins.include?(plugin_class)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# 全プラグインを読み込む(本体同梱 + ユーザープラグイン)
|
|
19
|
+
def load_all
|
|
20
|
+
load_builtin_plugins
|
|
21
|
+
load_user_plugins
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# 有効なプラグインインスタンスのリストを取得
|
|
25
|
+
def enabled_plugins
|
|
26
|
+
return @enabled_plugins if @enabled_plugins
|
|
27
|
+
|
|
28
|
+
@enabled_plugins = []
|
|
29
|
+
|
|
30
|
+
plugins.each do |plugin_class|
|
|
31
|
+
# プラグイン名を取得(クラス名から推測)
|
|
32
|
+
plugin_name = plugin_class.name.split('::').last
|
|
33
|
+
|
|
34
|
+
# PluginConfigで有効かチェック
|
|
35
|
+
next unless PluginConfig.plugin_enabled?(plugin_name)
|
|
36
|
+
|
|
37
|
+
# プラグインのインスタンスを作成
|
|
38
|
+
begin
|
|
39
|
+
plugin_instance = plugin_class.new
|
|
40
|
+
@enabled_plugins << plugin_instance
|
|
41
|
+
rescue Plugin::DependencyError => e
|
|
42
|
+
warn "⚠️ #{e.message}"
|
|
43
|
+
# プラグインは無効化されるが、beniyaは起動継続
|
|
44
|
+
rescue StandardError => e
|
|
45
|
+
warn "⚠️ Failed to load plugin #{plugin_name}: #{e.message}"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
@enabled_plugins
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
# 本体同梱プラグインを読み込む
|
|
55
|
+
def load_builtin_plugins
|
|
56
|
+
# plugin_manager.rbは/lib/beniya/にあるので、pluginsディレクトリは同じディレクトリ内
|
|
57
|
+
builtin_plugins_dir = File.join(__dir__, 'plugins')
|
|
58
|
+
return unless Dir.exist?(builtin_plugins_dir)
|
|
59
|
+
|
|
60
|
+
Dir.glob(File.join(builtin_plugins_dir, '*.rb')).sort.each do |file|
|
|
61
|
+
begin
|
|
62
|
+
require file
|
|
63
|
+
rescue StandardError => e
|
|
64
|
+
warn "⚠️ Failed to load builtin plugin #{File.basename(file)}: #{e.message}"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# ユーザープラグインを読み込む
|
|
70
|
+
def load_user_plugins
|
|
71
|
+
user_plugins_dir = File.expand_path('~/.beniya/plugins')
|
|
72
|
+
return unless Dir.exist?(user_plugins_dir)
|
|
73
|
+
|
|
74
|
+
Dir.glob(File.join(user_plugins_dir, '*.rb')).sort.each do |file|
|
|
75
|
+
begin
|
|
76
|
+
require file
|
|
77
|
+
rescue SyntaxError, StandardError => e
|
|
78
|
+
warn "⚠️ Failed to load user plugin #{File.basename(file)}: #{e.message}"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Beniya
|
|
4
|
+
module Plugins
|
|
5
|
+
# 基本的なファイル操作を提供するプラグイン
|
|
6
|
+
class FileOperations < Plugin
|
|
7
|
+
def name
|
|
8
|
+
"FileOperations"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def description
|
|
12
|
+
"基本的なファイル操作(コピー、移動、削除)"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def commands
|
|
16
|
+
{
|
|
17
|
+
copy: method(:copy),
|
|
18
|
+
move: method(:move),
|
|
19
|
+
delete: method(:delete)
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
# ファイルコピー(スタブ実装)
|
|
26
|
+
def copy
|
|
27
|
+
# 実装は将来追加
|
|
28
|
+
nil
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# ファイル移動(スタブ実装)
|
|
32
|
+
def move
|
|
33
|
+
# 実装は将来追加
|
|
34
|
+
nil
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# ファイル削除(スタブ実装)
|
|
38
|
+
def delete
|
|
39
|
+
# 実装は将来追加
|
|
40
|
+
nil
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/beniya/text_utils.rb
CHANGED
|
@@ -37,20 +37,36 @@ module Beniya
|
|
|
37
37
|
def truncate_to_width(string, max_width)
|
|
38
38
|
return string if display_width(string) <= max_width
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
# If max_width is enough for ellipsis, truncate and add ellipsis
|
|
41
|
+
if max_width >= ELLIPSIS_MIN_WIDTH
|
|
42
|
+
result = ''
|
|
43
|
+
current_width = 0
|
|
44
|
+
target_width = max_width - ELLIPSIS_MIN_WIDTH
|
|
45
|
+
|
|
46
|
+
string.each_char do |char|
|
|
47
|
+
char_width = display_width(char)
|
|
48
|
+
break if current_width + char_width > target_width
|
|
49
|
+
|
|
50
|
+
result += char
|
|
51
|
+
current_width += char_width
|
|
52
|
+
end
|
|
42
53
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
result + ELLIPSIS
|
|
55
|
+
else
|
|
56
|
+
# Not enough room for ellipsis, just truncate
|
|
57
|
+
result = ''
|
|
58
|
+
current_width = 0
|
|
46
59
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
string.each_char do |char|
|
|
61
|
+
char_width = display_width(char)
|
|
62
|
+
break if current_width + char_width > max_width
|
|
50
63
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
result += char
|
|
65
|
+
current_width += char_width
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
result
|
|
69
|
+
end
|
|
54
70
|
end
|
|
55
71
|
|
|
56
72
|
# Pad string to target_width with spaces
|
data/lib/beniya/version.rb
CHANGED
data/lib/beniya.rb
CHANGED
|
@@ -21,6 +21,11 @@ require_relative "beniya/application"
|
|
|
21
21
|
require_relative "beniya/file_opener"
|
|
22
22
|
require_relative "beniya/health_checker"
|
|
23
23
|
|
|
24
|
+
# プラグインシステム
|
|
25
|
+
require_relative "beniya/plugin_config"
|
|
26
|
+
require_relative "beniya/plugin"
|
|
27
|
+
require_relative "beniya/plugin_manager"
|
|
28
|
+
|
|
24
29
|
module Beniya
|
|
25
30
|
class Error < StandardError; end
|
|
26
31
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: beniya
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- masisz
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-11-
|
|
10
|
+
date: 2025-11-29 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: io-console
|
|
@@ -120,6 +120,7 @@ files:
|
|
|
120
120
|
- CHANGELOG_v0.4.0.md
|
|
121
121
|
- CHANGELOG_v0.5.0.md
|
|
122
122
|
- CHANGELOG_v0.6.0.md
|
|
123
|
+
- CHANGELOG_v0.7.0.md
|
|
123
124
|
- README.md
|
|
124
125
|
- README_EN.md
|
|
125
126
|
- Rakefile
|
|
@@ -142,6 +143,10 @@ files:
|
|
|
142
143
|
- lib/beniya/health_checker.rb
|
|
143
144
|
- lib/beniya/keybind_handler.rb
|
|
144
145
|
- lib/beniya/logger.rb
|
|
146
|
+
- lib/beniya/plugin.rb
|
|
147
|
+
- lib/beniya/plugin_config.rb
|
|
148
|
+
- lib/beniya/plugin_manager.rb
|
|
149
|
+
- lib/beniya/plugins/file_operations.rb
|
|
145
150
|
- lib/beniya/selection_manager.rb
|
|
146
151
|
- lib/beniya/terminal_ui.rb
|
|
147
152
|
- lib/beniya/text_utils.rb
|