@yoooclaw/cli 0.1.8 → 0.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -305
- package/bin/yc.js +43 -0
- package/package.json +25 -55
- package/LICENSE +0 -21
- package/dist/bin.cjs +0 -14836
- package/dist/bin.cjs.map +0 -115
- package/dist/command-tree.d.ts +0 -40
- package/dist/context.d.ts +0 -19
- package/dist/errors.d.ts +0 -71
- package/dist/index.cjs +0 -14833
- package/dist/index.cjs.map +0 -114
- package/dist/index.d.ts +0 -8
- package/dist/output/format.d.ts +0 -18
- package/dist/paths.d.ts +0 -30
- package/dist/program.d.ts +0 -14
- package/dist/version.d.ts +0 -3
- package/skills/yoooclaw-lightrule-create/SKILL.md +0 -63
- package/skills/yoooclaw-notification-query/SKILL.md +0 -71
- package/skills/yoooclaw-tunnel-debug/SKILL.md +0 -63
package/dist/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare function run(argv?: string[]): Promise<void>;
|
|
2
|
-
export { buildProgram } from "./program.js";
|
|
3
|
-
export { COMMAND_TREE } from "./command-tree.js";
|
|
4
|
-
export { CLI_VERSION } from "./version.js";
|
|
5
|
-
export { ErrorCode, YoooclawError } from "./errors.js";
|
|
6
|
-
export { renderResult, renderError, resolveFormat, type OutputFormat, } from "./output/format.js";
|
|
7
|
-
export { buildContext, resolveActiveProfile, type CliContext, type GlobalFlags, } from "./context.js";
|
|
8
|
-
export * as paths from "./paths.js";
|
package/dist/output/format.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type OutputFormat = "json" | "pretty" | "table" | "ndjson";
|
|
2
|
-
export declare const OUTPUT_FORMATS: OutputFormat[];
|
|
3
|
-
/** 解析用户传入的 --format;`auto` / 缺省时按 TTY 判定。 */
|
|
4
|
-
export declare function resolveFormat(requested: string | undefined, isTty?: boolean): OutputFormat;
|
|
5
|
-
interface RenderOptions {
|
|
6
|
-
format: OutputFormat;
|
|
7
|
-
/** 写出目标,默认 process.stdout。便于测试。 */
|
|
8
|
-
stream?: NodeJS.WritableStream;
|
|
9
|
-
}
|
|
10
|
-
/** 渲染一次成功结果。data 任意结构;table/ndjson 在数组时逐行展开。 */
|
|
11
|
-
export declare function renderResult(data: unknown, opts: RenderOptions): void;
|
|
12
|
-
/**
|
|
13
|
-
* 渲染错误。统一 schema:{ ok: false, error: {...} }。
|
|
14
|
-
* 默认写 stdout —— 与正常输出同一通道,让 `--format json | jq` 等 Agent 管道能读到错误体;
|
|
15
|
-
* 失败由非零退出码表达。
|
|
16
|
-
*/
|
|
17
|
-
export declare function renderError(err: unknown, opts: RenderOptions): void;
|
|
18
|
-
export {};
|
package/dist/paths.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_PROFILE = "default";
|
|
2
|
-
/** CLI 根数据目录。可用 `YOOOCLAW_HOME` 覆盖(测试 / 多实例隔离)。 */
|
|
3
|
-
export declare function rootDir(): string;
|
|
4
|
-
/** account 级共享凭据文件(顶层,跨 profile + 插件共享)。 */
|
|
5
|
-
export declare function sharedCredentialsPath(): string;
|
|
6
|
-
/** 记录当前 active profile 的文本文件。 */
|
|
7
|
-
export declare function activeProfilePath(): string;
|
|
8
|
-
/** 某个 profile 的目录。 */
|
|
9
|
-
export declare function profileDir(profile: string): string;
|
|
10
|
-
export interface ProfilePaths {
|
|
11
|
-
profile: string;
|
|
12
|
-
dir: string;
|
|
13
|
-
config: string;
|
|
14
|
-
credentials: string;
|
|
15
|
-
daemonLock: string;
|
|
16
|
-
daemonLog: string;
|
|
17
|
-
notifications: string;
|
|
18
|
-
recordings: string;
|
|
19
|
-
images: string;
|
|
20
|
-
lightRules: string;
|
|
21
|
-
state: string;
|
|
22
|
-
}
|
|
23
|
-
/** profiles/ 根目录。 */
|
|
24
|
-
export declare function profilesRoot(): string;
|
|
25
|
-
/** 列出已存在的 profile 名(profiles/ 下的目录)。 */
|
|
26
|
-
export declare function listProfileNames(): string[];
|
|
27
|
-
/** 读取 active-profile 文件内容(不存在返回 undefined)。 */
|
|
28
|
-
export declare function readActiveProfile(): string | undefined;
|
|
29
|
-
/** 解析某个 profile 下的全部关键路径。 */
|
|
30
|
-
export declare function profilePaths(profile: string): ProfilePaths;
|
package/dist/program.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 构建 yoooclaw 的 commander 程序。
|
|
3
|
-
*
|
|
4
|
-
* 命令树结构(service / subcommand / shortcut / options)来自 command-tree.ts;
|
|
5
|
-
* 实现体由 commands/registry.ts 按 path(如 `config init`)提供,未注册则回落 notImplemented。
|
|
6
|
-
*/
|
|
7
|
-
import { Command } from "commander";
|
|
8
|
-
import { type CliContext } from "./context.js";
|
|
9
|
-
/** 命令处理器签名:拿到上下文 + commander 解析后的参数/选项,返回可序列化结果。 */
|
|
10
|
-
export type CommandHandler = (ctx: CliContext, args: unknown[], opts: Record<string, unknown>) => unknown;
|
|
11
|
-
/** 注册表的 path key:去掉子命令名里的位置参数占位(`show <id>` → `show`)。 */
|
|
12
|
-
export declare function handlerKey(service: string, subName: string): string;
|
|
13
|
-
/** 构建并返回顶层 commander 程序。 */
|
|
14
|
-
export declare function buildProgram(): Command;
|
package/dist/version.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: yoooclaw-lightrule-create
|
|
3
|
-
description: 用 yoooclaw CLI 创建/管理"通知→灯效"规则。当用户表达"收到/当/如果某类通知或消息时,亮灯/闪灯/变成某种灯效"这类**持久规则**诉求时激活。规则由 daemon 在通知 ingest 后评估命中并触发灯效。需要 daemon 在运行(🟡)。从 stdin 用 --from-file - 提交规则定义最稳妥。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# yoooclaw 灯效规则创建(从 stdin)
|
|
7
|
-
|
|
8
|
-
灯效规则是**持久**的:通知到达后 daemon 评估是否命中,命中则播放灯效。
|
|
9
|
-
和"立即放一次灯效测试"不同(那是 `yoooclaw light send`)。
|
|
10
|
-
|
|
11
|
-
> 需要 daemon 在跑:先 `yoooclaw daemon status`,未运行则 `yoooclaw daemon start`。
|
|
12
|
-
|
|
13
|
-
## 何时激活
|
|
14
|
-
|
|
15
|
-
- "微信群里有人@我时红灯闪三下"
|
|
16
|
-
- "收到老板的消息就亮黄灯"
|
|
17
|
-
- "飞书有新消息时呼吸绿灯"
|
|
18
|
-
- 任何"当 X 通知 → 播放 Y 灯效"的持久化诉求。
|
|
19
|
-
|
|
20
|
-
不要为这类诉求调用 `light send`(那只用于一次性测试/预览)。
|
|
21
|
-
|
|
22
|
-
## 创建规则(首选 --from-file - 从 stdin)
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
cat <<'JSON' | yoooclaw lightrule create --from-file - --format json
|
|
26
|
-
{
|
|
27
|
-
"name": "wechat-at-me",
|
|
28
|
-
"title": "微信@我",
|
|
29
|
-
"description": "微信群里有人@我时红灯快闪",
|
|
30
|
-
"segments": [
|
|
31
|
-
{ "mode": "strobe", "duration_s": 2, "brightness": 255,
|
|
32
|
-
"color": { "r": 255, "g": 0, "b": 0 }, "interval_ms": 200 }
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
JSON
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
字段说明:
|
|
39
|
-
|
|
40
|
-
- `name`(必填):规则唯一标识。
|
|
41
|
-
- `description`(必填):自然语言意图,daemon 的 webhook 评估器据此判断通知是否命中。
|
|
42
|
-
- `segments`(必填):命中后播放的灯效,遵循 light protocol(mode/duration_s/brightness/color/interval_ms 等)。
|
|
43
|
-
- 也可用 flag 形式:`--name --intent <描述> --light-action <segments JSON> --match-rules <硬过滤 JSON>`。
|
|
44
|
-
|
|
45
|
-
## 管理
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
yoooclaw lightrule list --format json # 列出全部规则及 enabled 状态
|
|
49
|
-
yoooclaw lightrule show <name> --format json # 单条详情
|
|
50
|
-
yoooclaw lightrule disable <name> # 停用(不删除)
|
|
51
|
-
yoooclaw lightrule enable <name> # 启用
|
|
52
|
-
yoooclaw lightrule +off # 停用所有
|
|
53
|
-
yoooclaw lightrule +on # 启用所有
|
|
54
|
-
yoooclaw lightrule delete <name> --yes # 删除
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## 错误处理
|
|
58
|
-
|
|
59
|
-
- `YOOOCLAW_DAEMON_NOT_RUNNING`:先 `yoooclaw daemon start` 再重试。
|
|
60
|
-
- 创建失败通常表现为 `YOOOCLAW_INVALID_ARGUMENT`,`error.message` 中会带底层
|
|
61
|
-
`VALIDATION_FAILED`(segments 不合法)或 `INVALID_PARAMS`(缺 name/description);
|
|
62
|
-
按具体校验项修正 JSON 后重新提交。
|
|
63
|
-
- 规则名重复:换 `name` 或先 `delete`。
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: yoooclaw-notification-query
|
|
3
|
-
description: 用 yoooclaw CLI 直接、流式地查询手机通知原始数据。当用户说"看看最近的通知""谁找过我""总结今天的消息""某 App 有什么通知""昨天有什么消息"或任何通知查询/筛选/汇总诉求时,激活本 Skill,基于当前磁盘最新数据查询,不要依赖先前轮次或记忆。yoooclaw 是 openclaw 手机通知插件的独立 CLI 形态,数据在 ~/.yoooclaw 下,纯读磁盘、不需要 daemon 在跑。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# yoooclaw 通知查询(Agent-Native,流式)
|
|
7
|
-
|
|
8
|
-
`yoooclaw` CLI 自身就是工具表:所有命令都支持 `--format json|pretty|table|ndjson`。
|
|
9
|
-
**Agent 消费首选 `--format ndjson`**——每条通知一行 JSON、无包裹数组,便于流式逐条处理大批量结果。
|
|
10
|
-
|
|
11
|
-
> 命令名 `yoooclaw`,短别名 `yc` 完全等价。下文用 `yoooclaw`。
|
|
12
|
-
|
|
13
|
-
## 何时激活
|
|
14
|
-
|
|
15
|
-
- "最近收到什么消息 / 谁找过我 / 某某给我发过什么"
|
|
16
|
-
- "总结今天 / 昨天 / 最近一小时的通知"
|
|
17
|
-
- "微信 / 飞书 有什么通知"
|
|
18
|
-
- 任何按 时间 / 应用 / 发送人 / 关键词 筛选通知的诉求
|
|
19
|
-
|
|
20
|
-
## 先确认存储路径(不要假设目录)
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
yoooclaw notification storage-path --format json
|
|
24
|
-
# → {"ok":true,"path":"/abs/path/to/profiles/<profile>/notifications"}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## 查询(按需选参数)
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
# 今日全部(快捷命令,等价 search --from 今日00:00 --to 今日23:59)
|
|
31
|
-
yoooclaw notification +today --format ndjson
|
|
32
|
-
|
|
33
|
-
# 最近一小时
|
|
34
|
-
yoooclaw notification +recent --format ndjson
|
|
35
|
-
|
|
36
|
-
# 精确筛选:时间范围 + 应用 + 关键词
|
|
37
|
-
yoooclaw notification search \
|
|
38
|
-
--from 2026-05-01T00:00:00+08:00 --to 2026-05-21T23:59:59+08:00 \
|
|
39
|
-
--app 微信 --keyword 开会 --limit 200 --format ndjson
|
|
40
|
-
|
|
41
|
-
# 聚合摘要(topApps / topSenders / 最近样例),适合"帮我总结"
|
|
42
|
-
yoooclaw notification summary --top 10 --sample 30 --format json
|
|
43
|
-
|
|
44
|
-
# 维度统计(date|app|sender|hour|client|all)
|
|
45
|
-
yoooclaw notification stats --from 2026-05-14 --to 2026-05-21 --dim all --format json
|
|
46
|
-
yoooclaw notification stats --from 2026-05-21T00:00:00+08:00 --to 2026-05-21T23:59:59+08:00 --sender 张三 --dim sender --format json
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
- `--app` 支持中英文别名:`微信/wechat`、`飞书/feishu/lark`、`钉钉/dingtalk`、`企业微信/wecom` 等。
|
|
50
|
-
- `search` / `summary` 的 `--from/--to` 用 ISO 8601 含时区(`2026-05-01T09:00:00+08:00`)。`stats` 的 `--from/--to` 支持 `YYYY-MM-DD` 或 ISO 8601。
|
|
51
|
-
|
|
52
|
-
## 流式处理 ndjson 的样板
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
yoooclaw notification search --app 微信 --format ndjson | while IFS= read -r line; do
|
|
56
|
-
# 每行是一条 StoredNotification:{appName,appDisplayName,title,content,timestamp,senderName,conversationType,...}
|
|
57
|
-
echo "$line" | jq -r '"\(.timestamp) \(.appDisplayName // .appName) | \(.senderName // .title): \(.content)"'
|
|
58
|
-
done
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## 错误处理
|
|
62
|
-
|
|
63
|
-
所有命令失败都输出统一 schema 并以非零退出码结束:
|
|
64
|
-
|
|
65
|
-
```json
|
|
66
|
-
{ "ok": false, "error": { "code": "YOOOCLAW_...", "message": "...", "hint": "..." } }
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
- `YOOOCLAW_INVALID_ARGUMENT`:时间格式 / `--conversation-type`(只能 group|private)/ `--limit` 非正整数 → 按 `message` 修正参数。
|
|
70
|
-
- 通知目录尚不存在或当天无数据:`search` 返回 `[]`、`+today` 返回 `[]`,**不是错误**——直接据此回复"暂无通知"。
|
|
71
|
-
- 多 profile:加 `--profile <name>` 查指定 profile 的数据。
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: yoooclaw-tunnel-debug
|
|
3
|
-
description: 用 yoooclaw CLI 排查手机端推送链路是否通。当用户说“手机推送收不到”“通知没同步过来”“检查一下隧道/连接”“daemon 还活着吗”“手机连不上”时激活。组合使用 auth status / daemon status / tunnel status / tunnel +test / gateway test / daemon logs 定位本地配置、daemon、本地 ingest 鉴权与 Relay WebSocket 状态。多数命令需要 daemon 在运行(🟡)。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# yoooclaw Relay / 接收链路排查
|
|
7
|
-
|
|
8
|
-
独立 daemon 默认用 account api-key 连接托管 Relay WebSocket,手机 App 绑定同一账号后经 Relay 收发。也可以在 Relay 未启用或不可用时,将 `POST /notifications` 通过用户自建 `cloudflared` / `tailscale serve` 暴露为直连 HTTP fallback。
|
|
9
|
-
|
|
10
|
-
## 排查顺序
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
# 1) 本地凭据是否存在;不调 daemon
|
|
14
|
-
yoooclaw auth status --format json
|
|
15
|
-
|
|
16
|
-
# 2) daemon 是否在跑、监听哪个地址端口
|
|
17
|
-
yoooclaw daemon status --format json
|
|
18
|
-
# 未运行 → yoooclaw daemon start --format json
|
|
19
|
-
|
|
20
|
-
# 3) Relay 模式、连接状态、URL、多隧道状态
|
|
21
|
-
yoooclaw tunnel status --format json
|
|
22
|
-
|
|
23
|
-
# 4) daemon 本地回环:验证本地 ingest + 鉴权
|
|
24
|
-
yoooclaw tunnel +test --format json
|
|
25
|
-
|
|
26
|
-
# 5) 模拟手机端直接调本地 /notifications
|
|
27
|
-
yoooclaw gateway test --format json
|
|
28
|
-
|
|
29
|
-
# 6) 看 Relay 连接与重连日志
|
|
30
|
-
yoooclaw daemon logs --lines 200 --format json
|
|
31
|
-
yoooclaw log +errors --format json
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
`tunnel +test` 会让 daemon 给本地 `/notifications` 发一条 echo 通知。它可以确认本地 ingest + 鉴权链路,但不会让流量真正绕行远端 Relay。`gateway test --via-relay` 当前也是复用这条本地回环路径,不应单独作为远端 Relay 可达性的证据。
|
|
35
|
-
|
|
36
|
-
## 判读
|
|
37
|
-
|
|
38
|
-
- `auth status` 中 api-key 不存在:先用 `yoooclaw auth set-api-key -` 从 stdin 设置,再启动或 reload daemon。
|
|
39
|
-
- `daemon status` 报 `YOOOCLAW_DAEMON_NOT_RUNNING`:运行 `yoooclaw daemon start`。
|
|
40
|
-
- `tunnel status` 的 `mode=relay` 且 `connected=true`:daemon 当前已连上 Relay WebSocket。
|
|
41
|
-
- `tunnel status` 的 `mode=relay` 但 `connected=false`:结合 `lastDisconnectReason`、`reconnectAttempt` 和 daemon 日志排查 api-key、网络与 Relay 服务。
|
|
42
|
-
- `tunnel status` 的 `mode=standalone-http`:当前没有 Relay 隧道;按返回的 `note` 检查 `relay.enabled` 和 api-key。只有明确采用直连 fallback 时才检查防火墙、反代和手机端地址。
|
|
43
|
-
- `tunnel +test` 或 `gateway test` 失败:先排查本地 gateway token。运行 `yoooclaw auth status`,必要时 `yoooclaw auth token-rotate`;daemon 已运行时随后执行 `yoooclaw daemon restart`。
|
|
44
|
-
|
|
45
|
-
## 多 clientLabel
|
|
46
|
-
|
|
47
|
-
多 api-key 模式下,每个 label 对应一条 Relay 隧道。按 label 缩小排查范围:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
yoooclaw auth list-api-keys --format json
|
|
51
|
-
yoooclaw tunnel status --client work --format json
|
|
52
|
-
yoooclaw tunnel +test --client work --format json
|
|
53
|
-
yoooclaw tunnel reconnect --client work --format json
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## 鉴权检查
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
yoooclaw auth status --format json
|
|
60
|
-
yoooclaw auth check --format json
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
`auth status` 只读本地凭据与 daemon lock。`auth check` 会用本地 gateway token 调 daemon `/daemon/status`,用于确认 CLI 和 daemon 的 token 是否一致。
|