# 命令一览

这些命令一般由智能体替你运行。[链接好命令](working-with-agents.md#link)之后，你也可以在终端里自己用。Sediment 没在运行的话，大多数命令都会先把它打开。完整的使用手册是 `sediment help`，内容总是和你装的 Sediment 版本一致。

## 存页面和改页面 {#filing}

| 命令 | 作用 |
|---|---|
| `sediment add <path>` | 把一个 HTML 文件作为新页面加入存放架。用 `--description` 写描述，用 `--tag` 加标签。 |
| `sediment update <id>` | 修改页面的内容（`--content`）、描述（`--description`）、标签（`--tag`、`--untag`）、置顶状态（`--pin`、`--no-pin`）或文件名（`--name`）。只改你指定的部分。 |
| `sediment archive <id>` | 归档页面，和按 <kbd>⇧⌘A</kbd> 一样。 |
| `sediment trash <id>` | 把页面移到废纸篓，和按 <kbd>⌘⌫</kbd> 一样。要先打开**允许智能体将页面移到废纸篓**，否则会被拒绝。 |
| `sediment restore <id>` | 把页面拿回来：从废纸篓回到原来的位置，包括归档库；从归档库回到存放架。 |

页面的 id 来自 `add` 的回复，或者 `find` 的结果。会改动页面的命令一次只接受一个 id，不接受搜索词，所以不会因为搜得太宽而改错页面。

## 找页面 {#finding}

| 命令 | 作用 |
|---|---|
| `sediment find <query>` | 按查询词找出对应的页面和它们的 id。查询词匹配名称，以 `#` 开头就匹配标签。给它页面的链接也能找到。 |
| `sediment find --text <query>` | 连页面里的文字一起搜，和**搜索…**一样。 |
| `sediment find --tag <tag>` | 只列出带某个标签的页面。 |
| `sediment find --untagged` | 列出没有标签的页面。 |
| `sediment find --trash` | 在废纸篓里找。不加这个选项，`find` 不会搜废纸篓。 |
| `sediment tags` | 列出所有标签，以及各自的页面数和含义。 |
| `sediment tags describe <tag> <meaning>` | 给标签写上含义。 |
| `sediment shelf` | 显示存放架文件夹的路径，以及存放架上有多少个页面。 |

## 检查 {#checking}

| 命令 | 作用 |
|---|---|
| `sediment layout <id>` 或 `<path>` | 按 Sediment 显示的方式量一遍页面，还没放上存放架的文件也行：哪些内容比栏宽还宽，哪些字小得看不清，哪些东西会被 Sediment 拦下。什么都不会改动。 |
| `sediment check` | 检查命令、应用、存放架文件夹和你的指引，哪些正常，哪些有问题。 |

## 给智能体用的 {#for-agents}

| 命令 | 作用 |
|---|---|
| `sediment mcp` | 通过 MCP 把存放架的工具提供给桌面应用。应用需要时会自己启动它，用不着你手动运行。 |
| `sediment instructions` | 原样显示存放架的[指引](working-with-agents.md#instructions)。加上 `--content` 和 `--expected-hash`，就用一个文件的内容替换它。具体怎么用，见 `sediment help instructions`。 |

## 帮助 {#help}

| 命令 | 作用 |
|---|---|
| `sediment help` | 使用手册，列出所有命令。 |
| `sediment help <command>` | 某个命令的完整说明。`sediment <command> --help` 也一样。 |
| `sediment help saving` | 按任务查帮助。其他几个是 `finding`、`editing`、`linking` 和 `instructions`。 |

## 所有命令通用的选项 {#options}

| 选项 | 作用 |
|---|---|
| `--json` | 在终端里也用 JSON 回复。输出不是终端时，回复本来就是 JSON。 |
| `--no-launch` | 不启动 Sediment。设置 `SEDIMENT_NO_LAUNCH=1` 效果相同。 |
| `--version` | 显示版本号。 |

命令成功时退出码是 0；失败了、重试也没用时是 1；失败了、重试可能成功时是 2。

## 一个例子 {#example}

```
sediment add ./report.html --description "Traffic for October." --tag analytics
sediment find "#analytics"
sediment update <id> --tag monthly --untag draft
```
