nx-kv 0.63.0 → 0.64.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.
Files changed (183) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/assets/nx-kv/references/A03-/346/226/207/346/241/243/344/270/216/345/275/222/345/261/236.md +6 -5
  3. package/package.json +2 -2
  4. package/src/core/attachmentdb/docs.ts +3 -6
  5. package/src/core/attachmentdb/query.ts +2 -2
  6. package/src/core/attachmentdb/relations.ts +36 -21
  7. package/src/core/db/import-json/refs.ts +17 -19
  8. package/src/core/db/import-json/repos.ts +4 -8
  9. package/src/core/db/migrations/index.ts +2 -0
  10. package/src/core/db/migrations/v13.sql +24 -0
  11. package/src/core/db/seed-templates.ts +15 -4
  12. package/src/core/db/version.ts +3 -1
  13. package/src/modules/docs/actions/_manifest.generated.ts +0 -3
  14. package/src/modules/docs/actions/doc-attach.ts +0 -1
  15. package/src/modules/docs/actions/docs-bindings.ts +2 -5
  16. package/src/modules/docs/actions/docs-link.ts +1 -2
  17. package/src/modules/docs/attach.ts +1 -36
  18. package/src/modules/docs/bound-docs.ts +2 -2
  19. package/src/modules/docs/brief.ts +0 -2
  20. package/src/modules/docs/docref.ts +7 -17
  21. package/src/modules/docs/knowledge-md.ts +1 -1
  22. package/src/modules/docs/knowledge.ts +48 -45
  23. package/src/modules/docs/ref-sync.ts +1 -5
  24. package/src/modules/docs/refs.ts +7 -10
  25. package/src/modules/docs/service.ts +1 -3
  26. package/src/modules/localtask/actions/localtask-config.ts +19 -58
  27. package/src/modules/localtask/actions/localtask-prune.ts +7 -2
  28. package/src/modules/localtask/repo/open.ts +0 -4
  29. package/src/modules/localtask/repo/settings.ts +20 -196
  30. package/src/modules/localtask/task-lifecycle.ts +7 -9
  31. package/src/modules/localtask/task-templates.ts +4 -4
  32. package/src/modules/localtask/task-view.ts +4 -0
  33. package/src/modules/localtask/topics.ts +30 -28
  34. package/src/modules/promptplug/actions/_manifest.generated.ts +0 -3
  35. package/src/modules/promptplug/actions/prompt-registry.ts +19 -30
  36. package/src/modules/promptplug/base.ts +69 -25
  37. package/src/modules/promptplug/compose.ts +40 -23
  38. package/src/modules/promptplug/factory.ts +91 -59
  39. package/src/modules/promptplug/index.ts +25 -11
  40. package/src/modules/promptplug/plugins/ack.ts +28 -0
  41. package/src/modules/promptplug/plugins/attachment.ts +237 -19
  42. package/src/modules/promptplug/plugins/context.ts +124 -30
  43. package/src/modules/promptplug/plugins/doneguard.ts +33 -0
  44. package/src/modules/promptplug/plugins/ext.ts +34 -11
  45. package/src/modules/promptplug/plugins/getloop.ts +29 -8
  46. package/src/modules/promptplug/plugins/goal-shape.ts +34 -0
  47. package/src/modules/promptplug/plugins/goalhint.ts +33 -0
  48. package/src/modules/promptplug/plugins/timecheck.ts +33 -0
  49. package/src/modules/promptplug/registry.ts +99 -0
  50. package/src/modules/promptplug/schema-bridge.ts +77 -13
  51. package/src/modules/repos/actions/board-rekey.ts +1 -1
  52. package/src/modules/repos/actions/repo-doc-add.ts +2 -3
  53. package/src/modules/repos/boards/core.ts +1 -13
  54. package/src/modules/repos/boards/docs.ts +2 -12
  55. package/src/modules/repos/boards/members.ts +2 -14
  56. package/src/modules/repos/boards/transfer.ts +2 -11
  57. package/src/modules/repos/keys.ts +4 -11
  58. package/src/modules/repos/repo/refs.ts +3 -5
  59. package/src/modules/repos/repo/repos.ts +12 -13
  60. package/src/modules/repos/repo/rows.ts +2 -8
  61. package/src/modules/repos/service/context.ts +0 -2
  62. package/src/modules/repos/service/crud.ts +1 -4
  63. package/src/modules/repos/service/store.ts +6 -7
  64. package/src/modules/repos/transfer/export.ts +3 -8
  65. package/src/modules/repos/transfer/import.ts +0 -13
  66. package/src/modules/repos/transfer/layout.ts +2 -2
  67. package/src/modules/tasktool/attach-template.ts +3 -3
  68. package/src/modules/tasktool/groupctx.ts +4 -5
  69. package/src/modules/tasktool/plugins/waitgoal-config.ts +5 -6
  70. package/src/modules/tasktool/preview.ts +20 -23
  71. package/src/modules/tasktool/wait.ts +24 -46
  72. package/src/modules/templates/actions/_manifest.generated.ts +3 -0
  73. package/src/modules/templates/actions/templates-reorder.ts +28 -0
  74. package/src/modules/templates/repo/templates.ts +32 -2
  75. package/src/modules/templates/service.ts +45 -0
  76. package/src/shared/prompt-blocks.ts +7 -173
  77. package/src/shared/prompt-plugin.ts +79 -59
  78. package/src/web/frontend/App.tsx +27 -1
  79. package/src/web/frontend/api/cli-tree.json +20 -35
  80. package/src/web/frontend/api/client.generated.ts +22 -32
  81. package/src/web/frontend/components/Introduction/rail.tsx +2 -2
  82. package/src/web/frontend/components/Introduction/use-intro.ts +2 -5
  83. package/src/web/frontend/components/bindings/bind-tags.tsx +1 -3
  84. package/src/web/frontend/components/list-search.tsx +37 -0
  85. package/src/web/frontend/components/md/attach-area.tsx +10 -15
  86. package/src/web/frontend/components/md/live-block.tsx +5 -14
  87. package/src/web/frontend/components/md/md-panes.tsx +3 -19
  88. package/src/web/frontend/modules/list-filter.ts +37 -0
  89. package/src/web/frontend/modules/md/fill-session.ts +36 -0
  90. package/src/web/frontend/modules/md/manage-session.ts +24 -0
  91. package/src/web/frontend/modules/md/new-task-from-template.ts +22 -0
  92. package/src/web/frontend/modules/md/styles/editor.css +5 -12
  93. package/src/web/frontend/modules/md/styles/shell.css +4 -0
  94. package/src/web/frontend/modules/md/task-intent.ts +29 -0
  95. package/src/web/frontend/modules/md/use-templates.ts +8 -0
  96. package/src/web/frontend/modules/prompts/template-preview.ts +12 -20
  97. package/src/web/frontend/modules/refs/api.ts +0 -1
  98. package/src/web/frontend/page/dir/index.tsx +20 -5
  99. package/src/web/frontend/page/dir/task-actions.ts +14 -0
  100. package/src/web/frontend/page/dir/task-preview-modal.tsx +1 -1
  101. package/src/web/frontend/page/dir/task.tsx +19 -0
  102. package/src/web/frontend/page/doc/api.ts +2 -3
  103. package/src/web/frontend/page/doc/bindings.tsx +46 -16
  104. package/src/web/frontend/page/doc/index.tsx +3 -4
  105. package/src/web/frontend/page/group/index.tsx +65 -117
  106. package/src/web/frontend/page/refs/index.tsx +27 -3
  107. package/src/web/frontend/page/refs/style.css +3 -0
  108. package/src/web/frontend/page/repos/bind-modals.tsx +18 -2
  109. package/src/web/frontend/page/repos/board-admin.tsx +1 -1
  110. package/src/web/frontend/page/repos/index.tsx +4 -8
  111. package/src/web/frontend/page/repos/ref-block.tsx +5 -12
  112. package/src/web/frontend/page/repos/ref-panel.tsx +3 -4
  113. package/src/web/frontend/page/repos/repo-form-modal.tsx +1 -8
  114. package/src/web/frontend/page/repos/repo-table.tsx +4 -29
  115. package/src/web/frontend/page/repos/use-repos-derive.ts +4 -5
  116. package/src/web/frontend/page/settings/api.ts +7 -15
  117. package/src/web/frontend/page/settings/prompt-templates-section.tsx +261 -289
  118. package/src/web/frontend/page/settings/prompt-vars.ts +56 -0
  119. package/src/web/frontend/page/settings/style.css +46 -64
  120. package/src/web/frontend/page/templates/fill.tsx +124 -0
  121. package/src/web/frontend/page/templates/index.tsx +11 -0
  122. package/src/web/frontend/page/templates/manage.tsx +218 -0
  123. package/src/web/frontend/page/templates/style.css +46 -0
  124. package/src/web/frontend/page/templates/template-list.tsx +58 -54
  125. package/src/web/frontend/refs/api.ts +0 -2
  126. package/src/web/frontend/routes/route-eq.ts +22 -0
  127. package/src/web/frontend/routes/templates.ts +20 -0
  128. package/src/web/frontend/style.css +1 -0
  129. package/src/web/frontend/styles/list-search.css +44 -0
  130. package/src/web/frontend/types.ts +5 -1
  131. package/src/web/public/assets/{bar-CYWfxHfm.js → bar-j14ON7uZ.js} +1 -1
  132. package/src/web/public/assets/{composer-launch-Bor4ngrQ.js → composer-launch-DRi9mZE1.js} +1 -1
  133. package/src/web/public/assets/{composer-panel-C7mNI7EW.js → composer-panel-swmDqlPw.js} +1 -1
  134. package/src/web/public/assets/dir-DhsB1ZhL.js +3 -0
  135. package/src/web/public/assets/doc-D4po3sDc.js +6 -0
  136. package/src/web/public/assets/fill-session-fHxQHFaD.js +1 -0
  137. package/src/web/public/assets/group-BxmSNzIB.js +1 -0
  138. package/src/web/public/assets/index-CMjG5NVU.js +2 -0
  139. package/src/web/public/assets/index-uMjSWNVr.css +1 -0
  140. package/src/web/public/assets/list-filter-D-x94TvA.js +1 -0
  141. package/src/web/public/assets/manage-session-CS8UvmUd.js +1 -0
  142. package/src/web/public/assets/md-history-CZUF_FhN.js +39 -0
  143. package/src/web/public/assets/new-task-from-template-DDWu4yR4.js +1 -0
  144. package/src/web/public/assets/refs-TuuoaRs7.js +2 -0
  145. package/src/web/public/assets/refs-zSA2k_45.css +1 -0
  146. package/src/web/public/assets/render-template-body-bXdedFig.js +1 -0
  147. package/src/web/public/assets/repo-form-modal-BD4N37MI.js +1 -0
  148. package/src/web/public/assets/repos-BPeuX4N9.js +12 -0
  149. package/src/web/public/assets/settings-CZJaKLZW.js +1 -0
  150. package/src/web/public/assets/settings-Cc6puKd5.css +1 -0
  151. package/src/web/public/assets/task-DgbbF5gy.js +11 -0
  152. package/src/web/public/assets/task-intent-CX5DZccN.js +1 -0
  153. package/src/web/public/assets/{task-utils-DpnPjZKJ.js → task-utils-bJH1-Cjy.js} +1 -1
  154. package/src/web/public/assets/templates-CBXlwyof.js +11 -0
  155. package/src/web/public/assets/templates-plA8R7jJ.css +1 -0
  156. package/src/web/public/assets/use-rail-drag-ufwy2XZB.js +1 -0
  157. package/src/web/public/index.html +8 -6
  158. package/src/modules/docs/actions/doc-attach-note.ts +0 -32
  159. package/src/modules/promptplug/Template/blockTemplates.json +0 -90
  160. package/src/modules/promptplug/actions/prompt-order.ts +0 -38
  161. package/src/modules/promptplug/ensure.ts +0 -57
  162. package/src/modules/promptplug/keys.ts +0 -9
  163. package/src/modules/promptplug/plugins/readonly-blocks.ts +0 -75
  164. package/src/modules/promptplug/template-bundle.ts +0 -59
  165. package/src/web/frontend/modules/md/template-locks.ts +0 -105
  166. package/src/web/frontend/page/settings/prompt-editor.tsx +0 -279
  167. package/src/web/frontend/page/settings/prompt-rail.tsx +0 -170
  168. package/src/web/public/assets/dir-CcffxXL2.js +0 -3
  169. package/src/web/public/assets/doc-BxWVzWkw.js +0 -6
  170. package/src/web/public/assets/group-C5Yu3oJr.js +0 -1
  171. package/src/web/public/assets/index-BvyZ1MA2.js +0 -2
  172. package/src/web/public/assets/index-Cp-TtHyA.css +0 -1
  173. package/src/web/public/assets/md-history-DejKuR12.js +0 -39
  174. package/src/web/public/assets/refs-DJdKV8_H.css +0 -1
  175. package/src/web/public/assets/refs-VbDnDTV0.js +0 -2
  176. package/src/web/public/assets/repo-form-modal-Dkdvu_uN.js +0 -1
  177. package/src/web/public/assets/repos-CY0eZheu.js +0 -16
  178. package/src/web/public/assets/settings-AwzLRYUu.css +0 -1
  179. package/src/web/public/assets/settings-D3T-vgCl.js +0 -1
  180. package/src/web/public/assets/task-CkCD82h_.js +0 -11
  181. package/src/web/public/assets/templates-BcuCbT4U.js +0 -10
  182. package/src/web/public/assets/templates-gNdtaMI2.css +0 -1
  183. package/src/web/public/assets/use-rail-drag-DMvr8-GE.js +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,35 @@
