> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comet.rpamis.com/llms.txt
> Use this file to discover all available pages before exploring further.

# comet doctor

> 诊断 Comet 安装健康、平台目录、脚本、Skill 和活跃 change 状态。

`comet doctor` 是健康检查入口。它覆盖安装和工作流状态两个层面。

## 基本用法

```bash theme={null}
comet doctor
```

| 选项                | 说明                             |
| ----------------- | ------------------------------ |
| `--json`          | 输出结构化诊断                        |
| `--scope <scope>` | 诊断 `auto`、`project` 或 `global` |

## 检查内容

* 项目级和全局安装。
* 目标平台 Skill 目录。
* Comet Skill、规则、脚本和 hooks。
* 活跃 change 的 `.comet.yaml`。
* 当前 step、runtime mode 和缺失证据。

## 范围诊断

默认情况下，`comet doctor` 使用 `--scope auto`。auto 会先检查当前项目，再在全局安装位于不同目录时继续检查全局安装。

如果全局 Comet 安装是完整的，但当前项目没有项目级 Skill 副本，`doctor` 会报告全局安装可用，并把项目级副本视为可选项。只有当这个项目需要自己提交一份 Comet 配置时，才需要运行 `comet init --scope project`。

诊断结果还会包含 Node 版本、平台、项目路径和实际使用的全局 home 目录，方便对比不同环境里的安装问题。

## 排障顺序

```mermaid theme={null}
flowchart TD
  A["comet status 异常"] --> B["comet doctor"]
  B --> C{"安装问题?"}
  C -->|是| D["comet update 或重新 init"]
  C -->|否| E{"change 状态问题?"}
  E -->|是| F["按 diagnostic 恢复证据"]
  E -->|否| G["回到 /comet"]
```
