ReMe/docs/zh/reference/cli.md
jinliyl d865776edd
Some checks are pending
CI / Python packages / Build and verify distributions (push) Waiting to run
CI / Python quality / GitHub Actions (push) Waiting to run
CI / Python quality / Pre-commit (push) Waiting to run
CI / Python tests / Unit Tests - py3.11 (push) Waiting to run
CI / Python tests / Unit Tests - py3.13 (push) Waiting to run
CI / Python tests / Unit Tests - py3.14 (push) Waiting to run
CI / Windows / CLI smoke - py3.11 (push) Waiting to run
Deploy / Documentation / Build documentation (push) Waiting to run
CI and Release / Docker / Publish multi-platform tags (push) Blocked by required conditions
Security / CodeQL / Analyze javascript-typescript (push) Waiting to run
Security / CodeQL / Analyze python (push) Waiting to run
CI / Python tests / Unit Tests - py3.12 (push) Waiting to run
CI / ReMe Studio / Studio checks (push) Waiting to run
Deploy / Documentation / deploy (push) Blocked by required conditions
CI and Release / Docker / Build and test / amd64 (push) Waiting to run
CI and Release / Docker / Build and test / arm64 (push) Waiting to run
docs: recommend two-stage service usage across guides (#620)
2026-10-15 11:41:17 +08:00

99 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: CLI 参考
description: ReMe 命令行语法、服务调用、配置覆盖与插件命令。
---
# CLI 参考
ReMe 的基本语法是:
```text
reme ACTION key=value ...
```
## 启动应用
默认采用两阶段:在一个终端启动服务,再在另一个终端调用 Job。以下启动命令任选一条,并保持运行:
```bash
reme start
reme start config=demo
reme start workspace_dir=/data/reme service.port=8181
```
普通 `start` 启动配置中的 Service;省略 `config` 时使用 `default`,需要其他配置时再显式指定。
## 调用 Job
在另一个终端调用,Action 名就是 Job 名;CLI 会发现正在运行的服务配置:
```bash
reme help
reme health_check
reme search query="项目决策" limit=10
reme read path=digest/wiki/project.md start_line=1 end_line=80
```
复杂值使用 JSON:
```bash
reme auto_memory \
session_id=example \
messages='[{"role":"user","content":"记住这条偏好"}]'
```
服务选择参数 `backend`、`transport`、`host`、`port`、`timeout`、`command`、`args` 和 `show_metadata` 只用于构造客户端,不会泄漏到 Job 参数。
## 配置覆盖
```bash
reme start \
config=/path/to/custom.yaml \
service.port=8181 \
service.web_enabled=false \
plugins='["auto-fin"]'
```
参数前的 `-` 或 `--` 可以省略。嵌套键使用点号,数组和对象使用 JSON。
## 服务发现
```bash
reme find_reme
```
成功时输出可复用的服务信息;找不到服务时不会自动启动新进程。
## 插件命令
插件包管理是本地命令,不经过 HTTP 或 MCP:
```bash
reme plugins list
reme plugins show auto-fin
reme plugins validate auto-fin
reme plugins install plugins/auto-fin
reme plugins uninstall auto-fin
```
完整说明见[插件管理](../plugin_management.md)。
## 发现当前能力
默认 Job 参数见 [Job API 参考](./jobs.md)。运行配置可能由插件和自定义 YAML 改变,因此自动化程序应优先调用:
```bash
reme help
reme app_config
```
## 无服务单次执行
脚本需要执行一个 Job 后退出时,可以使用一次性 CLI Service:
```bash
reme start config=default job=search query="关键词" limit=5
```
`start job=<name>` 通过正常应用生命周期在本地运行 Job,然后退出;它不会调用已经运行的服务。
常规交互示例采用上面的两阶段流程。