2
2
 
3
3
  本文件对外可见的变更。格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/)。
4
4
 
5
+ ## [0.64.0] - 2026-11-18 模板插槽修复 / 幽灵目录可视化 / 变量目录带含义
6
+
7
+ ### Added
8
+
9
+ - **`localtask prune --missing-dir`**(#155):显式清理「工作目录已不存在且没有待领任务」的主题
10
+ (删掉的临时目录 / 测试残留;外接盘未挂载也会命中,所以默认关闭、必须显式开,`--dry-run` 可预演)。
11
+ - **设置页变量目录显示含义**:提示词模板的「可使用变量」从光秃秃的键名升级为
12
+ 「`repo.name` 项目名(登记名;未填时回落 key)」——含义由插件 schema 的 `.describe()`
13
+ 单一来源驱动,90+ 个变量(含数组元素内字段)自动带说明,前端零手写表;
14
+ 过长截断、悬停看完整。
15
+
16
+ ### Changed
17
+
18
+ - **任务页头部标注幽灵目录**(#155):主题的工作目录被删 / 盘未挂载时,路径旁显示
19
+ 「· 目录已不存在」(任务本身还在,只是不再有对应目录)。
20
+ - **群组页「新建」入口与目录页对齐**:按钮文案「+ 新建页」、主按钮样式、
21
+ 下拉兜底项与空态提示统一(以 repo 为准)。
22
+
23
+ ### Fixed
24
+
25
+ - **带槽位模板创建时不进参数填写页**(#153,两层根因):
26
+ ① 库里的内置模板正文是旧编辑器「渲染后保存」的产物——`{{content}}` 早被替换成
27
+ 提示文字,检出 0 个槽位就直接进草稿;出厂正文自愈新增判据:内置行整行没有插槽、
28
+ 但还留着出厂提示文字 → 以出厂正文 + 默认值恢复(用户手写的正文照旧不动)。
29
+ ② 面板路由比较只看 view/key/task,`#/templates` → `#/templates/fill/<id>` 三者相同
30
+ 被判「没变」→ 新路由被丢弃;改为全字段比较(mode/id/topic/scope/repoKey/boardKey)。
31
+ - **段的产出不再能覆盖任务本体**:交付编排里 seed(任务 id / 时间目标)优先于段的
32
+ `buildData`,防止身份字段被某一段改写。
33
+
5
34
  ## [0.63.0] - 2026-11-17 文档主篇 / 全局检索 / 模板插槽三块收口(#144–#147、#217、#218)
6
35
 
7
36
  ### Added
@@ -49,14 +49,15 @@ nx-kv docs bind --repo <仓库key> --ref ref:<refId> --json # 仓库的主
49
49
  nx-kv docs bind --board <组key> --ref ref:<refId> --json # 组的主篇
50
50
 
51
51
  # ③ 挂成补充篇 / 附加篇
52
- nx-kv repo doc add --id <仓库key> --ref ref:<refId> --note "<这篇在仓库里的说明>" --json
53
- nx-kv docs link --board <组key> --ref ref:<refId> --note "<这篇在组里的说明>" --json
52
+ nx-kv repo doc add --id <仓库key> --ref ref:<refId> --json
53
+ nx-kv docs link --board <组key> --ref ref:<refId> --json
54
54
 
55
55
  # ④ 挂成「组内仓库的那一篇」
56
56
  nx-kv docs note-bind --board <组key> --repo <仓库key> --ref ref:<refId> --json
57
57
  ```
58
58
 
59
- 同一篇 ref 重复添加 = 更新注解(不会多出一份)。
59
+ 同一篇 ref 重复添加 = 把它移到新位置(不会多出一份);条目上的说明
60
+ (desc)在文档本体里,v13 起关系表不再存 note。
60
61
 
61
62
  ### 3.1 把「一轮问答」归档成一篇(#137 内置任务模板「ref 生成」)
62
63
 
@@ -106,8 +107,8 @@ nx-kv docs ref add --owner repo --repo <参考仓库key> --desc "<这篇是什
106
107
  # ② 挂成主篇(这个参考仓库的「项目介绍」)
107
108
  nx-kv docs bind --repo <参考仓库key> --ref ref:<refId> --json
108
109
 
109
- # ③ 挂成补充篇(带一句说明)
110
- nx-kv repo doc add --id <参考仓库key> --ref ref:<refId> --note "<这篇在参考里的什么>" --json
110
+ # ③ 挂成补充篇
111
+ nx-kv repo doc add --id <参考仓库key> --ref ref:<refId> --json
111
112
 
112
113
  # ④ 查这一份文档列表(只有这个参考仓库自己的文档;每行 hostKind=ref)
113
114
  nx-kv docs bindings --host <参考仓库key> --json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx-kv",
3
- "version": "0.63.0",
3
+ "version": "0.64.0",
4
4
  "description": "nx-kv — 本机任务队列(localtask)+ 文档库 + 仓库登记:serve 驱动 CLI 与 Web 面板,同源同构,附带可安装 skill 供 agent 提交 / 领取 / 阻塞接收任务",
5
5
  "type": "module",
6
6
  "bin": {
@@ -23,7 +23,7 @@
23
23
  "start": "pnpm run build && node --import tsx src/runtime/cli.ts serve",
24
24
  "link:local": "node scripts/link-local.mjs",
25
25
  "unlink:local": "node scripts/link-local.mjs --unlink",
26
- "lint": "eslint . && node scripts/check-tdz.mjs --all && node scripts/check-schema-decisions.mjs && node scripts/check-lines.mjs && node scripts/check-skill-sop.mjs",
26
+ "lint": "eslint . && node scripts/check-tdz.mjs --all && node scripts/check-schema-decisions.mjs && node scripts/check-lines.mjs && node scripts/check-skill-sop.mjs && node scripts/check-test-isolation.mjs",
27
27
  "check:schema": "node scripts/check-schema-decisions.mjs",
28
28
  "check:skill": "node scripts/check-skill-sop.mjs",
29
29
  "test": "pnpm run lint && pnpm run typecheck && pnpm run build && pnpm run test:smoke && pnpm run test:unit",
@@ -119,7 +119,6 @@ export interface RefBindingRow {
119
119
  refId?: string;
120
120
  type?: string;
121
121
  position?: number;
122
- note?: string;
123
122
  atMs?: number;
124
123
  }
125
124
 
@@ -130,20 +129,18 @@ export function putRefBinding(conn: any, {
130
129
  refId,
131
130
  type = 'repo',
132
131
  position = 0,
133
- note = '',
134
132
  atMs = Date.now(),
135
133
  }: RefBindingRow = {}): void {
136
- // tag 列已在 schema v12 删除(分类标签概念整个去掉)
134
+ // tag 列在 v12 删(分类标签),note 列在 v13 删(关系表不挂业务注解)
137
135
  conn.run(
138
- `INSERT OR IGNORE INTO ref_bindings (repo_key, group_key, ref_id, type, position, note, created_at)
139
- VALUES (:repo, :group, :ref, :type, :pos, :note, :at)`,
136
+ `INSERT OR IGNORE INTO ref_bindings (repo_key, group_key, ref_id, type, position, created_at)
137
+ VALUES (:repo, :group, :ref, :type, :pos, :at)`,
140
138
  {
141
139
  repo: String(repoKey || ''),
142
140
  group: groupKey == null ? null : String(groupKey),
143
141
  ref: String(refId || ''),
144
142
  type: String(type || 'repo'),
145
143
  pos: Number(position) || 0,
146
- note: String(note || ''),
147
144
  at: atMs,
148
145
  }
149
146
  );
@@ -106,13 +106,13 @@ export function listRefAttachments(conn: any, refId?: string | number): LinkedAt
106
106
  `SELECT a.id, a.kind, a.name, a.local_path, a.url, a.mime, a.size, a.hash, a.storage,
107
107
  a.group_id, a.target_kind, a.target_key, a.target_seq, a.meta,
108
108
  a.abs_path, a.anchor_dir, a.missing_at, a.last_seen_at,
109
- a.deleted_at, a.created_at, a.updated_at, ra.role, ra.position, ra.note
109
+ a.deleted_at, a.created_at, a.updated_at, ra.role, ra.position
110
110
  FROM ref_attach ra JOIN attachments a ON a.id = ra.attachment_id
111
111
  WHERE ra.ref_id = :id AND a.deleted_at IS NULL
112
112
  ORDER BY ra.position, a.id`,
113
113
  { id: String(refId || '') }
114
114
  )
115
- .map((r: any) => ({ ...rowView(r), role: r.role, position: Number(r.position) || 0, note: r.note }));
115
+ .map((r: any) => ({ ...rowView(r), role: r.role, position: Number(r.position) || 0, note: '' }));
116
116
  }
117
117
 
118
118
  /**
@@ -42,15 +42,18 @@ export interface LinkAttachmentInput {
42
42
  /**
43
43
  * 写一条宿主 ↔ 资源的关系(upsert,带 role 优先级)。
44
44
  *
45
- * note 是**边上的说明**(desc):只在与现存 role 同级且调用方**显式给了** note
45
+ * note 是**任务附件边上的说明**(desc):只在与现存 role 同级且调用方**显式给了** note
46
46
  * (!== undefined)时才更新——正文同步等不关心 note 的调用方不传,就不会把
47
- * 用户写的说明冲掉(#162:attach --ref --note 走 embed 路径时说明不再丢)。
47
+ * 用户写的说明冲掉(#162)。#148 起 ref_attach 的 note 列已删(关系表不挂业务字段),
48
+ * 所以只有 host==='task' 才写 note;ref 侧传入的 note 一律忽略。
48
49
  * @returns {string} 实际落库的 role
49
50
  */
50
51
  export function linkAttachment(conn: any, {
51
52
  host, hostId, attachmentId, role = 'attach', position, note, atMs = Date.now(),
52
53
  }: LinkAttachmentInput = {}): AttachmentRole {
53
54
  const h = hostOf(host);
55
+ const withNote = host === 'task'; // v13:只有 task_attach 还有 note 列
56
+ const effNote = withNote ? note : undefined;
54
57
  const hostVal = host === 'task' ? Number(hostId) : String(hostId || '');
55
58
  const att = String(attachmentId || '');
56
59
  if (!att) throw new Error('linkAttachment 需要 attachmentId');
@@ -68,7 +71,7 @@ export function linkAttachment(conn: any, {
68
71
  if (curRank > newRank) return cur.role; // 显式边不被正文降级
69
72
  if (curRank === newRank) {
70
73
  const pos = position === undefined ? cur.position : position;
71
- if (note === undefined) {
74
+ if (effNote === undefined) {
72
75
  conn.run(
73
76
  `UPDATE ${h.table} SET position = :pos WHERE ${h.col} = :host AND attachment_id = :att`,
74
77
  { pos: Number(pos) || 0, host: hostVal, att }
@@ -77,16 +80,24 @@ export function linkAttachment(conn: any, {
77
80
  conn.run(
78
81
  `UPDATE ${h.table} SET position = :pos, note = :note
79
82
  WHERE ${h.col} = :host AND attachment_id = :att`,
80
- { pos: Number(pos) || 0, note: String(note || ''), host: hostVal, att }
83
+ { pos: Number(pos) || 0, note: String(effNote || ''), host: hostVal, att }
81
84
  );
82
85
  }
83
86
  return cur.role;
84
87
  }
85
- conn.run(
86
- `UPDATE ${h.table} SET role = :role, position = :pos, note = :note
87
- WHERE ${h.col} = :host AND attachment_id = :att`,
88
- { role, pos: Number(position) || 0, note: String(note || ''), host: hostVal, att }
89
- );
88
+ if (effNote === undefined) {
89
+ conn.run(
90
+ `UPDATE ${h.table} SET role = :role, position = :pos
91
+ WHERE ${h.col} = :host AND attachment_id = :att`,
92
+ { role, pos: Number(position) || 0, host: hostVal, att }
93
+ );
94
+ } else {
95
+ conn.run(
96
+ `UPDATE ${h.table} SET role = :role, position = :pos, note = :note
97
+ WHERE ${h.col} = :host AND attachment_id = :att`,
98
+ { role, pos: Number(position) || 0, note: String(effNote || ''), host: hostVal, att }
99
+ );
100
+ }
90
101
  return role;
91
102
  }
92
103
  let pos = position;
@@ -99,11 +110,19 @@ export function linkAttachment(conn: any, {
99
110
  );
100
111
  pos = Number((row && row.next) || 0);
101
112
  }
102
- conn.run(
103
- `INSERT INTO ${h.table} (${h.col}, attachment_id, role, position, note, created_at)
104
- VALUES (:host, :att, :role, :pos, :note, :at)`,
105
- { host: hostVal, att, role, pos: Number(pos) || 0, note: String(note || ''), at: atMs }
106
- );
113
+ if (effNote === undefined) {
114
+ conn.run(
115
+ `INSERT INTO ${h.table} (${h.col}, attachment_id, role, position, created_at)
116
+ VALUES (:host, :att, :role, :pos, :at)`,
117
+ { host: hostVal, att, role, pos: Number(pos) || 0, at: atMs }
118
+ );
119
+ } else {
120
+ conn.run(
121
+ `INSERT INTO ${h.table} (${h.col}, attachment_id, role, position, note, created_at)
122
+ VALUES (:host, :att, :role, :pos, :note, :at)`,
123
+ { host: hostVal, att, role, pos: Number(pos) || 0, note: String(effNote || ''), at: atMs }
124
+ );
125
+ }
107
126
  return role;
108
127
  }
109
128
 
@@ -123,6 +142,7 @@ export function updateAttachmentNote(conn: any, {
123
142
  host, hostId, attachmentId, note = '',
124
143
  }: UpdateAttachmentNoteInput = {}): number {
125
144
  const h = hostOf(host);
145
+ if (host !== 'task') return 0; // v13:ref_attach 无 note 列,任务侧才有说明
126
146
  const hostVal = host === 'task' ? Number(hostId) : String(hostId || '');
127
147
  const att = String(attachmentId || '');
128
148
  if (!att) return 0;
@@ -205,16 +225,11 @@ export function syncRefAttachments(conn: any, {
205
225
  const att = ensureAttachment(conn, r, { atMs });
206
226
  if (att && !rows.some((x) => x.id === att)) rows.push({ id: att, role: r.role });
207
227
  }
208
- // 同任务侧:整组重写保留边上的说明(note)。
209
- const notes = new Map(
210
- (conn.all("SELECT attachment_id, note FROM ref_attach WHERE ref_id = :id AND role IN ('inline', 'reference')", { id }) as Array<{ attachment_id: string; note: string }>)
211
- .map((r): [string, string] => [r.attachment_id, r.note])
212
- );
228
+ // v13:ref_attach 的 note 列已删,整组重写不再有「保留边上说明」这一步
213
229
  conn.run("DELETE FROM ref_attach WHERE ref_id = :id AND role IN ('inline', 'reference')", { id });
214
230
  rows.forEach((x, pos) => {
215
231
  linkAttachment(conn, {
216
- host: 'ref', hostId: id, attachmentId: x.id, role: x.role, position: pos,
217
- note: notes.has(x.id) ? notes.get(x.id) : undefined, atMs,
232
+ host: 'ref', hostId: id, attachmentId: x.id, role: x.role, position: pos, atMs,
218
233
  });
219
234
  });
220
235
  return rows.length;
@@ -14,7 +14,6 @@ import type { Dirent } from 'node:fs';
14
14
  interface DocRefEntry {
15
15
  locator: string;
16
16
  type: string;
17
- note: string;
18
17
  extPath: string;
19
18
  }
20
19
 
@@ -98,8 +97,7 @@ export function importRefs(
98
97
  groupKey: string | null,
99
98
  locator: string,
100
99
  type: string,
101
- position: number,
102
- note: string
100
+ position: number
103
101
  ): boolean => {
104
102
  if (!fileSet.has(locator)) return false;
105
103
  const id = idOfLocator(locator);
@@ -107,9 +105,9 @@ export function importRefs(
107
105
  // ON CONFLICT 的冲突目标带表达式(COALESCE)在 SQLite 里要写成一模一样的表达式,
108
106
  // 这里用 INSERT OR IGNORE:绑定边重复插是幂等的正常情况,不该报错。
109
107
  const r = db.run(
110
- `INSERT OR IGNORE INTO ref_bindings (repo_key, group_key, ref_id, type, position, note, created_at)
111
- VALUES (:repo, :group, :ref, :type, :pos, :note, :at)`,
112
- { repo: repoKey, group: groupKey, ref: id, type, pos: position, note, at: atMs }
108
+ `INSERT OR IGNORE INTO ref_bindings (repo_key, group_key, ref_id, type, position, created_at)
109
+ VALUES (:repo, :group, :ref, :type, :pos, :at)`,
110
+ { repo: repoKey, group: groupKey, ref: id, type, pos: position, at: atMs }
113
111
  );
114
112
  if (Number(r.changes) > 0) report.imported.refBindings += 1;
115
113
  return true;
@@ -121,19 +119,19 @@ export function importRefs(
121
119
  // DocRef(本机 repos.json 没有这些字段,代码保留给别的机器)
122
120
  const docRefsOf = (host: any): DocRefEntry[] => {
123
121
  const out: DocRefEntry[] = [];
124
- const pushRef = (ref: any, note: string = ''): void => {
122
+ const pushRef = (ref: any): void => {
125
123
  if (!ref || typeof ref !== 'object') return;
126
124
  // 旧 JSON 里的键名就叫 rel(v6 之前的字段名);读出来一律当 **locator** 用。
127
125
  const legacyPath = String(ref.rel || '').trim();
128
126
  const path = String(ref.path || '').trim();
129
- if (legacyPath) out.push({ locator: legacyPath, type: 'md', note: String(note || ''), extPath: '' });
127
+ if (legacyPath) out.push({ locator: legacyPath, type: 'md', extPath: '' });
130
128
  // v2 起 refs 只装文档:外部 .md 绝对路径也是文档,type 统一为 md。
131
- else if (path) out.push({ locator: path, type: 'md', note: String(note || ''), extPath: path });
129
+ else if (path) out.push({ locator: path, type: 'md', extPath: path });
132
130
  };
133
131
  pushRef(host && host.doc);
134
132
  for (const l of Array.isArray(host && host.docLinks) ? host.docLinks : []) pushRef(l);
135
133
  if (host && host.repoDocs && typeof host.repoDocs === 'object') {
136
- for (const [k, v] of Object.entries(host.repoDocs)) pushRef(v, k);
134
+ for (const [, v] of Object.entries(host.repoDocs)) pushRef(v);
137
135
  }
138
136
  return out;
139
137
  };
@@ -149,8 +147,8 @@ export function importRefs(
149
147
  }
150
148
  // 约定路径:目录主篇优先,其次旧单文件(与 docs 模块的读回落顺序一致)
151
149
  position = 0;
152
- const boundMain = bind(key, null, `repo/${key}/index.md`, 'repo', position, '');
153
- if (!boundMain) bind(key, null, `repo/${key}.md`, 'repo', position, '');
150
+ const boundMain = bind(key, null, `repo/${key}/index.md`, 'repo', position);
151
+ if (!boundMain) bind(key, null, `repo/${key}.md`, 'repo', position);
154
152
  position += 1;
155
153
  for (const d of docRefsOf(r)) {
156
154
  if (d.extPath) {
@@ -172,9 +170,9 @@ export function importRefs(
172
170
  continue;
173
171
  }
174
172
  const br = db.run(
175
- `INSERT OR IGNORE INTO ref_bindings (repo_key, group_key, ref_id, type, position, note, created_at)
176
- VALUES (:repo, NULL, :ref, 'repo', :pos, :note, :at)`,
177
- { repo: key, ref: idOfLocator(d.locator), pos: position, note: d.note, at: atMs }
173
+ `INSERT OR IGNORE INTO ref_bindings (repo_key, group_key, ref_id, type, position, created_at)
174
+ VALUES (:repo, NULL, :ref, 'repo', :pos, :at)`,
175
+ { repo: key, ref: idOfLocator(d.locator), pos: position, at: atMs }
178
176
  );
179
177
  if (Number(br.changes) > 0) report.imported.refBindings += 1;
180
178
  position += 1;
@@ -193,8 +191,8 @@ export function importRefs(
193
191
  continue;
194
192
  }
195
193
  const seg = base.slice('group/'.length);
196
- const boundGroup = bind(gk, null, `board/${seg}/index.md`, 'group', 0, '');
197
- if (!boundGroup) bind(gk, null, `board/${seg}.md`, 'group', 0, '');
194
+ const boundGroup = bind(gk, null, `board/${seg}/index.md`, 'group', 0);
195
+ if (!boundGroup) bind(gk, null, `board/${seg}.md`, 'group', 0);
198
196
  for (const repoKeyRaw of Array.isArray(b.repoKeys) ? b.repoKeys : []) {
199
197
  const repoKey = repoKeyById.get(String(repoKeyRaw || '').trim()) || String(repoKeyRaw || '').trim();
200
198
  if (!repoKey) continue;
@@ -202,8 +200,8 @@ export function importRefs(
202
200
  report.warnings.push({ what: 'docRef', why: '组成员不存在,已跳过成员文档绑定', group: gk, repo: repoKey });
203
201
  continue;
204
202
  }
205
- const boundMember = bind(repoKey, gk, `group/${seg}/${repoKey}/index.md`, 'group_repo', 0, '');
206
- if (!boundMember) bind(repoKey, gk, `group/${seg}/${repoKey}.md`, 'group_repo', 0, '');
203
+ const boundMember = bind(repoKey, gk, `group/${seg}/${repoKey}/index.md`, 'group_repo', 0);
204
+ if (!boundMember) bind(repoKey, gk, `group/${seg}/${repoKey}.md`, 'group_repo', 0);
207
205
  }
208
206
  }
209
207
 
@@ -146,10 +146,8 @@ export function importRepos(db: DbApi, reposData: any, atMs: number, report: Imp
146
146
  boards.forEach((b: any, bi: number) => {
147
147
  const groupKey = groupKeys[bi];
148
148
  if (!groupKey) return;
149
- const notesIn = b.repoNotes && typeof b.repoNotes === 'object' ? b.repoNotes : {};
150
149
  let keys: any[] = Array.isArray(b.repoKeys) ? b.repoKeys : [];
151
- let notes: any = notesIn;
152
- // 老结构(迁移前的存量数据):成员存随机 id(repoIds / repoNotes 按 id 键)。
150
+ // 老结构(迁移前的存量数据):成员存随机 id(repoIds 按 id)。
153
151
  // repos 已全部入库(legacyIdToKey 齐),一次性换算成 key;换算不到的丢弃 + 报告
154
152
  //(与 JSON 时代 keys.js migrateRelations 同一口径,只是搬进了导入事务)。
155
153
  const oldIds = Array.isArray(b.repoIds) ? b.repoIds : null;
@@ -160,8 +158,6 @@ export function importRepos(db: DbApi, reposData: any, atMs: number, report: Imp
160
158
  if (k) keys.push(k);
161
159
  else report.warnings.push({ what: 'member', why: 'repoIds 里的 id 换算不到 key(登记缺失),已丢弃', group: groupKey, id: String(id) });
162
160
  }
163
- notes = {};
164
- for (const [k, v] of Object.entries(notesIn)) notes[legacyIdToKey.get(String(k)) || k] = v;
165
161
  report.warnings.push({ what: 'member', why: 'repoIds(旧结构)已换算为 repoKeys', group: groupKey, count: keys.length });
166
162
  }
167
163
  keys.forEach((repoKeyRaw: any, position: number) => {
@@ -177,10 +173,10 @@ export function importRepos(db: DbApi, reposData: any, atMs: number, report: Imp
177
173
  return;
178
174
  }
179
175
  db.run(
180
- `INSERT INTO repo_group_members (group_key, repo_key, position, note, created_at)
181
- VALUES (:g, :r, :pos, :note, :at)
176
+ `INSERT INTO repo_group_members (group_key, repo_key, position, created_at)
177
+ VALUES (:g, :r, :pos, :at)
182
178
  ON CONFLICT(group_key, repo_key) DO NOTHING`,
183
- { g: groupKey, r: repoKey, pos: position, note: String(notes[repoKey] || ''), at: atMs }
179
+ { g: groupKey, r: repoKey, pos: position, at: atMs }
184
180
  );
185
181
  report.imported.members += 1;
186
182
  });
@@ -63,6 +63,7 @@ export const DIRECT_EDGES: MigrationStep[] = [
63
63
  { from: 9, to: 10, file: 'v10.sql', title: '附件新增 folder 类型(本地文件夹路径指针;重建 attachments 扩 CHECK)' },
64
64
  { from: 10, to: 11, file: 'v11.sql', title: '孤儿 ref 失绑计时(orphan_since)与到期清理留痕(ref_gc_log)', apply: migrateOrphanRefs },
65
65
  { from: 11, to: 12, file: 'v12.sql', title: '去掉分类标签概念(删 ref_bindings.tag)' },
66
+ { from: 12, to: 13, file: 'v13.sql', title: '去掉关系表上的业务 note(4 张表 drop note 列)' },
66
67
  ];
67
68
 
68
69
  // 人读版本说明(docs/decisions 是决策的唯一权威位置,里面对应一份 date 化的 .md)
@@ -79,6 +80,7 @@ export const VERSION_NOTES = {
79
80
  10: 'docs/decisions/versions/2026-11-14-v10.md',
80
81
  11: 'docs/decisions/versions/2026-11-15-v11.md',
81
82
  12: 'docs/decisions/versions/2026-11-16-v12.md',
83
+ 13: 'docs/decisions/versions/2026-11-17-v13.md',
82
84
  };
