beniya 0.5.0 → 0.6.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: 33133a54577671b4c46cb252c7cfc37361b6ec3023ce172b719d8013cbb376a8
4
- data.tar.gz: 474519fcc81a04375103ef96a8c356f7ba00057e42c13b4779ec3dc78c462662
3
+ metadata.gz: 8e920583f6645634b10889369089e81e114db44a01be5b0baa177dc8279ca1bc
4
+ data.tar.gz: 7c3ec6afa823e45700e26fa02c50076cbdc268d136d11403599a6befc858aebf
5
5
  SHA512:
6
- metadata.gz: a4150553b51268cc0e8e9c73d4c5fc47907859f3c3669a1dbe7981a37ae23a5ad1463bedcbc3f71a11ec3414589055bde7ea6cd85ff4e17127f91bf017f9fe6b
7
- data.tar.gz: 6b69ee230c39f508a6eb70d210dfc7b8401e4014bd86b2ba083dd32458d6ff514c292d5c679966da74229640999b9f3d57096ca6bbdaf7e6739289166d595151
6
+ metadata.gz: bd20c3f4392c8d65aec9bc2e3261701d5f091e6baa73012e779f7417e0d2ea1bc8fe10ea4cac99117b70f82a70b68de0638ec05b390e97436c67691ac11bef90
7
+ data.tar.gz: b28475770533a0d8989eab47f72bf63a83e15546fa4e11a43027e45885c07b491498c0bd83296fe9e67a4568c3c1774f96b8b6ff9bd98d1ea6f2b9d185d4ea30
data/CHANGELOG.md CHANGED
@@ -7,7 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [0.5.0] - 2025-01-20
10
+ ## [0.6.0] - 2025-01-XX
11
+
12
+ ### Added
13
+ - **🚀 zoxide Integration**: Complete zoxide directory history navigation functionality
14
+ - **z Key Navigation**: Press `z` key to display zoxide movement history and navigate to frequently used directories
15
+ - **Smart History Display**: Frequency-based directory sorting with up to 20 history entries
16
+ - **Interactive Selection UI**: Modern floating window for intuitive history selection
17
+ - **Fast Number Key Selection**: Direct directory selection using number keys 1-20
18
+ - **Health Check Enhancement**: zoxide installation status and version checking with `beniya -c`
19
+ - **Multi-platform Installation Support**: Automated installation instructions for macOS and Linux
20
+ - **Graceful Fallback**: Proper handling when zoxide is not installed or history is empty
21
+
22
+ ### Changed
23
+ - **Footer Help Updates**: Added `z:zoxide` to key binding display in both English and Japanese
24
+ - **External Tools Documentation**: Updated README with zoxide installation and usage instructions
25
+ - **Health Check System**: Extended to include zoxide as optional dependency with platform-specific guidance
26
+ - **Error Messaging**: Improved user guidance for zoxide-related issues
27
+
28
+ ### Technical Details
29
+ - New zoxide integration methods in `KeybindHandler` class
30
+ - Extended `HealthChecker` with zoxide version checking
31
+ - Comprehensive test suite for zoxide functionality
32
+ - Safe path escaping using Ruby's Shellwords module
33
+ - **Detailed changelog**: [CHANGELOG_v0.6.0.md](./CHANGELOG_v0.6.0.md)
34
+
35
+ ## [0.5.0] - 2025-09-20
11
36
 
12
37
  ### Added
13
38
  - **🔖 Bookmark System**: Complete bookmark functionality with persistent storage
@@ -32,7 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
32
57
  - Integration with existing terminal UI components
33
58
  - **Detailed changelog**: [CHANGELOG_v0.5.0.md](./CHANGELOG_v0.5.0.md)
34
59
 
35
- ## [0.4.0] - 2025-01-13
60
+ ## [0.4.0] - 2025-09-13
36
61
 
37
62
  ### Added
38
63
  - **Floating Dialog System**: Modern floating confirmation dialogs for delete operations
@@ -65,7 +90,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
65
90
 
66
91
  For detailed information, see [CHANGELOG_v0.4.0.md](./CHANGELOG_v0.4.0.md)
67
92
 
68
- ## [0.3.0] - 2024-XX-XX
93
+ ## [0.3.0] - 2025-09-06
69
94
 
70
95
  ### Added
71
96
  - Enhanced file operations and management features
@@ -76,7 +101,7 @@ For detailed information, see [CHANGELOG_v0.4.0.md](./CHANGELOG_v0.4.0.md)
76
101
  - Performance improvements
77
102
  - Bug fixes and stability enhancements
78
103
 
79
- ## [0.2.0] - 2024-XX-XX
104
+ ## [0.2.0] - 2025-08-26
80
105
 
81
106
  ### Added
82
107
  - New features and functionality improvements
@@ -86,7 +111,7 @@ For detailed information, see [CHANGELOG_v0.4.0.md](./CHANGELOG_v0.4.0.md)
86
111
  - User interface improvements
87
112
  - Performance optimizations
88
113
 
89
- ## [0.1.0] - 2024-XX-XX
114
+ ## [0.1.0] - 2025-08-17
90
115
 
91
116
  ### Added
92
117
  - Initial release of beniya
@@ -99,6 +124,8 @@ For detailed information, see [CHANGELOG_v0.4.0.md](./CHANGELOG_v0.4.0.md)
99
124
 
100
125
  ## Release Links
101
126
 
