Skip to content

feat: doctor local health check - #37

Merged
XucroYuri merged 5 commits into
mainfrom
goratio-dev-doctor
Sep 3, 2026
Merged

feat: doctor local health check#37
XucroYuri merged 5 commits into
mainfrom
goratio-dev-doctor

Conversation

@XucroYuri

Copy link
Copy Markdown
Owner

新增 doctor 命令与 run_doctor,检查主要模块可导入。

Copilot AI lite review requested due to automatic review settings September 3, 2026 00:55
@XucroYuri
XucroYuri merged commit 435067d into main Sep 3, 2026
11 checks passed
@XucroYuri
XucroYuri deleted the goratio-dev-doctor branch September 3, 2026 00:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

doctor CLI 当前始终返回 0 且缺少对 CLI 退出码行为的测试覆盖,影响脚本/CI 使用可靠性。

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

新增 doctor 本地健康检查能力,用于快速验证 goratio 的主要模块在当前环境中是否可导入(从而尽早暴露缺失依赖或导入时错误),并通过 CLI 暴露为一个可调用的子命令。

Changes:

  • 新增 goratio.doctor.run_doctor():批量导入关键模块并生成结构化检查报告。
  • CLI 增加 doctor 子命令,支持文本/JSON 输出。
  • 增加基础单测与更新变更日志/路线图条目。
File summaries
File Description
tests/test_doctor.py 新增 doctor 报告的基础断言测试。
src/goratio/doctor.py 新增本地模块导入健康检查实现与报告结构。
src/goratio/cli.py 增加 doctor 子命令解析与输出逻辑。
CHANGELOG.md 记录新增 doctor CLI 与健康检查能力。
.planning/ROADMAP.md 路线图勾选 doctor CLI,并更新当前测试数量。
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/goratio/cli.py
Comment on lines +572 to +579
if args.command == "doctor":
report = run_doctor()
if args.as_json:
stdout.write(json.dumps(report, ensure_ascii=False, indent=2, sort_keys=True) + "\n")
else:
for check in report["checks"]:
stdout.write(f" {check['module']}: {check['status']}\n")
return 0
Comment thread src/goratio/doctor.py
Comment on lines +30 to +32
except Exception as exc: # noqa: BLE001
status = f"error: {exc}"
ok = False
Comment thread tests/test_doctor.py
Comment on lines +1 to +16
import unittest

from goratio.doctor import run_doctor


class DoctorTests(unittest.TestCase):
def test_all_modules_import(self) -> None:
report = run_doctor()

self.assertTrue(report["ok"])
self.assertGreaterEqual(report["module_count"], 10)
self.assertTrue(all(c["status"] == "ok" for c in report["checks"]))


if __name__ == "__main__":
unittest.main()
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.

2 participants