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

# CLI 命令

> cc-safety-net CLI 概览：如何用 npx 或 bunx 运行、全部十二个命令、版本与帮助全局选项，以及未知命令的报错。

`cc-safety-net` 是 CC Safety Net 提供的唯一 CLI。用它把 CC Safety Net 安装到编码智能体中、查看当前执行的保护，以及管理规则和策略。

```bash theme={"dark"}
npx cc-safety-net <command>
bunx cc-safety-net <command>
```

它不需要全局安装，`npx` 或 `bunx` 会按需获取。首次运行请参阅[快速入门](/docs/zh-Hans/quickstart.md)，各智能体的设置方法见[安装](/docs/zh-Hans/installation.md)。

## cc-safety-net 命令列表

CLI 共有十二个命令。下表按它们在 `cc-safety-net --help` 中出现的顺序排列。

| 命令 | 用法 | 功能 |
| - | - | - |
| [`status`](/docs/zh-Hans/reference/cli/status) | `status` | 显示运行时当前正在执行的保护 |
| [`doctor`](/docs/zh-Hans/reference/cli/doctor) | `doctor [options]` | 检查安装和配置是否有问题 |
| [`logs`](/docs/zh-Hans/reference/cli/logs) | `logs [options]` | 浏览 hook 记录的审计日志条目 |
| [`explain`](/docs/zh-Hans/reference/cli/explain) | `explain [options] <command>` | 逐步展示 CC Safety Net 如何分析一条命令 |
| [`rule`](/docs/zh-Hans/reference/cli/rule) | `rule <subcommand>` | 管理规则配置、rulebook 来源、透明包装器和已声明的命令工具 |
| [`policy`](/docs/zh-Hans/reference/cli/policy) | `policy <subcommand>` | 检查并应用项目或用户的策略提案 |
| [`install`](/docs/zh-Hans/reference/cli/install) | `install [TARGET_FLAG]` | 将 CC Safety Net 安装到编码智能体 CLI 中 |
| [`update`](/docs/zh-Hans/reference/cli/update) | `update` | 就地更新所有已安装的集成 |
| [`uninstall`](/docs/zh-Hans/reference/cli/uninstall) | `uninstall [TARGET_FLAG]` | 从编码智能体 CLI 中移除 CC Safety Net |
| [`hook`](/docs/zh-Hans/reference/cli/hook) | `hook INTEGRATION_FLAG` | 作为智能体的运行时 hook 运行，从 stdin 读取 JSON |
| [`gui`](/docs/zh-Hans/reference/cli/gui) | `gui [options]` | 打开本地策略编辑器 GUI |
| [`statusline`](/docs/zh-Hans/reference/cli/statusline) | `statusline --claude-code` | 为 shell 集成打印单行状态指示器 |

`doctor` 也接受别名 `--doctor`。命令名不区分大小写。

## cc-safety-net 全局选项

`--version` 打印已安装的版本，短别名为 `-V`。`--help` 打印用法，短别名为 `-h`。

要查看单个命令的用法，运行 `help <command>` 或 `<command> --help`：

```bash theme={"dark"}
npx cc-safety-net help explain
npx cc-safety-net explain --help
```

## 未知命令的报错

CLI 无法识别的命令会打印 `Unknown command: <name>` 并退出 `1`。以 `-` 开头的名称则打印 `Unknown option: <name>`。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.