> For AI agents: the complete documentation index is available at /annealer/zh/llms.txt, the full documentation bundle is available at /annealer/zh/llms-full.txt.

# CLI

```text
anyl [OPTIONS] [FILES]...
```

格式化每个文件并输出结果。未指定文件时从标准输入读取。

## 选项

| 选项                            | 说明                                                                            |
| ----------------------------- | ----------------------------------------------------------------------------- |
| `-w`, `--write`               | 直接覆盖文件。不能与 `--check` 同时使用。                                                    |
| `-c`, `--check`               | 输出会被修改的文件路径；只要有一个文件会被修改，就以状态码 1 退出。                                           |
| `-p`, `--profile <PROFILE>`   | 内置配置文件名（`html`、`vue`）或配置文件 YAML 的路径。默认使用与各文件语言对应的内置配置文件。                      |
| `--class-order <CLASS_ORDER>` | 对静态 `class` 属性中的类排序：内置类顺序名（`tailwind`）或类顺序 YAML 文件的路径。会覆盖配置文件中的 `classOrder`。 |
| `-l`, `--language <LANGUAGE>` | 标准输入的语言：`html`（默认）、`vue`、`css`、`scss`、`sass`、`less`。                          |
| `-h`, `--help`                | 显示帮助。                                                                         |
| `-V`, `--version`             | 显示版本。                                                                         |

## 语言

文件的语言由扩展名决定：

| 扩展名                               | 语言     | 默认配置文件                    |
| --------------------------------- | ------ | ------------------------- |
| `.html`, `.htm`                   | `html` | `html`                    |
| `.vue`                            | `vue`  | `vue`                     |
| `.css`, `.scss`, `.sass`, `.less` | 样式表    | `html`（其 `stylesheet` 部分） |

其他扩展名会被报告为不支持。

## 退出码

| 代码  | 含义                                                 |
| --- | -------------------------------------------------- |
| `0` | 成功。使用 `--check` 时：没有文件会被修改。                        |
| `1` | 使用 `--check` 时：至少有一个文件会被修改。                        |
| `2` | 错误：文件无法读取、文件类型不支持、配置文件无效、输入无效或未知的 `annealer-*` 指令。 |

指定多个文件时，annealer 会格式化所有文件并逐一报告错误；只要有一个失败，就以 `2` 退出。

## 示例

```bash
anyl src/App.vue                          # 输出结果
anyl --write src/**/*.vue                 # 直接覆盖
anyl --check index.html                   # 在 CI 中使用
anyl --profile my-profile.yaml page.html  # 自定义配置文件
anyl --class-order tailwind src/**/*.vue  # 对 Tailwind 类排序
cat App.vue | anyl --language vue         # 标准输入
```
