Repository navigation
保管庫のファイル更新を検知して自動再読込するようにした - #13
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
変更内容
保管庫のファイルが更新・追加・削除されたときに自動で再スキャンし、最新のVaultスナップショットを返すようにしました。
リファクタリング
モノリシックな
Vaultクラスを3つに分離しました。Vault— イミュータブルなデータ構造。保管庫のスナップショットを表現し、notes・links_by_file_path・links_by_file_nameのアクセサのみを持つ。VaultManager— Vaultスナップショットのライフサイクル管理。scan!で再構築し、vaultメソッドで変更があれば自動再スキャン。変更検知は mtime/size の比較(チェックサム計算は行わない)。Logic— ツール呼び出しの結果を返すロジック。read_note・list_notesをモジュール関数として抽出。その他の変更
exe.rbの整理 —$vaultから$manager.vaultへ変更。ツール呼び出しはObsidianFetch.read_note/ObsidianFetch.list_notes経由に。コメント整理、不要な空行削除。設計意図
ユーザーの設計思想(カプセル化徹底、イミュータブルなクラスはデータ表現のみ、状態管理はマネージャーの責務、SRP)に従い、データ構造・状態管理・ビジネスロジックを明確に分離しました。