ylcwf 0.5.0 → 0.5.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## 0.5.1
6
+
7
+ 修复 0.5.0 引入的写入错位,并补上几处静默的配置问题。
8
+
9
+ ### 修复
10
+
11
+ - **写入列错位**(0.5.0 引入):任务表新增「所属端」后,写回仍用固定列索引,导致
12
+ `AI自测状态` / `开发人工验收` / `任务状态` / `最后更新` 整体左移一格,写出的文档无法通过校验。
13
+ 现改为按 `schema.json` 的 `taskTable.keys` / `requirementTable.keys` 定位列,**与列的顺序无关**
14
+ - **写后校验被静默跳过**(历史 bug):`task` 写回时把迭代目录当成 docsRoot 传给校验器,
15
+ 找不到 `scripts/validate_task_doc.py` 就当作通过。修复后写后校验真正生效,失败会回滚
16
+ - **空终端映射不再静默**:`terminals: {}` 时 `show` / `doctor` / `init` 给出 `TERMINALS_EMPTY` 警告,
17
+ 并说明影响(`resolve`、归属校验、`doc migrate` 回填不可用)与补配置命令
18
+ - 任务终端不在本机配置中时,`doctor --docs` 会指出具体任务(此前静默跳过)
19
+ - **区分「已校验」与「跳过」**:归属校验因终端未配置/歧义无法执行时,
20
+ `doc apply` 与 `doctor --docs` 都明确标注「N 个完成、M 个被跳过(跳过≠通过)」,
21
+ 不再用「校验通过」掩盖未执行
22
+ - `doctor --docs` 区分级别:warning 只提示,不再让命令以退出码 1 失败
23
+ - 远程与本地迭代列表都排除 `docs/` 等非迭代目录(此前会把说明文档所在目录当成迭代)
24
+
25
+ ### 发布脚本
26
+
27
+ - `pnpm release` 新增 `--bump none`:发布当前版本号(CHANGELOG 已写好、npm 尚未发布时使用)
28
+
5
29
  ## 0.5.0(不兼容)
6
30
 
7
31
  文档格式从「写死在代码里」改为「文档仓库的 `schema.json` 定义」:
package/README.md CHANGED
@@ -46,10 +46,10 @@ ylcwf upgrade # 升级到最新版本
46
46
 
47
47
  ### 桌面端
48
48
 
49
- | 平台 | 安装包 | 安装方式 |
50
- | --- | --- | --- |
51
- | macOS(Apple Silicon) | `release/ylcwf-<版本>-arm64.dmg` | 运行 `sh scripts/install-app-macos.sh <dmg>`,或手动拖进「应用程序」 |
52
- | Windows(x64) | `release/ylcwf-<版本>-setup-x64.exe` | 双击安装,可选安装目录,默认当前用户(无需管理员) |
49
+ | 平台 | 安装包 | 安装方式 |
50
+ | ---------------------- | ------------------------------------ | -------------------------------------------------------------------- |
51
+ | macOS(Apple Silicon) | `release/ylcwf-<版本>-arm64.dmg` | 运行 `sh scripts/install-app-macos.sh <dmg>`,或手动拖进「应用程序」 |
52
+ | Windows(x64) | `release/ylcwf-<版本>-setup-x64.exe` | 双击安装,可选安装目录,默认当前用户(无需管理员) |
53
53
 
54
54
  macOS 一行安装(自动挂载、复制、去除隔离、启动):
55
55
 
@@ -62,7 +62,7 @@ Windows 版首次运行会被 SmartScreen 拦截(未签名):点「更多
62
62
  > macOS 的 `install.sh` 装的是 **CLI**,`install-app-macos.sh` 装的是 **桌面端 App**,两者互不替代。
63
63
 
64
64
  macOS 构建未做 Apple 签名与公证(内部使用),首次启动会被 Gatekeeper 拦截。用以下任一方式打开:
