refactor: expose doctor checks as a library API#23
Merged
Conversation
doctor の診断ロジックを CLI 表示から分離し、Report を返す pub async fn diagnose() として公開する。notedeck の healthcheck が 同じチェック群 (db/keychain/accounts/network/auth) を再利用できるようにするため。 - Status / Check / Report を pub 化し specta feature で specta::Type を導出 - diagnose() を抽出 (print も std::process::exit もしない) - run_doctor() は diagnose() を呼ぶ CLI ラッパーに変更 (出力・終了コードは不変) - commands::doctor を pub mod に Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
概要
doctorサブコマンドの診断ロジックを CLI 表示から分離し、Reportを返すpub async fn diagnose()として公開する。動機
notedeck の healthcheck (#644) が、同じチェック群 (database / keychain / accounts / network / auth) を再実装せずに再利用できるようにするため。notedeck は
commands::doctor::diagnose()を呼び、結果を About ウィンドウの自己診断に表示する。変更
Status/Check/Reportをpub化し、spectafeature 下でspecta::Typeを導出(他モデルと同じ流儀)diagnose(db, db_path, account_spec) -> Result<Report, NoteDeckError>を抽出(print_reportもstd::process::exitも呼ばない純粋関数)run_doctor()はdiagnose()を呼ぶ CLI ラッパーに変更(出力・終了コードは不変)commands::doctorをpub modに検証
cargo check(default /--features specta両方)cargo test168 passednotecli doctor/notecli --json doctorの出力がリファクタ前と同一であることを確認(回帰なし)🤖 Generated with Claude Code