127
+ - [v0.6.0 Detailed Release Notes](./CHANGELOG_v0.6.0.md) - zoxide Integration and Enhanced Health Checking
128
+ - [v0.5.0 Detailed Release Notes](./CHANGELOG_v0.5.0.md) - Bookmark System Implementation
102
129
  - [v0.4.0 Detailed Release Notes](./CHANGELOG_v0.4.0.md) - Comprehensive changelog with technical details
103
130
  - [GitHub Releases](https://github.com/masisz/beniya/releases) - Download releases and view release history
104
131
  - [Installation Guide](./README.md#installation) - How to install beniya
@@ -121,4 +148,4 @@ When contributing to beniya:
121
148
  3. Link to detailed release notes for major versions
122
149
  4. Include migration notes for breaking changes
123
150
 
124
- For more information, see [Contributing Guidelines](./README.md#contributing).
151
+ For more information, see [Contributing Guidelines](./README.md#contributing).
@@ -0,0 +1,182 @@
1
+ # CHANGELOG - beniya v0.6.0
2
+
3
+ **Release Date**: 2025-09-28
4
+
5
+ ## 🚀 New Features
6
+
7
+ ### zoxide Integration
8
+
9
+ - **zoxide History Navigation with z Key**: Press `z` key to display zoxide movement history and quickly navigate to previously visited directories
10
+ - **Smart History Display**: Frequently used directories appear at the top of the list
11
+ - **Interactive Selection UI**: Floating window displays up to 20 history entries
12
+ - **Fast Selection with Number Keys**: Select directories directly using number keys 1-20
13
+ - **Abbreviated Path Display**: Home directory displayed as `~` with nicely formatted long paths
14
+ - **Graceful Handling**: Proper handling when zoxide is not installed or history is empty
15
+
16
+ ### Health Check Enhancement
17
+
18
+ - **zoxide Check Addition**: Check zoxide installation status and version with `beniya -c`
19
+ - **Installation Instructions**: Detailed platform-specific (macOS/Linux) installation instructions
20
+
21
+ ## 🎨 UI/UX Improvements
22
+
23
+ ### User Interface
24
+
25
+ - **Footer Help Updates**:
26
+ - English version: Added `z:zoxide` to key binding list
27
+ - Japanese version: Added `z:zoxide` to key binding list
28
+ - **zoxide History Selection Dialog**: Intuitive floating window for history selection
29
+ - **Improved Error Messages**: Clear guidance when zoxide is not installed
30
+
31
+ ## 📖 Documentation Updates
32
+
33
+ ### README Updates
34
+
35
+ **Japanese Version (README.md)**:
36
+
37
+ - New zoxide integration features section
38
+ - Added `z:zoxide` to key bindings list
39
+ - Detailed explanation of zoxide overview and installation methods
40
+ - Added zoxide to required external tools list
41
+ - Clarified purpose of each tool
42
+
43
+ **English Version (README_EN.md)**:
44
+
45
+ - New zoxide Integration Features section
46
+ - Added `z:zoxide integration` to Key Bindings
47
+ - Detailed zoxide explanation and installation instructions
48
+ - Expanded Required External Tools section
49
+ - Clarified Tool Usage
50
+
51
+ ### Added Documentation Content
52
+
53
+ - **Detailed explanation of zoxide history navigation features**
54
+ - **Usage examples and workflows**
55
+ - **Overview of zoxide**
56
+ - **Platform-specific installation methods**
57
+ - **Requirements and limitations**
58
+
59
+ ## 🔧 Technical Improvements
60
+
61
+ ### Architecture
62
+
63
+ - **KeybindHandler Class Extension**: Added zoxide-related methods
64
+ - `zoxide_available?`: Check zoxide availability
65
+ - `get_zoxide_history`: Get and parse zoxide history
66
+ - `show_zoxide_menu`: Display history in floating window
67
+ - `select_from_zoxide_history`: Interactive history selection
68
+ - `navigate_to_zoxide_directory`: Navigate to selected directory
69
+
70
+ ### HealthChecker Class Extension
71
+
72
+ - **check_zoxide Method**: Version checking and status verification for zoxide
73
+ - **install_instruction_for Method Extension**: Added installation instructions for zoxide
74
+
75
+ ### Configuration System
76
+
77
+ - **Multi-language Message Support**:
78
+ - `health.zoxide`: Support for both English and Japanese
79
+ - Updated footer help messages
80
+
81
+ ## 🧪 Testing
82
+
83
+ ### New Tests Added
84
+
85
+ - **zoxide Integration Tests** (`test/test_zoxide_integration.rb`):
86
+ - zoxide availability tests
87
+ - History retrieval functionality tests
88
+ - UI display tests
89
+ - Directory navigation tests
90
+ - Error handling tests
91
+
92
+ - **Health Check Test Extensions**:
93
+ - `test_check_zoxide`: zoxide check functionality tests
94
+ - `test_install_instruction_for_zoxide`: Installation instruction tests
95
+
96
+ ## 📦 Dependencies
97
+
98
+ ### New Dependencies
99
+
100
+ - **zoxide**: Directory history functionality (optional)
101
+ - macOS: `brew install zoxide`
102
+ - Ubuntu/Debian: `apt install zoxide`
103
+ - Others: [Official Documentation](https://github.com/ajeetdsouza/zoxide#installation)
104
+
105
+ ### Dependency Updates
106
+
107
+ - **Shellwords Module**: Used for path escaping (Ruby standard library)
108
+
109
+ ## 🔄 Compatibility
110
+
111
+ ### Backward Compatibility
112
+
113
+ - **No Impact on Existing Features**: No changes to existing key bindings or functionality
114
+ - **Configuration File Compatibility**: Existing configuration files can be used as-is
115
+ - **Optional Feature**: All existing features work normally even without zoxide
116
+
117
+ ### Platform Support
118
+
119
+ - **macOS**: Full support (installation via Homebrew recommended)
120
+ - **Linux**: Full support (via package managers)
121
+ - **Windows**: Basic compatibility (zoxide installation methods need separate verification)
122
+
123
+ ## ⚡ Performance
124
+
125
+ ### Optimizations
126
+
127
+ - **Efficient History Retrieval**: Optimal use of zoxide query commands
128
+ - **Memory Usage**: History display limited to maximum 20 entries
129
+ - **Responsiveness**: Fast floating window rendering
130
+
131
+ ## 🐛 Bug Fixes
132
+
133
+ ### Fixed Issues
134
+
135
+ - **zoxide Output Format Support**: Correctly retrieve scored output with `zoxide query --list --score`
136
+ - **Empty History Handling**: Proper message display when no history exists
137
+ - **Path Escaping**: Safe handling of paths with special characters
138
+
139
+ ## 🔮 Future Plans
140
+
141
+ ### Planned for Next Version
142
+
143
+ - **zoxide Integration Update History Recording**: Automatically record directory movements within beniya to zoxide
144
+ - **Customizable History Display Count**: Adjust display count via configuration file
145
+ - **History Filtering**: Filter history by specific patterns
146
+
147
+ ## 📝 Usage Examples
148
+
149
+ ### Basic Usage
150
+
151
+ ```bash
152
+ # Launch beniya
153
+ beniya
154
+
155
+ # Press z key to display zoxide history
156
+ # Enter displayed number (1-20) to navigate to directory
157
+ # Press ESC to cancel
158
+ ```
159
+
160
+ ### Health Check
161
+
162
+ ```bash
163
+ # Check all dependencies including zoxide
164
+ beniya -c
165
+
166
+ # Example output:
167
+ # ✓ zoxide (directory history) zoxide 0.9.8
168
+ ```
169
+
170
+ ## 🙏 Acknowledgments
171
+
172
+ Main contributions in this version:
173
+
174
+ - **zoxide**: [ajeetdsouza/zoxide](https://github.com/ajeetdsouza/zoxide) - Excellent directory navigation tool
175
+ - **Ruby Standard Library**: Utilization of Shellwords module
176
+
177
+ ---
178
+
179
+ **Note**: This version is the initial implementation of zoxide integration features. We welcome feedback and improvement suggestions.
180
+
181
+ **GitHub Issues**: [https://github.com/masisz/beniya/issues](https://github.com/masisz/beniya/issues)
182
+
data/README.md CHANGED
@@ -91,7 +91,7 @@ beniya --help # ヘルプメッセージを表示
91
91
 
92
92
  | キー | 機能 |
93
93
  | ----------- | ------------------------------------------ |
94
- | `s` | フィルターモード開始・再編集 |
94
+ | `f` | フィルターモード開始・再編集 |
95
95
  | 文字入力 | ファイル名で絞り込み(フィルターモード中) |
96
96
  | `Enter` | フィルター維持で通常モードに戻る |
97
97
  | `ESC` | フィルターをクリアして通常モードに戻る |
@@ -101,7 +101,7 @@ beniya --help # ヘルプメッセージを表示
101
101
 
102
102
  | キー | 機能 |
103
103
  | ---- | ----------------------------------------- |
104
- | `f` | fzfによるファイル名検索(プレビュー付き) |
104
+ | `s` | fzfによるファイル名検索(プレビュー付き) |
105
105
  | `F` | rgaによるファイル内容検索 |
106
106
 
107
107
  #### ブックマーク機能
@@ -111,6 +111,12 @@ beniya --help # ヘルプメッセージを表示
111
111
  | `b` | ブックマークメニューを表示 |
112
112
  | `1`-`9` | 対応する番号のブックマークに移動 |
113
113
 
114
+ #### zoxide連携機能
115
+
116
+ | キー | 機能 |
117
+ | ---- | ---------------------------------- |
118
+ | `z` | zoxide履歴からディレクトリを選択移動 |
119
+
114
120
  #### システム操作
115
121
 
116
122
  | キー | 機能 |
@@ -169,30 +175,30 @@ beniya起動時のディレクトリが**ベースディレクトリ**として
169
175
 
170
176
  ### フィルター機能の詳細
171
177
 
172
- #### リアルタイムフィルター (`s`)
178
+ #### リアルタイムフィルター (`f`)
173
179
 
174
- - **フィルター開始**: `s`キーを押してフィルターモードに入る
180
+ - **フィルター開始**: `f`キーを押してフィルターモードに入る
175
181
  - **文字入力による絞り込み**: 日本語・英数字・記号に対応
176
182
  - **リアルタイム更新**: 文字を入力するたびに表示が更新される
177
183
  - **フィルター維持**: `Enter`キーでフィルターを保持したまま通常操作に戻る
178
184
  - **フィルタークリア**: `ESC`キーでフィルターをクリアして通常表示に戻る
179
- - **再編集**: フィルター適用中に`s`キーで再編集モード
185
+ - **再編集**: フィルター適用中に`f`キーで再編集モード
180
186
  - **文字削除**: `Backspace`で文字削除、全削除時は自動でフィルタークリア
181
187
 
182
188
  #### 使用例
183
189
 
184
190
  ```
185
- 1. s → フィルターモード開始
191
+ 1. f → フィルターモード開始
186
192
  2. ".rb" → Rubyファイルのみ表示
187
193
  3. Enter → フィルター維持で通常操作
188
194
  4. j/k → フィルター結果内をナビゲーション
189
- 5. s → フィルター再編集
195
+ 5. f → フィルター再編集
190
196
  6. ESC → フィルタークリア
191
197
  ```
192
198
 
193
199
  ### 検索機能の詳細
194
200
 
195
- #### ファイル名検索 (`f`)
201
+ #### ファイル名検索 (`s`)
196
202
 
197
203
  - `fzf`を使用したインタラクティブなファイル名検索
198
204
  - リアルタイムプレビュー表示
@@ -225,22 +231,68 @@ beniya起動時のディレクトリが**ベースディレクトリ**として
225
231
  - beniya再起動後もブックマーク情報が保持される
226
232
  - JSONファイルを直接編集することも可能
227
233
 
234
+ ### zoxide連携機能の詳細
235
+
236
+ #### zoxide履歴移動 (`z`)
237
+
238
+ - **スマート履歴**: zoxideが記録したディレクトリ移動履歴を表示
239
+ - **フリークエンシー順**: よく使用するディレクトリほど上位に表示
240
+ - **インタラクティブ選択**: フローティングウィンドウで履歴を選択
241
+ - **高速ナビゲーション**: 数字キーで直接ディレクトリを選択
242
+ - **パス省略表示**: ホームディレクトリを`~`で表示し見やすく
243
+
244
+ #### 使用例
245
+
246
+ ```
247
+ 1. z → zoxide履歴メニューを表示
248
+ 2. 1-20 → 表示された番号でディレクトリを選択
249
+ 3. ESC → キャンセルして元の画面に戻る
250
+ ```
251
+
252
+ #### zoxideについて
253
+
254
+ [zoxide](https://github.com/ajeetdsouza/zoxide)は、ディレクトリ移動履歴を学習するスマートなcdコマンドです。
255
+
256
+ ```bash
257
+ # zoxideのインストール
258
+ # macOS (Homebrew)
259
+ brew install zoxide
260
+
261
+ # Ubuntu/Debian
262
+ apt install zoxide
263
+
264
+ # その他のインストール方法は公式ドキュメントを参照
265
+ # https://github.com/ajeetdsouza/zoxide#installation
266
+ ```
267
+
268
+ #### 動作要件
269
+
270
+ - zoxideがシステムにインストールされている必要があります
271
+ - zoxideが無効な場合は適切なメッセージが表示されます
272
+ - 履歴が空の場合も適切にハンドリングされます
273
+
228
274
  ### 必要な外部ツール
229
275
 
230
- 検索機能を使用するには、以下のツールが必要です:
276
+ 検索機能・履歴機能を使用するには、以下のツールが必要です:
231
277
 
232
278
  ```bash
233
279
  # macOS (Homebrew)
234
- brew install fzf rga
280
+ brew install fzf rga zoxide
235
281
 
236
282
  # Ubuntu/Debian
237
- apt install fzf
283
+ apt install fzf zoxide
238
284
  # rgaは別途インストールが必要: https://github.com/phiresky/ripgrep-all
239
285
 
240
286
  # その他のLinuxディストリビューション
241
287
  # パッケージマネージャーまたは手動インストールが必要
242
288
  ```
243
289
 
290
+ #### 各ツールの用途
291
+
292
+ - **fzf**: ファイル名検索機能(`s`キー)
293
+ - **rga**: ファイル内容検索機能(`F`キー)
294
+ - **zoxide**: ディレクトリ履歴移動機能(`z`キー)
295
+
244
296
  ## 設定
245
297
 
246
298
  ### 色設定(カスタマイズ)
data/README_EN.md CHANGED
@@ -105,6 +105,19 @@ beniya --help # Show help message
105
105
  | `f` | File name search with fzf (with preview) |
106
106
  | `F` | File content search with rga |
107
107
 
108
+ #### Bookmark Functions
109
+
110
+ | Key | Function |
111
+ | ------- | ------------------------------- |
112
+ | `b` | Show bookmark menu |
113
+ | `1`-`9` | Go to corresponding bookmark |
114
+
115
+ #### zoxide Integration
116
+
117
+ | Key | Function |
118
+ | --- | ---------------------------------- |
119
+ | `z` | Select directory from zoxide history |
120
+
108
121
  #### System Operations
109
122
 
110
123
  | Key | Function |
@@ -198,22 +211,89 @@ The directory where beniya starts becomes the **base directory**, which serves a
198
211
  - Searches PDFs, Word documents, text in images, and more
199
212
  - Filter results with fzf and jump to specific lines
200
213
 
214
+ ### Bookmark Features
215
+
216
+ #### Bookmark Operations (`b`)
217
+
218
+ - **Add Bookmark**: `[A]` - Add current directory to bookmarks
219
+ - **List Bookmarks**: `[L]` - Display registered bookmarks
220
+ - **Remove Bookmark**: `[R]` - Remove a bookmark
221
+ - **Number Jump**: `1-9` - Jump directly to corresponding bookmark
222
+
223
+ #### Quick Navigation (`1`-`9`)
224
+
225
+ - Jump directly to bookmarks without going through the bookmark menu
226
+ - Supports up to 9 bookmarks
227
+ - Bookmark information is displayed at the top of the screen
228
+
229
+ #### Bookmark Persistence
230
+
231
+ - Bookmark information is automatically saved to `~/.config/beniya/bookmarks.json`
232
+ - Bookmark information is preserved after beniya restarts
233
+ - JSON file can be edited directly
234
+
235
+ ### zoxide Integration Features
236
+
237
+ #### zoxide History Navigation (`z`)
238
+
239
+ - **Smart History**: Display directory navigation history recorded by zoxide
240
+ - **Frequency Order**: More frequently used directories appear higher in the list
241
+ - **Interactive Selection**: Select from history using floating window
242
+ - **Quick Navigation**: Select directories directly with number keys
243
+ - **Abbreviated Path Display**: Home directory shown as `~` for readability
244
+
245
+ #### Usage Example
246
+
247
+ ```
248
+ 1. z → Display zoxide history menu
249
+ 2. 1-20 → Select directory by displayed number
250
+ 3. ESC → Cancel and return to original screen
251
+ ```
252
+
253
+ #### About zoxide
254
+
255
+ [zoxide](https://github.com/ajeetdsouza/zoxide) is a smart cd command that learns your directory navigation habits.
256
+
257
+ ```bash
258
+ # Installing zoxide
259
+ # macOS (Homebrew)
260
+ brew install zoxide
261
+
262
+ # Ubuntu/Debian
263
+ apt install zoxide
264
+
265
+ # For other installation methods, see official documentation
266
+ # https://github.com/ajeetdsouza/zoxide#installation
267
+ ```
268
+
269
+ #### Requirements
270
+
271
+ - zoxide must be installed on the system
272
+ - Appropriate message is displayed when zoxide is not available
273
+ - Empty history is handled gracefully
274
+
201
275
  ### Required External Tools
202
276
 
203
- The following tools are required for search functionality:
277
+ The following tools are required for search and history functionality:
204
278
 
205
279
  ```bash
206
280
  # macOS (Homebrew)
207
- brew install fzf rga
281
+ brew install fzf rga zoxide
208
282
 
209
283
  # Ubuntu/Debian
210
- apt install fzf
284
+ apt install fzf zoxide
211
285
  # rga requires separate installation: https://github.com/phiresky/ripgrep-all
212
286
 
213
287
  # Other Linux distributions
214
288
  # Installation via package manager or manual installation required
215
289
  ```
216
290
 
291
+ #### Tool Usage
292
+
293
+ - **fzf**: File name search functionality (`f` key)
294
+ - **rga**: File content search functionality (`F` key)
295
+ - **zoxide**: Directory history navigation functionality (`z` key)
296
+
217
297
  ## Configuration
218
298
 
219
299
  ### Color Configuration (Customization)
data/Rakefile ADDED
@@ -0,0 +1,156 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+ require_relative 'lib/beniya/version'
6
+
7
+ # Test task
8
+ Rake::TestTask.new(:test) do |t|
9
+ t.libs << 'test'
10
+ t.libs << 'lib'
11
+ t.test_files = FileList['test/test_*.rb']
12
+ end
13
+
14
+ # Default task
15
+ task default: :test
16
+
17
+ # Gem build and push tasks
18
+ namespace :gem do
19
+ desc 'Build the gem file'
20
+ task :build do
21
+ puts "Building beniya v#{Beniya::VERSION}..."
22
+
23
+ # Clean old gem files
24
+ FileUtils.rm_f(Dir.glob('*.gem'))
25
+
26
+ # Build the gem
27
+ result = system('gem build beniya.gemspec')
28
+
29
+ if result
30
+ gem_file = "beniya-#{Beniya::VERSION}.gem"
31
+ puts "✅ Successfully built #{gem_file}"
32
+ else
33
+ puts "❌ Failed to build gem"
34
+ exit 1
35
+ end
36
+ end
37
+
38
+ desc 'Push the gem to RubyGems.org'
39
+ task :push => :build do
40
+ gem_file = "beniya-#{Beniya::VERSION}.gem"
41
+
42
+ unless File.exist?(gem_file)
43
+ puts "❌ Gem file not found: #{gem_file}"
44
+ exit 1
45
+ end
46
+
47
+ puts "Pushing #{gem_file} to RubyGems.org..."
48
+
49
+ result = system("gem push #{gem_file}")
50
+
51
+ if result
52
+ puts "✅ Successfully pushed #{gem_file} to RubyGems.org"
53
+ puts "🎉 beniya v#{Beniya::VERSION} is now available!"
54
+ puts "📦 Install with: gem install beniya"
55
+ else
56
+ puts "❌ Failed to push gem to RubyGems.org"
57
+ exit 1
58
+ end
59
+ end
60
+
61
+ desc 'Check if current version already exists on RubyGems.org'
62
+ task :check_version do
63
+ puts "Checking if version #{Beniya::VERSION} exists on RubyGems.org..."
64
+
65
+ result = system("gem list beniya --remote --exact --all | grep '#{Beniya::VERSION}'", out: File::NULL, err: File::NULL)
66
+
67
+ if result
68
+ puts "⚠️ Version #{Beniya::VERSION} already exists on RubyGems.org"
69
+ puts "💡 Please update the version in lib/beniya/version.rb before publishing"
70
+ exit 1
71
+ else
72
+ puts "✅ Version #{Beniya::VERSION} is available for publishing"
73
+ end
74
+ end
75
+
76
+ desc 'Clean built gem files'
77
+ task :clean do
78
+ puts "Cleaning gem files..."
79
+ removed_files = Dir.glob('*.gem')
80
+ FileUtils.rm_f(removed_files)
81
+
82
+ if removed_files.any?
83
+ puts "🗑️ Removed: #{removed_files.join(', ')}"
84
+ else
85
+ puts "✨ No gem files to clean"
86
+ end
87
+ end
88
+
89
+ desc 'Build and publish gem (with version check)'
90
+ task :publish => [:check_version, :test, :push] do
91
+ puts "🚀 Gem publishing completed successfully!"
92
+ end
93
+ end
94
+
95
+ # Release tasks
96
+ namespace :release do
97
+ desc 'Tag the current version in git'
98
+ task :tag do
99
+ version = "v#{Beniya::VERSION}"
100
+
101
+ puts "Creating git tag #{version}..."
102
+
103
+ # Check if tag already exists
104
+ if system("git tag -l | grep -q '^#{version}$'", out: File::NULL, err: File::NULL)
105
+ puts "⚠️ Tag #{version} already exists"
106
+ exit 1
107
+ end
108
+
109
+ # Create and push tag
110
+ system("git tag #{version}")
111
+ system("git push origin #{version}")
112
+
113
+ puts "✅ Created and pushed tag #{version}"
114
+ end
115
+
116
+ desc 'Prepare release (tag + gem publish)'
117
+ task :prepare => ['gem:publish', :tag] do
118
+ puts "🎉 Release v#{Beniya::VERSION} completed!"
119
+ puts "📋 Don't forget to:"
120
+ puts " - Update CHANGELOG.md"
121
+ puts " - Create GitHub release from tag"
122
+ puts " - Announce the release"
123
+ end
124
+ end
125
+
126
+ # Utility tasks
127
+ desc 'Display current version'
128
+ task :version do
129
+ puts "beniya v#{Beniya::VERSION}"
130
+ end
131
+
132
+ desc 'Run simple test for basic functionality'
133
+ task :simple_test do
134
+ puts "Running simple functionality test..."
135
+ result = system('ruby test/simple_test.rb')
136
+
137
+ if result
138
+ puts "✅ Simple test passed"
139
+ else
140
+ puts "❌ Simple test failed"
141
+ exit 1
142
+ end
143
+ end
144
+
145
+ desc 'Run bookmark tests'
146
+ task :test_bookmark do
147
+ puts "Running bookmark functionality test..."
148
+ result = system('ruby test/test_bookmark_simple.rb')
149
+
150
+ if result
151
+ puts "✅ Bookmark tests passed"
152
+ else
153
+ puts "❌ Bookmark tests failed"
154
+ exit 1
155
+ end
156
+ end
data/lib/beniya/config.rb CHANGED
@@ -43,8 +43,8 @@ module Beniya
43
43
  'ui.operation_prompt' => 'Operation: ',
44
44
 
45
45
  # Help text
46
- 'help.full' => 'j/k:move h:back l:enter o:open g/G:top/bottom r:refresh s:filter f:search F:content a/A:create m/p/x:ops b:bookmark 1-9:goto q:quit',
47
- 'help.short' => 'j/k:move h:back l:enter o:open s:filter b:bookmark 1-9:goto q:quit',
46
+ 'help.full' => 'j/k:move h:back l:enter o:open g/G:top/bottom r:refresh f:filter s:search F:content a/A:create m/p/x:ops b:bookmark z:zoxide 1-9:goto q:quit',
47
+ 'help.short' => 'j/k:move h:back l:enter o:open f:filter s:search b:bookmark z:zoxide 1-9:goto q:quit',
48
48
 
49
49
  # Health check messages
50
50
  'health.title' => 'beniya Health Check',
@@ -52,6 +52,7 @@ module Beniya
52
52
  'health.required_gems' => 'Required gems',
53
53
  'health.fzf' => 'fzf (file search)',
54
54
  'health.rga' => 'rga (content search)',
55
+ 'health.zoxide' => 'zoxide (directory history)',
55
56
  'health.file_opener' => 'System file opener',
56
57
  'health.summary' => 'Summary:',
57
58
  'health.ok' => 'OK',
@@ -111,8 +112,8 @@ module Beniya
111
112
  'ui.operation_prompt' => '操作: ',
112
113
 
113
114
  # Help text
114
- 'help.full' => 'j/k:移動 h:戻る l:入る o:開く g/G:先頭/末尾 r:更新 s:絞込 f:検索 F:内容 a/A:作成 m/p/x:操作 b:ブックマーク 1-9:移動 q:終了',
115
- 'help.short' => 'j/k:移動 h:戻る l:入る o:開く s:絞込 b:ブックマーク 1-9:移動 q:終了',
115
+ 'help.full' => 'j/k:移動 h:戻る l:入る o:開く g/G:先頭/末尾 r:更新 f:絞込 s:検索 F:内容 a/A:作成 m/p/x:操作 b:ブックマーク z:zoxide 1-9:移動 q:終了',
116
+ 'help.short' => 'j/k:移動 h:戻る l:入る o:開く f:絞込 s:検索 b:ブックマーク z:zoxide 1-9:移動 q:終了',
116
117
 
117
118
  # Health check messages
118
119
  'health.title' => 'beniya ヘルスチェック',
@@ -120,6 +121,7 @@ module Beniya
120
121
  'health.required_gems' => '必須 gem',
121
122
  'health.fzf' => 'fzf (ファイル検索)',
122
123
  'health.rga' => 'rga (内容検索)',
124
+ 'health.zoxide' => 'zoxide (ディレクトリ履歴)',
123
125
  'health.file_opener' => 'システムファイルオープナー',
124
126
  'health.summary' => 'サマリー:',
125
127
  'health.ok' => 'OK',
@@ -20,6 +20,7 @@ module Beniya
20
20
  { name: ConfigLoader.message('health.required_gems'), method: :check_required_gems },
21
21
  { name: ConfigLoader.message('health.fzf'), method: :check_fzf },
22
22
  { name: ConfigLoader.message('health.rga'), method: :check_rga },
23
+ { name: ConfigLoader.message('health.zoxide'), method: :check_zoxide },
23
24
  { name: ConfigLoader.message('health.file_opener'), method: :check_file_opener }
24
25
  ]
25
26
 
@@ -118,6 +119,23 @@ module Beniya
118
119
  end
119
120
  end
120
121
 
122
+ def check_zoxide
123
+ if system("which zoxide > /dev/null 2>&1")
124
+ version = `zoxide --version 2>/dev/null`.strip
125
+ {
126
+ status: :ok,
127
+ message: version,
128
+ details: nil
129
+ }
130
+ else
131
+ {
132
+ status: :warning,
133
+ message: "zoxide #{ConfigLoader.message('health.tool_not_found')}",
134
+ details: install_instruction_for('zoxide')
135
+ }
136
+ end
137
+ end
138
+
121
139
  def check_file_opener
122
140
  case RUBY_PLATFORM
123
141
  when /darwin/
@@ -160,6 +178,8 @@ module Beniya
160
178
  "#{ConfigLoader.message('health.install_brew')} fzf"
161
179
  when 'rga'
162
180
  "#{ConfigLoader.message('health.install_brew')} rga"
181
+ when 'zoxide'
182
+ "#{ConfigLoader.message('health.install_brew')} zoxide"
163
183
  end
164
184
  when /linux/
165
185
  case tool
@@ -167,6 +187,8 @@ module Beniya
167
187
  "#{ConfigLoader.message('health.install_apt')} fzf (Ubuntu/Debian) or check your package manager"
168
188
  when 'rga'
169
189
  ConfigLoader.message('health.rga_releases')
190
+ when 'zoxide'
191
+ "#{ConfigLoader.message('health.install_apt')} zoxide (Ubuntu/Debian) or check your package manager"
170
192
  end
171
193
  else
172
194
  ConfigLoader.message('health.install_guide')
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'shellwords'
3
4
  require_relative 'bookmark'
5
+ require_relative 'file_opener'
4
6
 
5
7
  module Beniya
6
8
  class KeybindHandler
@@ -66,7 +68,7 @@ module Beniya
66
68
  open_current_file
67
69
  when 'e' # e - open directory in file explorer
68
70
  open_directory_in_explorer
69
- when 's' # s - filter files
71
+ when 'f' # f - filter files
70
72
  if !@filter_query.empty?
71
73
  # フィルタが設定されている場合は再編集モードに入る
72
74
  @filter_mode = true
@@ -89,7 +91,7 @@ module Beniya
89
91
  exit_request
90
92
  when '/' # /
91
93
  fzf_search
92
- when 'f' # f - file name search with fzf
94
+ when 's' # s - file name search with fzf
93
95
  fzf_search
94
96
  when 'F' # F - file content search with rga
95
97
  rga_search
@@ -105,6 +107,8 @@ module Beniya
105
107
  delete_selected_files
106
108
  when 'b' # b - bookmark operations
107
109
  show_bookmark_menu
110
+ when 'z' # z - zoxide history navigation
111
+ show_zoxide_menu
108
112
  when '1', '2', '3', '4', '5', '6', '7', '8', '9' # number keys - go to bookmark
109
113
  goto_bookmark(key.to_i)
110
114
  else
@@ -1045,5 +1049,180 @@ module Beniya
1045
1049
  return false
1046
1050
  end
1047
1051
  end
1052
+
1053
+ # zoxide 機能
1054
+ def show_zoxide_menu
1055
+ history = get_zoxide_history
1056
+
1057
+ if history.empty?
1058
+ show_no_zoxide_history_message
1059
+ return false
1060
+ end
1061
+
1062
+ # zoxide履歴選択UI
1063
+ selected_path = select_from_zoxide_history(history)
1064
+
1065
+ if selected_path
1066
+ navigate_to_zoxide_directory(selected_path)
1067
+ else
1068
+ false
1069
+ end
1070
+ end
1071
+
1072
+ private
1073
+
1074
+ def zoxide_available?
1075
+ system('which zoxide > /dev/null 2>&1')
1076
+ end
1077
+
1078
+ def get_zoxide_history
1079
+ return [] unless zoxide_available?
1080
+
1081
+ begin
1082
+ # zoxide query --list --score で履歴を取得(スコア順)
1083
+ output = `zoxide query --list --score 2>/dev/null`.strip
1084
+ return [] if output.empty?
1085
+
1086
+ # 各行をパスとスコアに分けて配列に変換
1087
+ lines = output.split("\n")
1088
+ history = lines.map do |line|
1089
+ # zoxide の出力は "スコア パス" の形式
1090
+ if line.match(/^\s*(\d+(?:\.\d+)?)\s+(.+)$/)
1091
+ score = $1.to_f
1092
+ path = $2.strip
1093
+ { path: path, score: score }
1094
+ else
1095
+ # スコアがない場合はパスのみ(後方互換性)
1096
+ { path: line.strip, score: 0.0 }
1097
+ end
1098
+ end
1099
+
1100
+ # 有効なディレクトリのみフィルタリング
1101
+ history.select { |entry| Dir.exist?(entry[:path]) }
1102
+ rescue StandardError
1103
+ []
1104
+ end
1105
+ end
1106
+
1107
+ def show_no_zoxide_history_message
1108
+ title = 'Zoxide'
1109
+ content_lines = [
1110
+ '',
1111
+ 'No zoxide history found.',
1112
+ '',
1113
+ 'Zoxide learns from your directory navigation.',
1114
+ 'Use zoxide more to build up history.',
1115
+ '',
1116
+ 'Press any key to continue...'
1117
+ ]
1118
+
1119
+ dialog_width = 45
1120
+ dialog_height = 4 + content_lines.length
1121
+ x, y = get_screen_center(dialog_width, dialog_height)
1122
+
1123
+ draw_floating_window(x, y, dialog_width, dialog_height, title, content_lines, {
1124
+ border_color: "\e[33m", # 黄色
1125
+ title_color: "\e[1;33m", # 太字黄色
1126
+ content_color: "\e[37m" # 白色
1127
+ })
1128
+
1129
+ STDIN.getch
1130
+ clear_floating_window_area(x, y, dialog_width, dialog_height)
1131
+ @terminal_ui&.refresh_display
1132
+ end
1133
+
1134
+ def select_from_zoxide_history(history)
1135
+ title = 'Zoxide History'
1136
+
1137
+ # 履歴を表示用に整形(最大20件)
1138
+ display_history = history.first(20)
1139
+ content_lines = ['']
1140
+
1141
+ display_history.each_with_index do |entry, index|
1142
+ # パスの表示を短縮(ホームディレクトリを ~ に置換)
1143
+ display_path = entry[:path].gsub(ENV['HOME'], '~')
1144
+ line = " #{index + 1}. #{display_path}"
1145
+ # 長すぎる場合は切り詰め
1146
+ line = line[0...60] + '...' if line.length > 63
1147
+ content_lines << line
1148
+ end
1149
+
1150
+ content_lines << ''
1151
+ content_lines << 'Enter number (1-' + display_history.length.to_s + ') or ESC to cancel'
1152
+
1153
+ dialog_width = 70
1154
+ dialog_height = [4 + content_lines.length, 25].min
1155
+ x, y = get_screen_center(dialog_width, dialog_height)
1156
+
1157
+ draw_floating_window(x, y, dialog_width, dialog_height, title, content_lines, {
1158
+ border_color: "\e[36m", # シアン色
1159
+ title_color: "\e[1;36m", # 太字シアン色
1160
+ content_color: "\e[37m" # 白色
1161
+ })
1162
+
1163
+ # 数字入力モード
1164
+ input_buffer = ''
1165
+
1166
+ loop do
1167
+ char = STDIN.getch
1168
+
1169
+ case char
1170
+ when "\e", "\x03" # ESC, Ctrl+C
1171
+ clear_floating_window_area(x, y, dialog_width, dialog_height)
1172
+ @terminal_ui&.refresh_display
1173
+ return nil
1174
+ when "\r", "\n" # Enter
1175
+ if !input_buffer.empty?
1176
+ number = input_buffer.to_i
1177
+ if number > 0 && number <= display_history.length
1178
+ selected_entry = display_history[number - 1]
1179
+ clear_floating_window_area(x, y, dialog_width, dialog_height)
1180
+ @terminal_ui&.refresh_display
1181
+ return selected_entry[:path]
1182
+ end
1183
+ end
1184
+ # 無効な入力の場合は再度入力を求める
1185
+ input_buffer = ''
1186
+ when "\u007f", "\b" # Backspace
1187
+ input_buffer = input_buffer[0...-1] unless input_buffer.empty?
1188
+ when /[0-9]/
1189
+ input_buffer += char
1190
+ # 最大2桁まで
1191
+ input_buffer = input_buffer[-2..-1] if input_buffer.length > 2
1192
+
1193
+ # 入力された数字が範囲内の場合は即座に選択
1194
+ number = input_buffer.to_i
1195
+ if number > 0 && number <= display_history.length &&
1196
+ (number >= 10 || input_buffer.length == 1)
1197
+ selected_entry = display_history[number - 1]
1198
+ clear_floating_window_area(x, y, dialog_width, dialog_height)
1199
+ @terminal_ui&.refresh_display
1200
+ return selected_entry[:path]
1201
+ end
1202
+ end
1203
+ end
1204
+ end
1205
+
1206
+ def navigate_to_zoxide_directory(target_path)
1207
+ return false unless Dir.exist?(target_path)
1208
+
1209
+ # DirectoryListingのnavigate_to_pathメソッドを使用してディレクトリに移動
1210
+ result = @directory_listing.navigate_to_path(target_path)
1211
+ if result
1212
+ @current_index = 0
1213
+ clear_filter_mode
1214
+
1215
+ # zoxide に移動を記録
1216
+ begin
1217
+ system("zoxide add #{Shellwords.escape(target_path)} > /dev/null 2>&1")
1218
+ rescue StandardError
1219
+ # zoxide add が失敗しても移動は成功として扱う
1220
+ end
1221
+
1222
+ true
1223
+ else
1224
+ false
1225
+ end
1226
+ end
1048
1227
  end
1049
1228
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Beniya
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.0'
5
5
  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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - masisz
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-20 00:00:00.000000000 Z
10
+ date: 2025-09-28 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: io-console
@@ -119,8 +119,10 @@ files:
119
119
  - CHANGELOG.md
120
120
  - CHANGELOG_v0.4.0.md
121
121
  - CHANGELOG_v0.5.0.md
122
+ - CHANGELOG_v0.6.0.md
122
123
  - README.md
123
124
  - README_EN.md
125
+ - Rakefile
124
126
  - beniya.gemspec
125
127
  - bin/beniya
126
128
  - config_example.rb