65
- >
65
+
66
66
  > ```bash
67
67
  > xattr -dr com.apple.quarantine "/Applications/ylcwf.app"
68
68
  > open -a "ylcwf"
@@ -109,11 +109,11 @@ pnpm start:electron # 桌面模式(开发)
109
109
 
110
110
  页面:
111
111
 
112
- | 页面 | 用途 |
113
- | --- | --- |
114
- | 概览 | doctor 分级结果、关键指标、配置路径 |
115
- | 迭代看板 | 迭代进度、状态分布(需求/任务/自测/验收)、跨成员总览、个人文档(默认选中自己,需求/任务/详情)、阻塞任务(列出等待中的前置任务及其状态)、数据源切换(本地 / 远程分支) |
116
- | 设置 | 五个 tab:身份(`developer`/`role`/`mode`)、文档仓库(`docs.root` 校验)、PRD终端映射(增删改,搜索框兼作解析测试)、备份(历史配置与回滚)、关于(版本、检查更新、导出、删除配置) |
112
+ | 页面 | 用途 |
113
+ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
114
+ | 概览 | doctor 分级结果、关键指标、配置路径 |
115
+ | 迭代看板 | 迭代进度、状态分布(需求/任务/自测/验收)、跨成员总览、个人文档(默认选中自己,需求/任务/详情)、阻塞任务(列出等待中的前置任务及其状态)、数据源切换(本地 / 远程分支) |
116
+ | 设置 | 五个 tab:身份(`developer`/`role`/`mode`)、文档仓库(`docs.root` 校验)、PRD终端映射(增删改,搜索框兼作解析测试)、备份(历史配置与回滚)、关于(版本、检查更新、导出、删除配置) |
117
117
 
118
118
  主题三态:**跟随系统 / 浅色 / 深色**,跟随系统时实时响应系统外观切换。侧边栏可收起为图标模式。
119
119
 
@@ -132,10 +132,10 @@ pnpm start:electron # 桌面模式(开发)
132
132
 
133
133
  看板顶部可切换:
134
134
 
135
- | 模式 | 数据来源 | 分支 |
136
- | --- | --- | --- |
137
- | 本地(默认) | 工作区文件 | **显示**当前检出分支(`⎇ feature_xxx`),有未提交改动时标黄点 |
138
- | 远程 | git 对象快照 | **可选**任意 `origin/*` 分支,默认跟随当前分支的上游 |
135
+ | 模式 | 数据来源 | 分支 |
136
+ | ------------ | ------------ | ------------------------------------------------------------- |
137
+ | 本地(默认) | 工作区文件 | **显示**当前检出分支(`⎇ feature_xxx`),有未提交改动时标黄点 |
138
+ | 远程 | git 对象快照 | **可选**任意 `origin/*` 分支,默认跟随当前分支的上游 |
139
139
 
140
140
  分支的处理:
141
141
 
@@ -152,6 +152,18 @@ pnpm start:electron # 桌面模式(开发)
152
152
  - 若脚本在旧提交中不存在,自动降级为本地解析并标注;
153
153
  - 状态条会显示上游引用、commit、领先/落后提交数、工作区是否有未提交修改。
154
154
 
155
+ ## 常见配置问题
156
+
157
+ | 现象 | 原因 | 处理 |
158
+ | --- | --- | --- |
159
+ | `warning TERMINALS_EMPTY` | `terminals: {}`,没配终端映射 | `ylcwf terminal add <终端名> --frontend <仓库路径>`(后端用 `--backend`) |
160
+ | `resolve` 提示未找到终端 | 终端名与 PRD 不一致或未配置该端仓库 | `ylcwf terminal list` 看现有映射;`--pick` 处理多仓库歧义 |
161
+ | `doctor --docs` 提示「终端不在本机终端配置中」 | 文档里写的仓库名在配置中查不到 | 补配置,或确认文档终端名是否正确 |
162
+ | 写操作被拒绝「当前在 main 分支」 | 文档仓库主干禁写 | `git switch -c feature_<迭代名>` |
163
+
164
+ 未配置终端时仍可正常读写文档,但以下能力不可用:`ylcwf resolve`、
165
+ 任务「所属端」与仓库归属校验、`ylcwf doc migrate` 的自动回填。
166
+
155
167
  ## 命令参考
156
168
 
157
169
  ### 顶层
@@ -195,13 +207,13 @@ ylcwf requirement show <需求编号> [--format json] # 可省略 -i
195
207
 
196
208
  迭代名解析顺序(`-i` 可省略,与 CLI 实现一致):
197
209
 
198
- | 顺序 | 来源 | 说明 |
199
- | --- | --- | --- |
200
- | 1 | `-i` 显式 | 永远可覆盖 |
201
- | 2 | 任务号 / 需求号反查 | 编号跨迭代唯一,精确匹配 |
202
- | 3 | 文档仓库当前分支 | 团队约定一迭代一分支 |
203
- | 4 | 当前目录 | 仅在 `{迭代目录}/` 下执行时可用 |
204
- | 5 | 中止 | 列出可用迭代 |
210
+ | 顺序 | 来源 | 说明 |
211
+ | ---- | ------------------- | ------------------------------- |
212
+ | 1 | `-i` 显式 | 永远可覆盖 |
213
+ | 2 | 任务号 / 需求号反查 | 编号跨迭代唯一,精确匹配 |
214
+ | 3 | 文档仓库当前分支 | 团队约定一迭代一分支 |
215
+ | 4 | 当前目录 | 仅在 `{迭代目录}/` 下执行时可用 |
216
+ | 5 | 中止 | 列出可用迭代 |
205
217
 
206
218
  输出会标注依据:`迭代:AI-YLC-PAD-v2.9(来自当前分支 feature_ai_ylc_pad_v2.9)`。
207
219
 
@@ -235,21 +247,25 @@ plan.json 字段:
235
247
 
236
248
  ```jsonc
237
249
  {
238
- "iteration": { "迭代版本": "...", "PRD 来源": "...", "排期计划": "..." }, // 仅首次建文档需要
239
- "requirements": [{ "code": "2755", "name": "需求名", "terminal": "ai-pad", "note": "" }],
240
- "tasks": [{
241
- "requirement": "2755",
242
- "name": "任务名",
243
- "type": "UI组件", // 必须在角色允许的类型内
244
- "scope": "前端", // 所属端:前端/后端;通用类型必须显式指定
245
- "terminal": "ai-pad",
246
- "dependsOn": [], // 已有任务填编号,计划内任务填任务名
247
- "files": [{ "path": "lib/a.dart", "change": "新增" }],
248
- "plan": ["实现要点"],
249
- "selfTest": [{ "cmd": "pnpm test", "result": "通过" }],
250
- "regression": ["受影响的历史功能"],
251
- "notes": "无"
252
- }]
250
+ "iteration": { "迭代版本": "...", "PRD 来源": "...", "排期计划": "..." }, // 仅首次建文档需要
251
+ "requirements": [
252
+ { "code": "2755", "name": "需求名", "terminal": "ai-pad", "note": "" },
253
+ ],
254
+ "tasks": [
255
+ {
256
+ "requirement": "2755",
257
+ "name": "任务名",
258
+ "type": "UI组件", // 必须在角色允许的类型内
259
+ "scope": "前端", // 所属端:前端/后端;通用类型必须显式指定
260
+ "terminal": "ai-pad",
261
+ "dependsOn": [], // 已有任务填编号,计划内任务填任务名
262
+ "files": [{ "path": "lib/a.dart", "change": "新增" }],
263
+ "plan": ["实现要点"],
264
+ "selfTest": [{ "cmd": "pnpm test", "result": "通过" }],
265
+ "regression": ["受影响的历史功能"],
266
+ "notes": "无",
267
+ },
268
+ ],
253
269
  }
254
270
  ```
255
271
 
package/dist/index.js CHANGED
@@ -9649,6 +9649,7 @@ function checkConfig(raw, options = {}) {
9649
9649
  docs,
9650
9650
  terminals
9651
9651
  };
9652
+ if (0 === Object.keys(terminals).length) issues.push(warning('TERMINALS_EMPTY', "尚未配置任何终端映射:ylcwf resolve、任务「所属端」与仓库归属校验、doc migrate 回填都将不可用。\n 补配置:ylcwf terminal add <终端名> --frontend <仓库路径>\n (后端仓库用 --backend,两端都有就同时传;每端多个仓库可重复该选项)", 'terminals'));
9652
9653
  issues.push(...checkTerminalIdentity(terminals));
9653
9654
  if (true === options.checkFs) {
9654
9655
  checkFsOfDocs(config, issues);
@@ -10015,6 +10016,12 @@ async function runInit(options) {
10015
10016
  }
10016
10017
  assertWritable(doc, configPath);
10017
10018
  saveDocument(doc, configPath);
10019
+ const terminalCount = Object.keys(doc.toJS().terminals ?? {}).length;
10020
+ if (0 === terminalCount) {
10021
+ log.warn('未配置终端映射:ylcwf resolve、任务「所属端」与仓库归属校验、doc migrate 回填都会不可用。');
10022
+ log.info('稍后补配置:ylcwf terminal add <PRD 中的终端名> --frontend <仓库路径>');
10023
+ log.info('(后端仓库用 --backend;每端多个仓库可重复传该选项)');
10024
+ }
10018
10025
  outro(`已写入 ${configPath}\n下一步:ylcwf doctor 校验,ylcwf show 查看;后续追加仓库用 ylcwf terminal repo add`);
10019
10026
  printLine('');
10020
10027
  }
@@ -10710,6 +10717,38 @@ function parseDocSchema(raw, docsRoot) {
10710
10717
  if (version > SUPPORTED_SCHEMA_VERSION) fail(docsRoot, `schemaVersion ${version} 高于当前 ylcwf 支持的 ${SUPPORTED_SCHEMA_VERSION},请升级 ylcwf`);
10711
10718
  const requirementTable = requireRecord(data.requirementTable, 'requirementTable', docsRoot);
10712
10719
  const taskTable = requireRecord(data.taskTable, 'taskTable', docsRoot);
10720
+ const REQUIRED_REQUIREMENT_KEYS = [
10721
+ 'id',
10722
+ 'status',
10723
+ 'progress',
10724
+ 'updatedAt'
10725
+ ];
10726
+ const REQUIRED_TASK_KEYS = [
10727
+ 'id',
10728
+ 'requirement',
10729
+ 'name',
10730
+ 'type',
10731
+ 'scope',
10732
+ 'terminal',
10733
+ 'dependencies',
10734
+ 'selfTest',
10735
+ 'acceptance',
10736
+ 'status',
10737
+ 'updatedAt'
10738
+ ];
10739
+ const readKeys = (table, headers, required, where)=>{
10740
+ const raw = table.keys;
10741
+ if (void 0 === raw) fail(docsRoot, `${where}.keys 必须声明列语义`);
10742
+ const record = requireRecord(raw, `${where}.keys`, docsRoot);
10743
+ const result = {};
10744
+ for (const semantic of required){
10745
+ const value = record[semantic];
10746
+ if ('string' != typeof value || 0 === value.trim().length) fail(docsRoot, `${where}.keys 缺少必需语义:${semantic}`);
10747
+ if (!headers.includes(value)) fail(docsRoot, `${where}.keys.${semantic} 指向的列「${value}」不在 headers 中`);
10748
+ result[semantic] = value;
10749
+ }
10750
+ return result;
10751
+ };
10713
10752
  const progressRaw = requirementTable.progressRange;
10714
10753
  let progressRange = [
10715
10754
  0,
@@ -10768,14 +10807,18 @@ function parseDocSchema(raw, docsRoot) {
10768
10807
  const owner = matched[0];
10769
10808
  if (void 0 === owner || 0 === owner[1].detailFields.length) fail(docsRoot, `roles.${owner?.[0] ?? '?'} 负责所属端「${value}」,必须声明 detailFields`);
10770
10809
  }
10810
+ const requirementHeaders = requireStringArray(requirementTable.headers, 'requirementTable.headers', docsRoot);
10811
+ const taskHeaders = requireStringArray(taskTable.headers, 'taskTable.headers', docsRoot);
10771
10812
  return {
10772
10813
  version,
10773
10814
  sections: requireStringArray(data.sections, 'sections', docsRoot),
10774
10815
  iterationFields: requireStringArray(data.iterationFields, 'iterationFields', docsRoot),
10775
- requirementHeaders: requireStringArray(requirementTable.headers, 'requirementTable.headers', docsRoot),
10816
+ requirementHeaders,
10817
+ requirementKeys: readKeys(requirementTable, requirementHeaders, REQUIRED_REQUIREMENT_KEYS, 'requirementTable'),
10776
10818
  requirementIdPattern: requireString(requirementTable.idPattern, 'requirementTable.idPattern', docsRoot),
10777
10819
  progressRange,
10778
- taskHeaders: requireStringArray(taskTable.headers, 'taskTable.headers', docsRoot),
10820
+ taskHeaders,
10821
+ taskKeys: readKeys(taskTable, taskHeaders, REQUIRED_TASK_KEYS, 'taskTable'),
10779
10822
  taskIdPattern: requireString(taskTable.idPattern, 'taskTable.idPattern', docsRoot),
10780
10823
  taskScopeEnum: requireStringArray(taskTable.scopeEnum, 'taskTable.scopeEnum', docsRoot),
10781
10824
  enums: {
@@ -10857,22 +10900,42 @@ function isKnownRepo(index, repoName) {
10857
10900
  }
10858
10901
  function validateTaskSides(options) {
10859
10902
  const issues = [];
10903
+ let checked = 0;
10904
+ let skipped = 0;
10860
10905
  for (const task of options.tasks){
10861
10906
  const expected = '前端' === task.scope ? 'frontend' : '后端' === task.scope ? 'backend' : null;
10862
- if (null === expected) continue;
10907
+ if (null === expected) {
10908
+ skipped += 1;
10909
+ continue;
10910
+ }
10863
10911
  const repoSide = sideOfRepo(options.index, task.terminal);
10864
- if (null !== repoSide) {
10865
- if (repoSide !== expected) issues.push({
10912
+ if (null === repoSide) {
10913
+ skipped += 1;
10914
+ if (options.index.byName.size > 0) issues.push({
10866
10915
  taskId: task.id,
10867
10916
  scope: task.scope,
10868
10917
  terminal: task.terminal,
10869
- repoSide,
10918
+ repoSide: null,
10870
10919
  level: 'warning',
10871
- message: `任务 ${task.id} 的所属端是「${task.scope}」,但终端「${task.terminal}」在本机配置里是${describeSide(repoSide)}仓库,请核对`
10920
+ message: isKnownRepo(options.index, task.terminal) ? `任务 ${task.id} 的终端「${task.terminal}」在本机配置中同时对应前后端仓库,无法校验归属` : `任务 ${task.id} 的终端「${task.terminal}」不在本机终端配置中,无法校验所属端与仓库是否一致`
10872
10921
  });
10922
+ continue;
10873
10923
  }
10924
+ checked += 1;
10925
+ if (repoSide !== expected) issues.push({
10926
+ taskId: task.id,
10927
+ scope: task.scope,
10928
+ terminal: task.terminal,
10929
+ repoSide,
10930
+ level: 'warning',
10931
+ message: `任务 ${task.id} 的所属端是「${task.scope}」,但终端「${task.terminal}」在本机配置里是${describeSide(repoSide)}仓库,请核对`
10932
+ });
10874
10933
  }
10875
- return issues;
10934
+ return {
10935
+ issues,
10936
+ checked,
10937
+ skipped
10938
+ };
10876
10939
  }
10877
10940
  function describeSide(side) {
10878
10941
  return 'backend' === side ? '后端' : '前端';
@@ -11391,6 +11454,7 @@ const RESERVED_FILES = new Set([
11391
11454
  const RESERVED_PREFIXES = [
11392
11455
  'skills/',
11393
11456
  "scripts/",
11457
+ 'docs/',
11394
11458
  '_prd/'
11395
11459
  ];
11396
11460
  const SAFE_SEGMENT = /^[A-Za-z0-9._\-\u4e00-\u9fa5]+$/;
@@ -12028,30 +12092,31 @@ function parseMarkdownDoc(markdown, schema) {
12028
12092
  code: 'TASK_TABLE_MISMATCH',
12029
12093
  message: `任务清单表头缺少列:${taskRead.missing.join('、')},请按最新模板补齐`
12030
12094
  });
12031
- const reqH = schema.requirementHeaders;
12095
+ const rk = schema.requirementKeys;
12096
+ const at = (record, keys, semantic)=>record[keys[semantic] ?? ''] ?? '';
12032
12097
  const requirements = requirementRead.records.map((record)=>({
12033
- id: record[reqH[0] ?? ''] ?? '',
12034
- title: record[reqH[1] ?? ''] ?? '',
12035
- terminal: record[reqH[2] ?? ''] ?? '',
12036
- status: record[reqH[3] ?? ''] ?? '',
12037
- progress: record[reqH[4] ?? ''] ?? '',
12038
- note: record[reqH[5] ?? ''] ?? '',
12039
- updatedAt: record[reqH[6] ?? ''] ?? '',
12098
+ id: at(record, rk, 'id'),
12099
+ title: at(record, rk, 'title'),
12100
+ terminal: at(record, rk, 'terminal'),
12101
+ status: at(record, rk, 'status'),
12102
+ progress: at(record, rk, 'progress'),
12103
+ note: at(record, rk, 'note'),
12104
+ updatedAt: at(record, rk, 'updatedAt'),
12040
12105
  taskIds: []
12041
12106
  }));
12042
- const taskH = schema.taskHeaders;
12107
+ const tk = schema.taskKeys;
12043
12108
  const tasks = taskRead.records.map((record)=>({
12044
- id: record[taskH[0] ?? ''] ?? '',
12045
- requirementId: record[taskH[1] ?? ''] ?? '',
12046
- name: record[taskH[2] ?? ''] ?? '',
12047
- type: record[taskH[3] ?? ''] ?? '',
12048
- scope: record[taskH[4] ?? ''] ?? '',
12049
- terminal: record[taskH[5] ?? ''] ?? '',
12050
- dependencies: (record[taskH[6] ?? ''] ?? '').split(/[,,]/).map((item)=>item.trim()).filter((item)=>item.length > 0),
12051
- selfTest: record[taskH[7] ?? ''] ?? '',
12052
- acceptance: record[taskH[8] ?? ''] ?? '',
12053
- status: record[taskH[9] ?? ''] ?? '',
12054
- updatedAt: record[taskH[10] ?? ''] ?? ''
12109
+ id: at(record, tk, 'id'),
12110
+ requirementId: at(record, tk, 'requirement'),
12111
+ name: at(record, tk, 'name'),
12112
+ type: at(record, tk, 'type'),
12113
+ scope: at(record, tk, 'scope'),
12114
+ terminal: at(record, tk, 'terminal'),
12115
+ dependencies: at(record, tk, 'dependencies').split(/[,,]/).map((item)=>item.trim()).filter((item)=>item.length > 0),
12116
+ selfTest: at(record, tk, 'selfTest'),
12117
+ acceptance: at(record, tk, 'acceptance'),
12118
+ status: at(record, tk, 'status'),
12119
+ updatedAt: at(record, tk, 'updatedAt')
12055
12120
  }));
12056
12121
  for (const requirement of requirements)requirement.taskIds = tasks.filter((task)=>task.requirementId === requirement.id).map((task)=>task.id);
12057
12122
  const details = splitDetails(markdown);
@@ -12424,22 +12489,27 @@ function readTaskHistory(options) {
12424
12489
  return entries;
12425
12490
  }
12426
12491
  function buildKeys(schema) {
12427
- const h = schema.taskHeaders;
12428
- const r = schema.requirementHeaders;
12492
+ const t = schema.taskKeys;
12493
+ const r = schema.requirementKeys;
12494
+ const pick = (keys, semantic)=>{
12495
+ const value = keys[semantic];
12496
+ if (void 0 === value) throw new errors_CliError(`schema.json 缺少列语义:${semantic}`, errors_EXIT.INVALID);
12497
+ return value;
12498
+ };
12429
12499
  return {
12430
12500
  task: {
12431
- id: h[0] ?? '任务编号',
12432
- requirement: h[1] ?? '关联需求编号',
12433
- selfTest: h[6] ?? 'AI自测状态',
12434
- acceptance: h[7] ?? '开发人工验收',
12435
- status: h[8] ?? '任务状态',
12436
- updatedAt: h[9] ?? '最后更新'
12501
+ id: pick(t, 'id'),
12502
+ requirement: pick(t, 'requirement'),
12503
+ selfTest: pick(t, 'selfTest'),
12504
+ acceptance: pick(t, 'acceptance'),
12505
+ status: pick(t, 'status'),
12506
+ updatedAt: pick(t, 'updatedAt')
12437
12507
  },
12438
12508
  requirement: {
12439
- id: r[0] ?? '需求编号',
12440
- status: r[3] ?? '开发状态',
12441
- progress: r[4] ?? '开发进度(%)',
12442
- updatedAt: r[6] ?? '最后更新'
12509
+ id: pick(r, 'id'),
12510
+ status: pick(r, 'status'),
12511
+ progress: pick(r, 'progress'),
12512
+ updatedAt: pick(r, 'updatedAt')
12443
12513
  },
12444
12514
  taskSection: `## ${schema.sections[2] ?? '三、任务清单'}`,
12445
12515
  requirementSection: `## ${schema.sections[1] ?? '二、需求清单'}`
@@ -12648,7 +12718,7 @@ function commit(context, lines, changes, message, iteration, developer, action,
12648
12718
  file: context.file
12649
12719
  };
12650
12720
  writeFileSync(context.file, output, 'utf8');
12651
- const violation = validateAfterWrite(external_node_path_dirname(context.file), iteration, developer);
12721
+ const violation = validateAfterWrite(options.docsRoot, iteration, developer);
12652
12722
  if (null !== violation) {
12653
12723
  writeFileSync(context.file, context.original, 'utf8');
12654
12724
  throw new errors_CliError(`写入被校验器拒绝,已回滚:${violation}`, errors_EXIT.INVALID);
@@ -13222,7 +13292,7 @@ function runDocApply(options, mode = 'apply') {
13222
13292
  developer
13223
13293
  });
13224
13294
  const sideIndex = buildRepoSideIndex(config.terminals);
13225
- const sideIssues = validateTaskSides({
13295
+ const sideReport = validateTaskSides({
13226
13296
  index: sideIndex,
13227
13297
  tasks: rendered.assigned.map((item)=>{
13228
13298
  const planned = plan.tasks.find((task)=>task.name === item.name);
@@ -13233,8 +13303,9 @@ function runDocApply(options, mode = 'apply') {
13233
13303
  };
13234
13304
  })
13235
13305
  });
13236
- const conflicts = sideIssues.filter((issue)=>'error' === issue.level);
13306
+ const conflicts = sideReport.issues.filter((issue)=>'error' === issue.level);
13237
13307
  if (conflicts.length > 0) throw new errors_CliError(`任务类型与终端归属不一致,已中止:\n${conflicts.map((issue)=>` · ${issue.message}`).join('\n')}`, errors_EXIT.INVALID);
13308
+ const sideSkippedNote = sideReport.skipped > 0 ? `本机终端配置未覆盖 ${sideReport.skipped} 个任务,其「所属端 vs 仓库」未校验` + (0 === Object.keys(config.terminals).length ? '(terminals 为空)' : '') : null;
13238
13309
  if (0 === rendered.assigned.length && rendered.markdown === original) {
13239
13310
  if ('json' === format) printJson({
13240
13311
  ok: true,
@@ -13276,13 +13347,14 @@ function runDocApply(options, mode = 'apply') {
13276
13347
  else writeFileSync(targetFile, original, 'utf8');
13277
13348
  throw new errors_CliError(`写入被校验器拒绝,已回滚:${violation}`, errors_EXIT.INVALID);
13278
13349
  }
13279
- const remaining = checkDocTaskSides({
13350
+ const remainingReport = checkDocTaskSides({
13280
13351
  docsRoot,
13281
13352
  iteration,
13282
13353
  developer,
13283
13354
  role,
13284
13355
  terminals: config.terminals
13285
- }).filter((issue)=>'error' === issue.level);
13356
+ });
13357
+ const remaining = remainingReport.issues.filter((issue)=>'error' === issue.level);
13286
13358
  const policy = config.docs.git.cli;
13287
13359
  const git = policy.commit ? commitInDocsRepo(docsRoot, targetFile, `docs: ${iteration} 新增 ${rendered.assigned.length} 个任务(${rendered.assigned.map((item)=>item.id).join('、')})`, policy.push) : void 0;
13288
13360
  if ('json' === format) printJson({
@@ -13292,11 +13364,17 @@ function runDocApply(options, mode = 'apply') {
13292
13364
  changes: rendered.changes,
13293
13365
  assigned: rendered.assigned,
13294
13366
  sideIssues: remaining.map((issue)=>issue.message),
13367
+ sideCheck: {
13368
+ checked: sideReport.checked,
13369
+ skipped: sideReport.skipped
13370
+ },
13371
+ sideWarning: sideSkippedNote,
13295
13372
  git
13296
13373
  });
13297
13374
  else {
13298
13375
  printLine(`已写入:${targetFile}`);
13299
13376
  for (const change of rendered.changes)printLine(` · ${change}`);
13377
+ if (null !== sideSkippedNote) printLine(`\n! ${sideSkippedNote}`);
13300
13378
  if (remaining.length > 0) {
13301
13379
  printLine('\n注意:以下任务的类型与终端归属不一致(请核对):');
13302
13380
  for (const issue of remaining)printLine(` · ${issue.message}`);
@@ -13541,7 +13619,7 @@ function collectSideIssues(options) {
13541
13619
  developer: options.developer,
13542
13620
  role: loaded.config.profile.role,
13543
13621
  terminals: loaded.config.terminals
13544
- }).filter((issue)=>'error' === issue.level).map((issue)=>issue.message);
13622
+ }).issues.filter((issue)=>'error' === issue.level).map((issue)=>issue.message);
13545
13623
  } catch {
13546
13624
  return [];
13547
13625
  }
@@ -14083,9 +14161,9 @@ async function fetchManifest(url) {
14083
14161
  const payload = await response.json();
14084
14162
  if ('string' != typeof payload.version || 0 === payload.version.length) return null;
14085
14163
  return {
14086
- current: "0.5.0",
14164
+ current: "0.5.1",
14087
14165
  latest: payload.version,
14088
- hasUpdate: isNewer(payload.version, "0.5.0"),
14166
+ hasUpdate: isNewer(payload.version, "0.5.1"),
14089
14167
  downloadUrl: 'string' == typeof payload.downloadUrl ? payload.downloadUrl : null,
14090
14168
  source: 'manifest',
14091
14169
  checkedAt: new Date().toISOString(),
@@ -14097,7 +14175,7 @@ async function fetchManifest(url) {
14097
14175
  }
14098
14176
  async function fetchNpm() {
14099
14177
  const base = {
14100
- current: "0.5.0",
14178
+ current: "0.5.1",
14101
14179
  latest: null,
14102
14180
  hasUpdate: false,
14103
14181
  downloadUrl: null,
@@ -14124,7 +14202,7 @@ async function fetchNpm() {
14124
14202
  return {
14125
14203
  ...base,
14126
14204
  latest,
14127
- hasUpdate: isNewer(latest, "0.5.0"),
14205
+ hasUpdate: isNewer(latest, "0.5.1"),
14128
14206
  downloadUrl: null
14129
14207
  };
14130
14208
  } catch (error) {
@@ -14215,7 +14293,7 @@ async function runUpgrade(options) {
14215
14293
  const kind = detectInstallKind();
14216
14294
  const result = await checkUpdate(true);
14217
14295
  const target = options.to?.trim() ?? result.latest;
14218
- printLine("当前版本:0.5.0");
14296
+ printLine("当前版本:0.5.1");
14219
14297
  if (null !== result.error) printLine(`版本查询失败:${result.error}`);
14220
14298
  else if (null !== result.latest) printLine(`最新版本:${result.latest}(来源:${result.source})`);
14221
14299
  if (null === target) throw new errors_CliError('无法确定目标版本,请稍后重试或用 --to 指定', errors_EXIT.NOT_FOUND);
@@ -14388,18 +14466,28 @@ function checkDocsSides(config) {
14388
14466
  });
14389
14467
  } catch {
14390
14468
  return [
14391
- `无法读取文档仓库:${root}`
14469
+ {
14470
+ level: 'warning',
14471
+ message: `无法读取文档仓库:${root}`
14472
+ }
14392
14473
  ];
14393
14474
  }
14394
14475
  for (const iteration of iterations)try {
14395
- const issues = checkDocTaskSides({
14476
+ const report = checkDocTaskSides({
14396
14477
  docsRoot: root,
14397
14478
  iteration,
14398
14479
  developer: config.profile.developer,
14399
14480
  role: config.profile.role,
14400
14481
  terminals: config.terminals
14401
14482
  });
14402
- for (const issue of issues)messages.push(`[${iteration}] ${issue.message}`);
14483
+ for (const issue of report.issues)messages.push({
14484
+ level: issue.level,
14485
+ message: `[${iteration}] ${issue.message}`
14486
+ });
14487
+ if (report.skipped > 0) messages.push({
14488
+ level: 'warning',
14489
+ message: `[${iteration}] ${report.checked} 个任务完成归属校验,${report.skipped} 个因终端未配置/歧义被跳过(跳过≠通过)`
14490
+ });
14403
14491
  } catch {}
14404
14492
  return messages;
14405
14493
  }
@@ -14412,24 +14500,24 @@ function runDoctor(options) {
14412
14500
  });
14413
14501
  const errors = countIssues(checked.issues).errors;
14414
14502
  const ok = !hasError(checked.issues);
14415
- const sideMessages = [];
14416
- if (true === options.docs && null !== checked.config && ok) sideMessages.push(...checkDocsSides(checked.config));
14417
- const sideErrors = sideMessages.length;
14503
+ const sideIssues = [];
14504
+ if (true === options.docs && null !== checked.config && ok) sideIssues.push(...checkDocsSides(checked.config));
14505
+ const sideErrors = sideIssues.filter((item)=>'error' === item.level).length;
14418
14506
  const allOk = ok && 0 === sideErrors;
14419
14507
  if ('json' === format) printJson({
14420
14508
  ok: allOk,
14421
14509
  configPath: loaded.path,
14422
14510
  ...countIssues(checked.issues),
14423
14511
  issues: checked.issues,
14424
- docSideIssues: sideMessages
14512
+ docSideIssues: sideIssues.map((item)=>`[${item.level}] ${item.message}`)
14425
14513
  });
14426
14514
  else {
14427
14515
  printLine(`配置文件 ${loaded.path}`);
14428
14516
  printLine(formatIssues(checked.issues, '校验通过,未发现问题'));
14429
- if (sideMessages.length > 0) {
14517
+ if (sideIssues.length > 0) {
14430
14518
  printLine('');
14431
14519
  printLine('文档体检:');
14432
- for (const message of sideMessages)printLine(` · ${message}`);
14520
+ for (const item of sideIssues)printLine(` ${'error' === item.level ? '✗' : '!'} ${item.message}`);
14433
14521
  }
14434
14522
  if (!allOk) printLine(`\n校验失败:${errors} 项配置 error${sideErrors > 0 ? `,${sideErrors} 项文档问题` : ''}`);
14435
14523
  }
@@ -14599,7 +14687,7 @@ function readState(explicitPath) {
14599
14687
  issues: checked.issues,
14600
14688
  backups: listBackups(explicitPath),
14601
14689
  meta: {
14602
- version: "0.5.0",
14690
+ version: "0.5.1",
14603
14691
  features: SERVER_FEATURES
14604
14692
  }
14605
14693
  };
@@ -15234,7 +15322,7 @@ function registerReset(program) {
15234
15322
  }
15235
15323
  function buildProgram() {
15236
15324
  const program = new command_Command();
15237
- program.name('ylcwf').description('YLC 研发工作流配置:文档仓库、开发者标识、默认角色与终端仓库映射').version("0.5.0", '-v, --version', '显示版本号').showHelpAfterError();
15325
+ program.name('ylcwf').description('YLC 研发工作流配置:文档仓库、开发者标识、默认角色与终端仓库映射').version("0.5.1", '-v, --version', '显示版本号').showHelpAfterError();
15238
15326
  registerInit(program);
15239
15327
  registerShow(program);
15240
15328
  registerGet(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ylcwf",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "研发工作流配置 CLI:文档仓库、开发者标识、默认角色与 PRD 终端 → 本地仓库映射",
5
5
  "type": "module",
6
6
  "bin": {