Skip to content

refactor: expose doctor checks as a library API#23

Merged
hitalin merged 1 commit into
mainfrom
feat/doctor-library
Jun 18, 2026
Merged

refactor: expose doctor checks as a library API#23
hitalin merged 1 commit into
mainfrom
feat/doctor-library

Conversation

@hitalin

@hitalin hitalin commented Jun 18, 2026

Copy link
Copy Markdown
Owner

概要

doctor サブコマンドの診断ロジックを CLI 表示から分離し、Report を返す pub async fn diagnose() として公開する。

動機

notedeck の healthcheck (#644) が、同じチェック群 (database / keychain / accounts / network / auth) を再実装せずに再利用できるようにするため。notedeck は commands::doctor::diagnose() を呼び、結果を About ウィンドウの自己診断に表示する。

変更

  • Status / Check / Reportpub 化し、specta feature 下で specta::Type を導出(他モデルと同じ流儀)
  • diagnose(db, db_path, account_spec) -> Result<Report, NoteDeckError> を抽出(print_reportstd::process::exit も呼ばない純粋関数)
  • run_doctor()diagnose() を呼ぶ CLI ラッパーに変更(出力・終了コードは不変
  • commands::doctorpub mod

検証

  • cargo check(default / --features specta 両方)
  • cargo test 168 passed
  • notecli doctor / notecli --json doctor の出力がリファクタ前と同一であることを確認(回帰なし)

🤖 Generated with Claude Code

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>
@hitalin hitalin self-assigned this Jun 18, 2026
@hitalin hitalin merged commit 6ae8ca0 into main Jun 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant