work-rhythm 0.1.2 → 0.1.4

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.
@@ -11,12 +11,7 @@ const fs = require('node:fs');
11
11
  const path = require('node:path');
12
12
  const { EXIT, addDays, today, writeFileAtomic } = require('../lib/run');
13
13
 
14
- const USAGE = `用法: work-rhythm decisions <子命令>
15
- add --item <事项> [--options <选项>] --choice <决定> [--reason <理由>] [--by <我|AI|一起>] [--date <YYYY-MM-DD>]
16
- answer <事项> <决定> [--reason <理由>] [--by <我|AI|一起>]
17
- done <事项> <落实>
18
- list [天数] [--today]
19
- archive [天数]`;
14
+
20
15
 
21
16
  const KEEP_DAYS = 60;
22
17
  const COLUMNS = ['日期', '事项', '选项', '决定', '理由', '谁来做', '落实'];
@@ -112,6 +107,22 @@ function parseFlags(args, names) {
112
107
  return { opts, positional };
113
108
  }
114
109
 
110
+ const USAGE = `work-rhythm decisions <子命令> —— 待决与决定的记录(03-carryover/DECISIONS.md)。它只是以后的参考,不替我决定
111
+
112
+ 用法:
113
+ work-rhythm decisions add --item <事项> [--options <选项>] --choice <决定> [--reason <理由>] [--by <我|AI|一起>] [--date <YYYY-MM-DD>]
114
+ 记一条。事项不超过 30 字、不含竖线;「待决询问」刚问出去还没答时 --choice 写「未答」
115
+ work-rhythm decisions answer <事项> <决定> [--reason <理由>] [--by <我|AI|一起>]
116
+ 我答了之后,把最近一条还没答的改成我的决定
117
+ work-rhythm decisions done <事项> <落实>
118
+ 补「落实」那一格:只补最近一条还没写的
119
+ work-rhythm decisions list [天数] [--today]
120
+ 看记录(TSV),默认最近 60 天,要更早的就连归档一起查;--today 只看今天的
121
+ work-rhythm decisions archive [天数]
122
+ 把超过天数(默认 60)的行挪进 03-carryover/archive/
123
+ 问之前先 list,有类似的决定就带一句「上次是这么定的」。
124
+ 退出码: 0;2 参数不对、事项不合规、找不到那一条、没有待答的记录;3 不在工作目录里。`;
125
+
115
126
  module.exports = {
116
127
  usage: USAGE,
117
128
  archive,
@@ -0,0 +1,103 @@
1
+ // 列出每日文件里的事件流:agent 要「基于事件流干事儿」「问问最近在忙什么」时,先从这里拿数据,不用自己翻一堆 Markdown
2
+ // 读的是 02-daily/YYYY-MM/YYYY-MM-DD.md 里「## 事件流」那张表(docs/formats.md),只读不改
3
+ 'use strict';
4
+ const fs = require('node:fs');
5
+ const path = require('node:path');
6
+ const { EXIT, UsageError, parseDate, addDays, today, fmtDate } = require('../lib/run');
7
+
8
+ const USAGE = `work-rhythm events [选项] —— 列出每日文件「## 事件流」里的事件(什么时候、做了什么、属于哪个项目),只读
9
+
10
+ 用法:
11
+ work-rhythm events 最近 7 天(含今天)
12
+ work-rhythm events --today 只看今天
13
+ work-rhythm events --days 14 最近 14 天
14
+ work-rhythm events --from 2026-11-20 --to 2026-11-30
15
+ work-rhythm events --type 会议,沟通 只看这些类型(词表见 docs/formats.md 的「事件类型」)
16
+ work-rhythm events --source calendar-yzj 只看这些来源(订阅源的 id,或「口述」)
17
+ work-rhythm events --project 导出 只看这些项目标签(和长期目标相关的事件,项目列是目标 id)
18
+ work-rhythm events --json 每条一个对象,给程序读
19
+ 输出是 TSV(制表符分隔),第一行表头 date、time、type、item、source、project,按日期、时间排好序。
20
+ 事件是「一行一事」的记录,不含细节;要细节看 01-inbox/ 的快照或问用户。
21
+ 退出码: 0(没有事件也是 0,只有表头);2 选项或日期不对;3 不在工作目录里。`;
22
+
23
+ const FIELDS = ['date', 'time', 'type', 'item', 'source', 'project'];
24
+ const COLUMNS = { 时间: 'time', 类型: 'type', 事项: 'item', 来源: 'source', 项目: 'project' };
25
+
26
+ // 「## 事件流」那一节里的表:表头给出列名,分隔线跳过。格子里转义的竖线先换成占位符再切。后面几格缺的留空
27
+ function parseEvents(markdown, date) {
28
+ const lines = String(markdown).split('\n');
29
+ const start = lines.findIndex((l) => /^##\s*事件流\s*$/.test(l));
30
+ if (start < 0) return [];
31
+ const events = [];
32
+ let columns = null;
33
+ for (let i = start + 1; i < lines.length && !/^##\s/.test(lines[i]); i += 1) {
34
+ const line = lines[i].trim();
35
+ if (!line.startsWith('|')) continue;
36
+ const cells = line.replace(/\\\|/g, '\u0000').split('|').slice(1, -1).map((c) => c.trim().replace(/\u0000/g, '|'));
37
+ if (!cells.length || cells.every((c) => /^:?-+:?$/.test(c))) continue;
38
+ if (!columns) {
39
+ columns = cells.map((name) => COLUMNS[name] || '');
40
+ continue;
41
+ }
42
+ // 至少要有时间和类型两格;只有一格的(写坏的行、夹在表里的说明)不算事件
43
+ if (cells.length < 2) continue;
44
+ const event = { date, time: '', type: '', item: '', source: '', project: '' };
45
+ columns.forEach((field, n) => {
46
+ if (field) event[field] = cells[n] || '';
47
+ });
48
+ if (event.time) events.push(event);
49
+ }
50
+ return events;
51
+ }
52
+
53
+ function readDay(root, date) {
54
+ try {
55
+ return parseEvents(fs.readFileSync(path.join(root, '02-daily', date.slice(0, 7), `${date}.md`), 'utf8'), date);
56
+ } catch {
57
+ return [];
58
+ }
59
+ }
60
+
61
+ const parseList = (value) => String(value || '').split(',').map((s) => s.trim()).filter(Boolean);
62
+
63
+ async function run(args, ctx) {
64
+ const { root, stdout } = ctx;
65
+ const opts = { from: '', to: today(), days: 7, types: [], sources: [], projects: [], json: false };
66
+ for (let i = 0; i < args.length; i += 1) {
67
+ const a = args[i];
68
+ const value = (what) => {
69
+ const v = args[i + 1];
70
+ if (v === undefined || v.startsWith('--')) throw new UsageError(`${a} 后面要跟一个值(${what})`);
71
+ i += 1;
72
+ return v;
73
+ };
74
+ if (a === '--today') opts.days = 1;
75
+ else if (a === '--days') {
76
+ const n = Number(value('天数'));
77
+ if (!Number.isInteger(n) || n < 1) throw new UsageError('--days 要是正整数');
78
+ opts.days = n;
79
+ } else if (a === '--from') opts.from = fmtDate(parseDate(value('YYYY-MM-DD'), '起始日期'));
80
+ else if (a === '--to') opts.to = fmtDate(parseDate(value('YYYY-MM-DD'), '结束日期'));
81
+ else if (a === '--type') opts.types = parseList(value('类型,逗号分隔'));
82
+ else if (a === '--source') opts.sources = parseList(value('来源 id,逗号分隔'));
83
+ else if (a === '--project') opts.projects = parseList(value('项目标签,逗号分隔'));
84
+ else if (a === '--json') opts.json = true;
85
+ else throw new UsageError(`不认识的选项 ${a}`);
86
+ }
87
+ const from = opts.from || addDays(opts.to, -(opts.days - 1));
88
+ if (from > opts.to) throw new UsageError(`起始日期 ${from} 晚于结束日期 ${opts.to}`);
89
+ let list = [];
90
+ for (let d = from; d <= opts.to; d = addDays(d, 1)) list.push(...readDay(root, d));
91
+ const keep = (event, wanted, field) => !wanted.length || wanted.includes(event[field]);
92
+ list = list.filter((e) => keep(e, opts.types, 'type') && keep(e, opts.sources, 'source') && keep(e, opts.projects, 'project'));
93
+ list.sort((a, b) => (a.date < b.date ? -1 : a.date > b.date ? 1 : a.time.localeCompare(b.time)));
94
+ if (opts.json) {
95
+ stdout.write(`${JSON.stringify(list)}\n`);
96
+ return EXIT.OK;
97
+ }
98
+ stdout.write(`${FIELDS.join('\t')}\n`);
99
+ for (const e of list) stdout.write(`${[e.date, e.time, e.type, e.item.replace(/\t/g, ' '), e.source, e.project].join('\t')}\n`);
100
+ return EXIT.OK;
101
+ }
102
+
103
+ module.exports = { usage: USAGE, run, parseEvents };
@@ -7,9 +7,8 @@
7
7
  'use strict';
8
8
  const fs = require('node:fs');
9
9
  const path = require('node:path');
10
- const { EXIT, noon, today, daysBetween, readText, writeFileAtomic } = require('../lib/run');
10
+ const { EXIT, UsageError, noon, today, daysBetween, readText, writeFileAtomic } = require('../lib/run');
11
11
 
12
- const USAGE = '用法: work-rhythm goals list | due [日期] | touch <id> [日期] | progress <id> [日期]';
13
12
  const HEADER_LIST = 'id\tstatus\ttitle\tsince_review\tsince_progress';
14
13
  const HEADER_DUE = 'id\ttitle\tsince_review\treview_every';
15
14
 
@@ -88,6 +87,16 @@ const goalFiles = (root) => {
88
87
  return names.map((n) => path.join(dir, n));
89
88
  };
90
89
 
90
+ const USAGE = `work-rhythm goals list | due [日期] | touch <id> [日期] | progress <id> [日期] —— 长期目标的小工具(目标文件在 05-goals/<id>.md)
91
+
92
+ 用法:
93
+ work-rhythm goals list 进行中和暂停的目标,带距上次检查、距上次进展的天数
94
+ work-rhythm goals due [YYYY-MM-DD] 今天(或指定那天)该检查的目标:距上次检查超过 review_every 天的
95
+ work-rhythm goals touch <id> [YYYY-MM-DD] 检查完之后,只改 last_review
96
+ work-rhythm goals progress <id> [YYYY-MM-DD] 有进展之后,只改 last_progress
97
+ 输出是 TSV(制表符分隔),第一行表头。日期默认今天。到期与否由这里算,不要手算日期。
98
+ 退出码: 0;2 子命令、id 或日期不对;3 不在工作目录里。`;
99
+
91
100
  module.exports = {
92
101
  usage: USAGE,
93
102
  async run(args, ctx) {
@@ -105,10 +114,7 @@ module.exports = {
105
114
  }
106
115
  if (cmd === 'due') {
107
116
  const date = rest[0] || today();
108
- if (!noon(date)) {
109
- stderr.write(`goals: 无法识别日期 '${date}'\n`);
110
- return EXIT.USAGE;
111
- }
117
+ if (!noon(date)) throw new UsageError(`无法识别日期 '${date}'`);
112
118
  stdout.write(`${HEADER_DUE}\n`);
113
119
  for (const f of goalFiles(root)) {
114
120
  if (field(f, 'status') !== 'active') continue;
@@ -122,24 +128,14 @@ module.exports = {
122
128
  }
123
129
  if (cmd === 'touch' || cmd === 'progress') {
124
130
  const [id, dateArg] = rest;
125
- if (!id) {
126
- stderr.write(`用法: work-rhythm goals ${cmd} <id> [日期]\n`);
127
- return EXIT.USAGE;
128
- }
131
+ if (!id) throw new UsageError(`goals ${cmd} 要写 <id>:work-rhythm goals ${cmd} <id> [日期]`);
129
132
  const date = dateArg || today();
130
133
  const file = path.join(root, '05-goals', `${id}.md`);
131
- if (!fs.existsSync(file)) {
132
- stderr.write(`goals: 找不到 05-goals/${id}.md\n`);
133
- return EXIT.USAGE;
134
- }
135
- if (!noon(date)) {
136
- stderr.write(`goals: 无法识别日期 '${date}'\n`);
137
- return EXIT.USAGE;
138
- }
134
+ if (!fs.existsSync(file)) throw new UsageError(`找不到 05-goals/${id}.md`);
135
+ if (!noon(date)) throw new UsageError(`无法识别日期 '${date}'`);
139
136
  setField(file, cmd === 'touch' ? 'last_review' : 'last_progress', date);
140
137
  return EXIT.OK;
141
138
  }
142
- stderr.write(`${USAGE}\n`);
143
- return EXIT.USAGE;
139
+ throw new UsageError(`不认识的子命令「${cmd}」,只有 list / due / touch / progress`);
144
140
  },
145
141
  };
@@ -11,7 +11,13 @@ const { EXIT, Fail, UsageError } = require('../lib/run');
11
11
  const { register } = require('../lib/workdir');
12
12
  const { writeWorkdir } = require('../lib/template');
13
13
 
14
- const USAGE = '用法: work-rhythm init <目录>';
14
+ const USAGE = `work-rhythm init <目录> —— 新建一个工作目录:用包里带的模板铺出来(个人信息空白、数据源全关、没有记录),并登记
15
+
16
+ 用法:
17
+ work-rhythm init ~/workspace/my-work
18
+ work-rhythm init my-work 相对路径按当前目录算;上级目录没有就一起建
19
+ 建好之后对 AI 说「开始引导」。工作目录只是机器上的一个目录:不 git init,不同步到任何仓库。
20
+ 退出码: 0 建好;2 用法不对,或目录已经存在(拿它当工作目录用 work-rhythm workdir register);5 包不完整或铺出来的不是空白的(会把建了一半的目录删掉)。`;
15
21
 
16
22
  module.exports = {
17
23
  usage: USAGE,
@@ -11,7 +11,9 @@ const { settings } = require('../lib/config');
11
11
  const { createBot } = require('../lib/bot');
12
12
  const launchd = require('../lib/launchd');
13
13
 
14
- const USAGE = `用法: work-rhythm listen <子命令>
14
+ const USAGE = `work-rhythm listen <子命令> —— 值守:消息渠道的收消息一半。在 IM 里说的话交给绑定的 agent 处理,回复发回来
15
+
16
+ 用法: work-rhythm listen <子命令>
15
17
  probe [--seconds N] 连上去看握手和收到的每一帧,不调 agent,到时退出(默认 60 秒)。第一次验证用
16
18
  run 值守:一直连着,收到消息就处理
17
19
  handle "<消息>" 不连云之家,只走一遍「交给 agent → 打印回复」,调试 agent 配置
@@ -19,7 +21,10 @@ const USAGE = `用法: work-rhythm listen <子命令>
19
21
  reset 丢掉机器人的专属会话,下一句从新会话开始(在聊天里发 /new 也一样)
20
22
  doctor 检查值守的配置和依赖,有问题逐条报出来
21
23
  install | uninstall | status macOS launchd 常驻:开机自启、挂了拉起
22
- 退出码: 0 完成;2 用法不对;3 没配置好;4 缺依赖;5 连不上或没处理成功。详见 lib/bot.js 的文件头和 docs/channels.md`;
24
+ 前提:先绑 agent(work-rhythm agent bind),没绑就没有值守。消息一到先回「收到,正在处理」,agent 的回答随后到。
25
+ 日志 01-inbox/_bot.log 只记时间、msgId、耗时,不记消息内容。
26
+ 退出码: 0 完成;2 用法不对;3 没配置好(没绑 agent、钥匙串里没有地址、不是 yzj-robot 渠道);4 缺依赖;5 连不上或没处理成功。
27
+ 步骤见 docs/channels.md「收消息:值守」。`;
23
28
 
24
29
  const positiveInt = (value, fallback) => {
25
30
  const n = Number(value);
@@ -14,7 +14,15 @@ const { EXIT, Fail, UsageError } = require('../lib/run');
14
14
  const { settings } = require('../lib/config');
15
15
  const { pushText, notifyChannel } = require('../lib/notify');
16
16
 
17
- const USAGE = '用法: work-rhythm notify "<文字>" 或 … | work-rhythm notify -';
17
+ const USAGE = `work-rhythm notify "<文字>" 或 … | work-rhythm notify - —— 把一段文字经消息渠道推给我本人(渠道写在 profile 的 preferences.notify)
18
+
19
+ 用法:
20
+ work-rhythm notify "今天的重点三件" 文字直接给
21
+ … | work-rhythm notify - 文字从标准输入读(计划、复盘这类多行的用它)
22
+ 只发纯文本,只发给我本人;云之家机器人每分钟最多 30 条。状态和信息写到标准错误,标准输出不留东西。
23
+ 退出码: 0 已发出(渠道留空时什么都不发,也是 0);2 用法不对或渠道不认识;3 没配置好(钥匙串里没有地址、取不到我的 openId);
24
+ 4 缺 security;5 发送失败(网络、接口拒绝)。
25
+ 定时任务由本地服务代为推送时(指令末尾注明了「会替你推送」),不要再自己发。发消息前要先问用户。渠道怎么开通见 docs/channels.md。`;
18
26
 
19
27
  async function readStdin(stream) {
20
28
  const chunks = [];
@@ -13,7 +13,13 @@ const { NAME, VERSION } = require('../cli');
13
13
  // npm 给 tgz 起的名字:去掉 @、把 / 换成 -,再接版本号(work-rhythm@0.1.0 → work-rhythm-0.1.0.tgz)
14
14
  const TGZ = `${NAME.replace(/^@/, '').replace('/', '-')}-${VERSION}.tgz`;
15
15
 
16
- const USAGE = '用法: work-rhythm pack [--out <目录>]';
16
+ const USAGE = `work-rhythm pack [--out <目录>] —— 把 skill 和这个包打成可分发的目录,给不用 npm 的人
17
+
18
+ 用法:
19
+ work-rhythm pack 生成 01-inbox/outbox/work-rhythm-skill-<版本>/(站在工作目录里时)
20
+ work-rhythm pack --out <目录> 放到指定目录
21
+ 里面是 work-rhythm/(skill)、给人看的安装说明、VERSION、这个包的 tgz;本机有 zip 再压一份 .zip。
22
+ 退出码: 0;2 用法不对;3 这个包不完整;4 缺 npm;5 npm pack 或写入失败。`;
17
23
 
18
24
  // VERSION 文件:包的版本,加上它来自哪个提交(工作区有没提交的改动时如实标出来)
19
25
  function versionNote(packageRoot, env) {
@@ -11,7 +11,9 @@ const { EXIT, Fail, UsageError } = require('../lib/run');
11
11
  const { settings } = require('../lib/config');
12
12
  const { createRhythm } = require('../lib/rhythm');
13
13
 
14
- const USAGE = `用法: work-rhythm rhythm <子命令>
14
+ const USAGE = `work-rhythm rhythm <子命令> —— 本地服务:定时采集、定时把任务交给 agent 整理、经消息渠道推送、本机网页
15
+
16
+ 用法: work-rhythm rhythm <子命令>
15
17
  start [--tick 秒] 前台跑:到点跑采集和任务,起网页服务。要常驻用 install;--tick 是多久看一次表(默认 20,调试用)
16
18
  stop | status 停掉;看在不在跑、下次什么时候跑什么
17
19
  due [--at 时间] [--days 天数] 从某个时间起,列出什么时候跑什么
@@ -20,7 +22,10 @@ const USAGE = `用法: work-rhythm rhythm <子命令>
20
22
  render <文件.md> 把一份 Markdown 渲染成页面,打到标准输出(自测、调试用)
21
23
  doctor 检查配置和依赖,有问题逐条报出来
22
24
  install | uninstall macOS launchd 常驻:开机自启、挂了拉起
23
- 退出码: 0 完成;2 用法不对;3 没配置好;4 缺依赖;5 运行失败。详见 lib/rhythm.js 的文件头和 docs/scheduled-tasks.md`;
25
+ 定时任务只建在这个服务上,要先绑 agent(work-rhythm agent bind)。任务到点后:把 tasks/<id>.md 的指令交给 agent 跑一遍
26
+ (它会同步数据、整理事件流、写每日文件),agent 最后写的总结经消息渠道推给我,并附本机页面地址。
27
+ 退出码: 0 完成;2 用法不对;3 没配置好(没绑 agent、配置有问题、已经在跑);4 缺依赖;5 运行失败;doctor 查出问题时是 1。
28
+ 定义和用法见 docs/scheduled-tasks.md,agent 见 docs/agents.md。`;
24
29
 
25
30
  const positiveInt = (value, fallback) => {
26
31
  const n = Number(value);
@@ -6,7 +6,13 @@ const path = require('node:path');
6
6
  const { spawnSync } = require('node:child_process');
7
7
  const { UsageError } = require('../lib/run');
8
8
 
9
- const USAGE = '用法: work-rhythm selftest [传给 node --test 的参数]';
9
+ const USAGE = `work-rhythm selftest [--test-name-pattern=…] —— 自测:跑 scripts/test/ 下的用例(node --test),二十秒左右
10
+
11
+ 用法:
12
+ work-rhythm selftest 全部
13
+ work-rhythm selftest --test-name-pattern=notify 只跑名字匹配的
14
+ 用假的命令行工具和本机的假 webhook,不碰真实账号、不发真消息。改完代码、发包之前跑一遍。
15
+ 退出码就是 node --test 的:0 全过;有失败时非 0;2 用法不对。`;
10
16
 
11
17
  module.exports = {
12
18
  usage: USAGE,
@@ -70,4 +70,15 @@ async function run(args, ctx, { deadlineMs } = {}) {
70
70
  return fail;
71
71
  }
72
72
 
73
- module.exports = { usage: '用法: work-rhythm sync [起始日期] [源 id …]', run, resolveCollector, spawnCollector };
73
+ const USAGE = `work-rhythm sync [起始日期] [源 id …] —— 同步订阅源:依次跑 00-config/sources.yaml 里启用的采集器,原始数据落 01-inbox/<源id>/<今天>/
74
+
75
+ 用法:
76
+ work-rhythm sync 从今天起,所有启用的源
77
+ work-rhythm sync 2026-12-01 从那天起,所有启用的源
78
+ work-rhythm sync 2026-12-01 im-yzj 只跑这一个源(可以写多个)
79
+ 只跑一个源、自己指定输出目录,用 work-rhythm collect。每个源的全部输出和报错记在 01-inbox/_sync.log。
80
+ 标准输出每个源一行:ok <源id>,或者 FAIL <源id>(详见 01-inbox/_sync.log)。
81
+ 退出码 = 失败的源数(0 是全部成功);3 不在工作目录里。
82
+ 采集只是取原料:把数据提炼成事件、合并进每日文件的「## 事件流」是 agent 做的(work-rhythm skill 的「同步并提炼事件」)。`;
83
+
84
+ module.exports = { usage: USAGE, run, resolveCollector, spawnCollector };
@@ -3,7 +3,6 @@
3
3
  const { loadProfile } = require('../lib/config');
4
4
  const { EXIT, UsageError, parseDate, fmtDate, today, weekdayCn, weekdayAbbr } = require('../lib/run');
5
5
 
6
- const USAGE = '用法: work-rhythm today [YYYY-MM-DD]\n输出四行:DATE=、WEEKDAY=、DAILY_FILE=、IS_WORKDAY=';
7
6
 
8
7
  // 是否工作日看 profile 的 preferences:workdays 里有没有这一天(Mon…Sun),holidays 里有没有这个日期。
9
8
  // workdays 写成了空列表,就天天都不上班;没写这一项,就天天都上班
@@ -18,6 +17,19 @@ function resolve(root, dateArg) {
18
17
 
19
18
  const output = (info) => `DATE=${info.date}\nWEEKDAY=${info.weekday}\nDAILY_FILE=${info.dailyFile}\nIS_WORKDAY=${info.isWorkday}\n`;
20
19
 
20
+ const USAGE = `work-rhythm today [YYYY-MM-DD] —— 今天在工作目录里的约定:日期、星期、每日文件路径、是否工作日
21
+
22
+ 用法:
23
+ work-rhythm today 今天
24
+ work-rhythm today 2026-12-05 指定的一天
25
+ 输出四行(给脚本和 agent 读的):
26
+ DATE=2026-12-05
27
+ WEEKDAY=五
28
+ DAILY_FILE=02-daily/2026-12/2026-12-05.md 路径相对工作目录
29
+ IS_WORKDAY=1 0 是休息日:不安排工作,定时任务不跑
30
+ 是否工作日看 00-config/profile.yaml 的 preferences.workdays / holidays,不要自己算。
31
+ 退出码: 0;2 日期写错(格式 YYYY-MM-DD);3 不在工作目录里(用 --workdir 指定)。`;
32
+
21
33
  module.exports = {
22
34
  usage: USAGE,
23
35
  resolve,
@@ -14,13 +14,16 @@ const { EXIT, Fail, UsageError } = require('../lib/run');
14
14
  const { isWorkdir, configPath, register, resolveRoot, findAll } = require('../lib/workdir');
15
15
  const { blank } = require('../lib/template');
16
16
 
17
- const USAGE = `用法: work-rhythm workdir [子命令]
17
+ const USAGE = `work-rhythm workdir [子命令] —— 工作目录在哪:找、登记、扫描本机、清空白
18
+
19
+ 用法: work-rhythm workdir [子命令]
18
20
  找工作目录:打印 WORKDIR=<路径> 和 SOURCE=cwd|pointer;找不到时 WORKDIR 为空,退出码 1
19
21
  register [目录] 把目录(默认当前目录)登记为工作目录,写进用户级配置
20
22
  find [起点目录 …] 找本机疑似工作目录的目录(带 00-config/profile.yaml 的);制表符分隔:路径、初始化状态、称呼
21
23
  config 打印用户级配置文件的位置
22
24
  blank <目录> 把一个目录清成空白的工作目录
23
- 新建用 work-rhythm init <目录>`;
25
+ 新建用 work-rhythm init <目录>。
26
+ 退出码: 找不到时 1(WORKDIR 为空);0 完成;2 用法不对或目录不是工作目录;5 清空白时失败;3 不在工作目录里(register / blank)。`;
24
27
 
25
28
  module.exports = {
26
29
  usage: USAGE,