83
85
 
84
86
  const keyOf = (from: number, to: number): string => `${from}->${to}`;
@@ -0,0 +1,24 @@
1
+ -- schema v13:彻底删除「关系表上的业务 note」概念
2
+ --
3
+ -- 口径(2026-11-17 用户拍板,任务 #148):note 是前期错误的设计——
4
+ -- 1. 关系表(ref_bindings / ref_attach / group_refs / repo_group_members)
5
+ -- 本身就表达「多对多」,不该再挂一个业务字段当说明;
6
+ -- 2. 文档描述已经落到 ref 自己的 desc(v7)+ 正文标题(#168)上,
7
+ -- 参考仓库的描述也走「绑定 ref 的文档列表」(v12 的 link_notes 机制),
8
+ -- note 在界面上要么被 desc 覆盖、要么根本没显示;
9
+ -- 3. web 已经完全基于文档列表:note 既没有显示位、也不该当搜索依据。
10
+ -- 无效概念就该从根上删掉,而不是留着假装有用。
11
+ --
12
+ -- 本次动作:4 张关系表的 note 列直接删(DROP COLUMN)。
13
+ -- · ref_bindings.note —— 某份文档在某个列表里的一句话(被 desc 取代)
14
+ -- · ref_attach.note —— 附件绑定说明
15
+ -- · group_refs.note —— 参考仓库在组/仓库里参考什么(走 link_notes 描述文档)
16
+ -- · repo_group_members.note —— 仓库在组里的说明(主体是成员关系,无显示位)
17
+ -- 历史 DDL 快照(v1/v4/v5/v6/v9/v10)保持不可变,靠本迁移 drop。
18
+ --
19
+ -- 不删(主体不是关系):task_links.note(派生一句话)、repos.notes(仓库自身备注,
20
+ -- 但 web 的表单/展示位本轮一并移除,列暂留以兼容旧数据)、task_attach.note(任务附件说明)。
21
+ ALTER TABLE ref_bindings DROP COLUMN note;
22
+ ALTER TABLE ref_attach DROP COLUMN note;
23
+ ALTER TABLE group_refs DROP COLUMN note;
24
+ ALTER TABLE repo_group_members DROP COLUMN note;
@@ -252,9 +252,16 @@ export function seedBuiltinTemplates(conn: DbApi, atMs: number): number {
252
252
  /**
253
253
  * 出厂正文自愈(#218;seedBuiltinTemplates 的第 ③ 步,独立导出以便单测)。
254
254
  *
255
- * 命中条件只有一个:内置行的 body **等于**「出厂文本按默认值渲染后的样子」。
256
- * 那正是旧编辑器「先渲染再编辑、保存回库」留下的产物 —— 插槽变成了提示文字。
257
- * 用户只要动过任何一个字(改写骨架、换掉提示、加一段),body 就对不上,一律不动。
255
+ * 两条判据,都只碰 `builtin = 1` 的行(用户自建模板 builtin=0,一律不动):
256
+ *
257
+ * ① **逐字相等**:body === 「出厂文本按默认值渲染后的样子」。
258
+ * 旧编辑器「先渲染再编辑、保存回库」的产物,插槽变了提示文字。
259
+ * ② **渲染残留**:库里这行一个插槽都没有,**但还留着出厂的提示文字**
260
+ * (`{{content}}` 被替换成的「(把你要问这个仓库的问题写在这里)」)。
261
+ * 跨了几个版本之后 ① 对不上(出厂文本本身改过),但症状一样:正文里再也
262
+ * 检不出槽位,「新建任务」永远进不了参数填写页(#153 验收反馈)。
263
+ * 只认「提示文字还在」这一种残留——用户手写的正文里没有这句提示,
264
+ * 照旧按 T06 不动。
258
265
  *
259
266
  * 返回被恢复的模板 id(正常库上是空数组,幂等)。
260
267
  */
@@ -268,7 +275,11 @@ export function healRenderedBuiltinBodies(conn: DbApi, atMs: number): string[] {
268
275
  | { body?: string; builtin?: number }
269
276
  | undefined;
270
277
  if (!row || !Number(row.builtin)) continue;
271
- if (String(row.body || '') !== eaten) continue;
278
+ const cur = String(row.body || '');
279
+ const rendered = cur === eaten;
280
+ // 跨版本的渲染残留:没有插槽,但出厂提示文字还在(= 旧编辑器把插槽渲染成了提示)
281
+ const staleRender = !hasSlot(cur) && cur.includes(CONTENT_HINT);
282
+ if (!rendered && !staleRender) continue;
272
283
  conn.run(
273
284
  `UPDATE templates SET body = :body, vars = :vars, updated_at = :at
274
285
  WHERE id = :id AND builtin = 1`,
@@ -38,7 +38,9 @@
38
38
  // 新增 ref_gc_log(孤儿到期清理的不可变留痕)。存量孤儿按升级时刻起算。
39
39
  // v12(2026-11-16):去掉「分类标签」概念——删 ref_bindings.tag 列。
40
40
  // 关系描述文档的定位不走 tag:desc 就在 ref 上。
41
- export const CURRENT_SCHEMA_VERSION = 12;
41
+ // v13(2026-11-17):彻底删除「关系表上的业务 note」概念——4 张关系表 drop note 列。
42
+ // 关系表本身就表达多对多;文档描述走 ref.desc + 正文标题,参考仓库描述走绑定 ref 的文档。
43
+ export const CURRENT_SCHEMA_VERSION = 13;
42
44
 
43
45
  /**
44
46
  * 运行时最低 Node 版本。
@@ -6,7 +6,6 @@
6
6
 
7
7
  import type { ActionBase } from '../../../runtime/action-base.js';
8
8
  import type { Container } from '../../../runtime/container.js';
9
- import { DocAttachNoteAction } from './doc-attach-note.js';
10
9
  import { DocAttachAction } from './doc-attach.js';
11
10
  import { DocAttachmentsAction } from './doc-attachments.js';
12
11
  import { DocDetachAction } from './doc-detach.js';
@@ -31,7 +30,6 @@ import { DocsOrphansAction } from './docs-orphans.js';
31
30
 
32
31
  /** 本模块的全部 action 类(容器按这个顺序建实例)。 */
33
32
  export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
34
- DocAttachNoteAction,
35
33
  DocAttachAction,
36
34
  DocAttachmentsAction,
37
35
  DocDetachAction,
@@ -56,7 +54,6 @@ export const ACTIONS: readonly (new (deps: Container) => ActionBase)[] = [
56
54
  ];
57
55
 
58
56
  // 再导出类本身:前端 apiclient 的返回类型从这里 type-only 引用(实现即契约)。
59
- export { DocAttachNoteAction };
60
57
  export { DocAttachAction };
61
58
  export { DocAttachmentsAction };
62
59
  export { DocDetachAction };
@@ -20,7 +20,6 @@ const input = z.object({
20
20
  mdfile: z.string().optional().describe("本地 .md 文件路径(kind=mdfile:只登记指针,不复制正文)"),
21
21
  folder: z.string().optional().describe("本地文件夹路径(kind=folder:只登记目录路径,不复制内容)"),
22
22
  name: z.string().optional().describe("显示名(默认取文件名/原名)"),
23
- note: z.string().optional().describe("附件区备注"),
24
23
  noEmbed: z.boolean().optional().describe("只写 ref_attach(role=attach),不改正文"),
25
24
  'no-embed': z.boolean().optional().describe("同 --noEmbed"),
26
25
  });
@@ -87,11 +87,9 @@ export class DocsBindingsAction extends ActionBase<typeof input> {
87
87
  http: ['GET', '/api/docs/bindings'],
88
88
  summary: '查文档归属(--ref <refId> 看这篇被谁引用;--host <repo> 只看仓库自己的文档;--group <组> 看组域文档集:组 → 组内仓库 → 成员仓库自己 → 组内参考仓库自己;hostKind 标宿主是开发仓库/参考仓库/组;position=0 为主篇)',
89
89
  input,
90
- // 备注(只有附加篇有:主篇 push 时不带 note)跟着 main 一起打,和前端注解上的
91
- // 「附加 · 备注」保持同一口径——否则 CLI 里看不出自己刚填的备注有没有落库。
92
90
  render: (d: any) => (d.bindings || [])
93
91
  .map((b: any) => {
94
- const role = b.main ? '主篇' : b.note ? `附加 · ${b.note}` : '附加';
92
+ const role = b.main ? '主篇' : '附加';
95
93
  const label = b.desc || b.title || b.refId;
96
94
  return ` ${b.type} ${b.repoKey}${b.groupKey ? ' @' + b.groupKey : ''} ${role} ${label} [${b.refId}]`;
97
95
  })
@@ -153,7 +151,7 @@ export class DocsBindingsAction extends ActionBase<typeof input> {
153
151
  }
154
152
 
155
153
  const rows = db.all(
156
- `SELECT b.repo_key AS repoKey, b.group_key AS groupKey, b.type, b.position, b.note,
154
+ `SELECT b.repo_key AS repoKey, b.group_key AS groupKey, b.type, b.position,
157
155
  r.id AS refId, r."desc", r.origin, r.locator,
158
156
  CASE WHEN rb.ref_id IS NULL THEN 0 ELSE 1 END AS has_body,
159
157
  rb.body
@@ -184,7 +182,6 @@ export class DocsBindingsAction extends ActionBase<typeof input> {
184
182
  type,
185
183
  position,
186
184
  main: position === 0,
187
- note: String(r.note || ''),
188
185
  // 宿主 kind(#132):dev 开发仓库 / ref 参考仓库 / group 组。
189
186
  // 参考仓库与开发仓库在底层只有这一个差异,列表上标出来才不会看不懂。
190
187
  hostKind: kindOf.get(String(r.repoKey)) || 'dev',
@@ -14,7 +14,6 @@ const input = z.object({
14
14
  board: z.string(),
15
15
  ref: z.string().optional().describe("文档 refId(ref_<16hex>)"),
16
16
  path: z.string().optional().describe("外部文件/目录绝对路径(登记成 origin=external 的 ref)"),
17
- note: z.string().optional().describe("条目说明"),
18
17
  remove: z.number().optional().describe("移除第 N 条(1 起)"),
19
18
  before: z.number().optional().describe("插到第 N 条之前(缺省追加到末尾)"),
20
19
  });
@@ -24,7 +23,7 @@ export class DocsLinkAction extends ActionBase<typeof input> {
24
23
  id: 'docs.link',
25
24
  cli: ['docs', 'link'],
26
25
  http: ['POST', '/api/docs/link'],
27
- summary: '维护组的附加文档列表(--ref <refId> | --path <外部路径> + --note;--remove <序号> 移除;--before <序号> 插位;同 ref 重复添加 = 更新)',
26
+ summary: '维护组的附加文档列表(--ref <refId> | --path <外部路径>;--remove <序号> 移除;--before <序号> 插位;同 ref 重复添加 = 移位)',
28
27
  args: ['board'],
29
28
  input,
30
29
  render: renderLink,
@@ -15,7 +15,6 @@ import {
15
15
  registerMdfile,
16
16
  registerFolder,
17
17
  unlinkAttachment,
18
- updateAttachmentNote,
19
18
  upsertFileAttachment,
20
19
  } from '../../core/attachmentdb.js';
21
20
  import type { LinkedAttachmentView } from '../../core/attachmentdb/query.js';
@@ -88,7 +87,6 @@ export interface AttachToDocCtx {
88
87
  /** 本地文件夹(登记为 kind=folder,只存路径) */
89
88
  folder?: unknown;
90
89
  noEmbed?: unknown;
91
- note?: unknown;
92
90
  [key: string]: unknown;
93
91
  }
94
92
 
@@ -209,7 +207,7 @@ export async function attachToDoc(ctx: AttachToDocCtx): Promise<AttachToDocResul
209
207
  if (noEmbed) {
210
208
  tx(
211
209
  (conn) => {
212
- linkAttachment(conn, { host: 'ref', hostId: hostRefId, attachmentId, role: 'attach', note: ctx.note as string | undefined });
210
+ linkAttachment(conn, { host: 'ref', hostId: hostRefId, attachmentId, role: 'attach' });
213
211
  },
214
212
  { db, mode: 'IMMEDIATE' }
215
213
  );
@@ -230,39 +228,6 @@ export async function attachToDoc(ctx: AttachToDocCtx): Promise<AttachToDocResul
230
228
  };
231
229
  }
232
230
 
233
- /** docs attach --note 的入参。 */
234
- export interface NoteOnDocInput {
235
- ref?: unknown;
236
- attachment?: unknown;
237
- note?: unknown;
238
- }
239
-
240
- /** docs attach --note 的出参。 */
241
- export interface NoteOnDocResult {
242
- refId: string;
243
- attachment: string;
244
- note: string;
245
- }
246
-
247
- /**
248
- * 改一条文档侧绑定上的说明(desc,#168):与任务侧同一口径——只动 note。
249
- */
250
- export async function noteOnDoc({ ref, attachment, note = '' }: NoteOnDocInput = {}): Promise<NoteOnDocResult> {
251
- const { refId } = await docRefOf(ref);
252
- const attId = String(attachment || '').trim();
253
- if (!attId) throw badInput('需要 --attachment <资源 id>(见 docs attachments 输出)');
254
- const db = getDb();
255
- let changed = 0;
256
- tx(
257
- (conn) => {
258
- changed = updateAttachmentNote(conn, { host: 'ref', hostId: refId, attachmentId: attId, note: note as string | undefined });
259
- },
260
- { db, mode: 'IMMEDIATE' }
261
- );
262
- if (!changed) throw badInput(`这篇文档上没有附件 ${attId}`);
263
- return { refId, attachment: attId, note: String(note || '') };
264
- }
265
-
266
231
  /** docs detach 的入参。 */
267
232
  export interface DetachFromDocInput {
268
233
  ref?: unknown;
@@ -35,7 +35,7 @@ export function boundDocs({ repoKey = '', groupKey = '' }: { repoKey?: string; g
35
35
  const group = String(groupKey || '').trim();
36
36
  if (!repo && !group) return [];
37
37
  const rows: any[] = getDb().all(
38
- `SELECT b.type, b.repo_key, b.group_key, b.position, b.note,
38
+ `SELECT b.type, b.repo_key, b.group_key, b.position,
39
39
  r.id AS ref_id, r."desc", r.origin,
40
40
  CASE WHEN rb.ref_id IS NULL THEN 0 ELSE 1 END AS has_body,
41
41
  rb.body
@@ -67,7 +67,7 @@ export function boundDocs({ repoKey = '', groupKey = '' }: { repoKey?: string; g
67
67
  repoKey: String(x.repo_key || ''),
68
68
  groupKey: x.group_key == null ? null : String(x.group_key),
69
69
  position,
70
- note: String(x.note || ''),
70
+ note: '', // v13 起 ref_bindings 无 note 列;字段保留仅为兼容旧调用方
71
71
  body,
72
72
  };
73
73
  });