nx-kv 0.64.0 → 0.65.2

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 (151) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/assets/nx-kv/SKILL.md +5 -2
  3. package/assets/nx-kv/references/A03-/346/226/207/346/241/243/344/270/216/345/275/222/345/261/236.md +6 -0
  4. package/assets/nx-kv/references/A04-/344/273/223/345/272/223/344/270/216/351/241/271/347/233/256/347/273/204.md +79 -6
  5. package/assets/nx-kv/templates/ref-main-doc.md +46 -0
  6. package/package.json +1 -1
  7. package/src/core/db/seed-templates.ts +2 -86
  8. package/src/modules/localtask/task-lifecycle.ts +1 -1
  9. package/src/modules/promptplug/actions/_manifest.generated.ts +9 -0
  10. package/src/modules/promptplug/actions/prompt-registry.ts +4 -1
  11. package/src/modules/promptplug/actions/prompt-template-activate.ts +31 -0
  12. package/src/modules/promptplug/actions/prompt-template-delete.ts +30 -0
  13. package/src/modules/promptplug/actions/prompt-template-save.ts +52 -0
  14. package/src/modules/promptplug/delivery.ts +151 -0
  15. package/src/modules/promptplug/factory.ts +16 -8
  16. package/src/modules/promptplug/index.ts +3 -1
  17. package/src/modules/promptplug/plugins/doneguard.ts +3 -0
  18. package/src/modules/promptplug/plugins/getloop.ts +8 -7
  19. package/src/modules/{tasktool/plugins/goal-template.ts → promptplug/plugins/goal-prompt.ts} +57 -4
  20. package/src/modules/promptplug/plugins/goal-shape.ts +17 -0
  21. package/src/modules/promptplug/plugins/goalhint.ts +22 -9
  22. package/src/modules/promptplug/plugins/timecheck.ts +25 -14
  23. package/src/modules/promptplug/registry.ts +3 -3
  24. package/src/modules/promptplug/template-store.ts +145 -0
  25. package/src/modules/tasktool/delivery.ts +231 -0
  26. package/src/modules/tasktool/get.ts +2 -2
  27. package/src/modules/tasktool/plugins/taskgoal-store.ts +28 -22
  28. package/src/modules/tasktool/plugins/timegoal-task-store.ts +70 -5
  29. package/src/modules/tasktool/plugins/waitgoal-config.ts +1 -25
  30. package/src/modules/tasktool/plugins/waitgoal.ts +0 -4
  31. package/src/modules/tasktool/preview.ts +3 -4
  32. package/src/modules/tasktool/wait.ts +16 -284
  33. package/src/modules/templates/actions/templates-default.ts +2 -5
  34. package/src/modules/templates/actions/templates-update.ts +1 -3
  35. package/src/modules/templates/service.ts +11 -13
  36. package/src/modules/templates/support.ts +0 -15
  37. package/src/web/frontend/App.tsx +0 -12
  38. package/src/web/frontend/api/cli-tree.json +58 -0
  39. package/src/web/frontend/api/client.generated.ts +32 -2
  40. package/src/web/frontend/components/doc/doc-head.tsx +13 -4
  41. package/src/web/frontend/components/icons.tsx +9 -199
  42. package/src/web/frontend/components/md/live-block.tsx +1 -5
  43. package/src/web/frontend/components/md/md-panes-root.tsx +0 -4
  44. package/src/web/frontend/components/md/md-panes.tsx +1 -11
  45. package/src/web/frontend/components/md/tool-bar.tsx +9 -0
  46. package/src/web/frontend/components/sidebar/index.tsx +13 -2
  47. package/src/web/frontend/components/sidebar/model.ts +3 -0
  48. package/src/web/frontend/components/tool-acts/bar.tsx +40 -29
  49. package/src/web/frontend/components/tool-acts/layout-panel.tsx +7 -3
  50. package/src/web/frontend/components/tool-acts/modules.ts +53 -51
  51. package/src/web/frontend/components/tool-acts/style.css +7 -3
  52. package/src/web/frontend/modules/md/styles/docs.css +0 -7
  53. package/src/web/frontend/modules/md/styles/editor.css +0 -17
  54. package/src/web/frontend/modules/md/styles/shell.css +3 -0
  55. package/src/web/frontend/modules/md/use-templates.ts +3 -13
  56. package/src/web/frontend/page/dir/index.tsx +3 -15
  57. package/src/web/frontend/page/dir/task-actions.ts +1 -16
  58. package/src/web/frontend/page/dir/task.tsx +2 -16
  59. package/src/web/frontend/page/group/index.tsx +6 -19
  60. package/src/web/frontend/page/repos/branch-persist.ts +32 -0
  61. package/src/web/frontend/page/repos/icons.tsx +47 -229
  62. package/src/web/frontend/page/repos/index.tsx +12 -8
  63. package/src/web/frontend/page/repos/repo-table.tsx +24 -3
  64. package/src/web/frontend/page/settings/api.ts +20 -0
  65. package/src/web/frontend/page/settings/index.tsx +1 -1
  66. package/src/web/frontend/page/settings/prompt-template-editor.tsx +180 -0
  67. package/src/web/frontend/page/settings/prompt-templates-section.tsx +39 -34
  68. package/src/web/frontend/page/settings/style.css +30 -0
  69. package/src/web/frontend/page/templates/index.tsx +5 -54
  70. package/src/web/frontend/page/templates/manage.tsx +1 -5
  71. package/src/web/frontend/page/templates/style.css +1 -43
  72. package/src/web/frontend/page/templates/template-list.tsx +7 -15
  73. package/src/web/frontend/routes/route-eq.ts +2 -3
  74. package/src/web/frontend/routes/static.ts +2 -2
  75. package/src/web/frontend/routes/templates.ts +0 -10
  76. package/src/web/frontend/styles/repos.css +22 -0
  77. package/src/web/frontend/styles-v2/shell.css +7 -0
  78. package/src/web/frontend/svghub/catalog-act.ts +168 -0
  79. package/src/web/frontend/svghub/catalog-doc.ts +102 -0
  80. package/src/web/frontend/svghub/catalog-nav.ts +192 -0
  81. package/src/web/frontend/svghub/catalog-repo.ts +102 -0
  82. package/src/web/frontend/svghub/catalog-state.ts +70 -0
  83. package/src/web/frontend/svghub/icon.tsx +95 -0
  84. package/src/web/frontend/svghub/index.ts +66 -0
  85. package/src/web/frontend/svghub/serialize.ts +39 -0
  86. package/src/web/frontend/svghub/types.ts +67 -0
  87. package/src/web/frontend/types.ts +2 -1
  88. package/src/web/public/assets/app-context-BqCBcDsx.js +1 -0
  89. package/src/web/public/assets/bar-Dc5Tq1eE.js +1 -0
  90. package/src/web/public/assets/{button-BEWXOABr.js → button-3JlUeln_.js} +1 -1
  91. package/src/web/public/assets/{composer-launch-DRi9mZE1.js → composer-launch-fp2IzGzQ.js} +1 -1
  92. package/src/web/public/assets/{composer-panel-swmDqlPw.js → composer-panel-Dh681iO6.js} +1 -1
  93. package/src/web/public/assets/dag-DnaU0I_z.js +1 -0
  94. package/src/web/public/assets/dir-d16q1GLe.js +3 -0
  95. package/src/web/public/assets/doc-DRSKD0Re.js +6 -0
  96. package/src/web/public/assets/group-Dc3ZgW24.js +1 -0
  97. package/src/web/public/assets/index-BIVxGd6t.css +1 -0
  98. package/src/web/public/assets/index-Bg0m8gbJ.js +2 -0
  99. package/src/web/public/assets/{list-filter-D-x94TvA.js → list-filter-CWxiOSg_.js} +1 -1
  100. package/src/web/public/assets/md-history-CLIs9Dr0.css +1 -0
  101. package/src/web/public/assets/md-history-DNtgaIdH.js +39 -0
  102. package/src/web/public/assets/{member-picker-Cvbv24IK.js → member-picker-BZgE3HGb.js} +1 -1
  103. package/src/web/public/assets/model-CtG2jIDv.js +2 -0
  104. package/src/web/public/assets/{overview-CctJfO3D.js → overview-C68QpcT9.js} +1 -1
  105. package/src/web/public/assets/popup-DZ2Khv2c.js +1 -0
  106. package/src/web/public/assets/progress-CEmAFxo9.js +3 -0
  107. package/src/web/public/assets/refs-TzxZYy7T.js +2 -0
  108. package/src/web/public/assets/repo-form-modal-Dg3hJWUV.js +1 -0
  109. package/src/web/public/assets/repos-uNqSR5YB.js +12 -0
  110. package/src/web/public/assets/{route-crumb-BcDPd7Ht.js → route-crumb-C4DgkJ8G.js} +1 -1
  111. package/src/web/public/assets/{settings-Cc6puKd5.css → settings-BWHjNegB.css} +1 -1
  112. package/src/web/public/assets/settings-BzIllshQ.js +1 -0
  113. package/src/web/public/assets/{status-tag-BD_0iWMB.js → status-tag-8cLH8hl9.js} +1 -1
  114. package/src/web/public/assets/task-DuFOXLPC.js +11 -0
  115. package/src/web/public/assets/{task-row-CQgzQmzu.js → task-row-CRjuAfKW.js} +1 -1
  116. package/src/web/public/assets/{task-utils-bJH1-Cjy.js → task-utils-DAPxKm4c.js} +1 -1
  117. package/src/web/public/assets/templates-CwYDIBYn.css +1 -0
  118. package/src/web/public/assets/templates-DNiGvmdq.js +10 -0
  119. package/src/web/public/assets/{use-rail-drag-ufwy2XZB.js → use-rail-drag-DxIYcszo.js} +1 -1
  120. package/src/web/public/assets/{workspace-D3jbcTwf.js → workspace-DojQ3RP4.js} +2 -2
  121. package/src/web/public/index.html +15 -16
  122. package/src/web/frontend/modules/md/fill-session.ts +0 -36
  123. package/src/web/frontend/modules/md/new-task-from-template.ts +0 -22
  124. package/src/web/frontend/modules/md/task-intent.ts +0 -29
  125. package/src/web/frontend/modules/prompts/render-template-body.ts +0 -14
  126. package/src/web/frontend/modules/prompts/template-preview.ts +0 -62
  127. package/src/web/frontend/page/templates/fill.tsx +0 -124
  128. package/src/web/public/assets/app-context-DDQnrPSP.js +0 -1
  129. package/src/web/public/assets/bar-j14ON7uZ.js +0 -1
  130. package/src/web/public/assets/dag-BzdFYMml.js +0 -1
  131. package/src/web/public/assets/dir-DhsB1ZhL.js +0 -3
  132. package/src/web/public/assets/doc-D4po3sDc.js +0 -6
  133. package/src/web/public/assets/fill-session-fHxQHFaD.js +0 -1
  134. package/src/web/public/assets/group-BxmSNzIB.js +0 -1
  135. package/src/web/public/assets/index-CMjG5NVU.js +0 -2
  136. package/src/web/public/assets/index-uMjSWNVr.css +0 -1
  137. package/src/web/public/assets/md-history-1h2zairf.css +0 -1
  138. package/src/web/public/assets/md-history-CZUF_FhN.js +0 -39
  139. package/src/web/public/assets/model-Cc2EoUQp.js +0 -2
  140. package/src/web/public/assets/new-task-from-template-DDWu4yR4.js +0 -1
  141. package/src/web/public/assets/popup-D8KWI6-Q.js +0 -1
  142. package/src/web/public/assets/progress-CawQRCQf.js +0 -3
  143. package/src/web/public/assets/refs-TuuoaRs7.js +0 -2
  144. package/src/web/public/assets/render-template-body-bXdedFig.js +0 -1
  145. package/src/web/public/assets/repo-form-modal-BD4N37MI.js +0 -1
  146. package/src/web/public/assets/repos-BPeuX4N9.js +0 -12
  147. package/src/web/public/assets/settings-CZJaKLZW.js +0 -1
  148. package/src/web/public/assets/task-DgbbF5gy.js +0 -11
  149. package/src/web/public/assets/task-intent-CX5DZccN.js +0 -1
  150. package/src/web/public/assets/templates-CBXlwyof.js +0 -11
  151. package/src/web/public/assets/templates-plA8R7jJ.css +0 -1
@@ -5,6 +5,7 @@ import type { ReactNode } from 'react';
5
5
  import { inMoreOf, metaOf, onBarOf } from './modules.js';
6
6
  import { useToolActsLayout } from './use-layout.js';
7
7
  import ToolActsLayoutPanel from './layout-panel.jsx';
8
+ import { Icon } from '../icons.jsx';
8
9
  import './style.css';
9
10
 
10
11
  /** ToolActsBar 入参:kind 决定模块表,其余是按 id 覆盖的渲染/动作/文案。 */
@@ -68,18 +69,22 @@ export default function ToolActsBar({
68
69
 
69
70
  const labelOf = (id: string) => labels[id] || metaOf(kind, id).label || id;
70
71
 
71
- const renderDefaultBtn = (id: string, opts: { primary?: boolean } = {}) => (
72
- <button
73
- key={id}
74
- type="button"
75
- className={opts.primary ? 'btn small primary' : 'btn small ghost'}
76
- title={titles[id] || labelOf(id)}
77
- disabled={!!disabled[id]}
78
- onClick={() => actions[id] && actions[id]()}
79
- >
80
- {labelOf(id)}
81
- </button>
82
- );
72
+ const renderDefaultBtn = (id: string, opts: { primary?: boolean } = {}) => {
73
+ const m = metaOf(kind, id);
74
+ return (
75
+ <button
76
+ key={id}
77
+ type="button"
78
+ className={opts.primary ? 'btn small primary' : 'btn small ghost'}
79
+ title={titles[id] || labelOf(id)}
80
+ disabled={!!disabled[id]}
81
+ onClick={() => actions[id] && actions[id]()}
82
+ >
83
+ {m.icon ? <Icon name={m.icon} /> : null}
84
+ {labelOf(id)}
85
+ </button>
86
+ );
87
+ };
83
88
 
84
89
  const renderOne = (id: string) => {
85
90
  if (id === 'more') {
@@ -98,6 +103,7 @@ export default function ToolActsBar({
98
103
  setMoreOpen((v) => !v);
99
104
  }}
100
105
  >
106
+ <Icon name="dots" />
101
107
  {labelOf('more')} ▾
102
108
  </button>
103
109
  );
@@ -123,23 +129,27 @@ export default function ToolActsBar({
123
129
  {moreItems.length === 0 && (
124
130
  <div className="ta-more-empty">没有收纳的工具——可在编排里把按钮收入更多</div>
125
131
  )}
126
- {moreItems.map((x) => (
127
- <button
128
- key={x.id}
129
- type="button"
130
- role="menuitem"
131
- className="ta-more-it"
132
- disabled={!!disabled[x.id]}
133
- title={titles[x.id] || labelOf(x.id)}
134
- onClick={() => {
135
- setMoreOpen(false);
136
- const act = actions[x.id];
137
- if (act) act();
138
- }}
139
- >
140
- {labelOf(x.id)}
141
- </button>
142
- ))}
132
+ {moreItems.map((x) => {
133
+ const m = metaOf(kind, x.id);
134
+ return (
135
+ <button
136
+ key={x.id}
137
+ type="button"
138
+ role="menuitem"
139
+ className="ta-more-it"
140
+ disabled={!!disabled[x.id]}
141
+ title={titles[x.id] || labelOf(x.id)}
142
+ onClick={() => {
143
+ setMoreOpen(false);
144
+ const act = actions[x.id];
145
+ if (act) act();
146
+ }}
147
+ >
148
+ {m.icon ? <Icon name={m.icon} /> : null}
149
+ {labelOf(x.id)}
150
+ </button>
151
+ );
152
+ })}
143
153
  <div className="ta-more-sep" />
144
154
  <button
145
155
  type="button"
@@ -150,6 +160,7 @@ export default function ToolActsBar({
150
160
  setPanelOpen(true);
151
161
  }}
152
162
  >
163
+ <Icon name="gear" />
153
164
  自定义工具栏…
154
165
  </button>
155
166
  </div>,
@@ -10,6 +10,7 @@ import type {
10
10
  import { defaultLayout, inMoreOf, metaOf, onBarOf } from './modules.js';
11
11
  import type { LayoutItem } from './modules.js';
12
12
  import { isLocked, moveModule, nudgeModule, setFlag } from './dnd.js';
13
+ import { Icon } from '../icons.jsx';
13
14
 
14
15
  /** 编排面板入参(layout 是当前生效布局,保存才回写)。 */
15
16
  export interface ToolActsLayoutPanelProps {
@@ -188,6 +189,7 @@ export default function ToolActsLayoutPanel({ kind, layout, setLayout, onClose }
188
189
  <div className="tlp-section-label">预览(可直接拖动这里的按钮排序)</div>
189
190
  <div className="tlp-preview" role="list" data-testid="tlp-preview">
190
191
  {barRows.map((x) => {
192
+ const m = metaOf(kind, x.id);
191
193
  const chipHint = dropKey === `chip:${x.id}:before` ? ' drop-before'
192
194
  : dropKey === `chip:${x.id}:after` ? ' drop-after' : '';
193
195
  return (
@@ -195,7 +197,7 @@ export default function ToolActsLayoutPanel({ kind, layout, setLayout, onClose }
195
197
  key={x.id}
196
198
  className={[
197
199
  'tlp-chip',
198
- metaOf(kind, x.id).section === 'primary' ? 'primary' : '',
200
+ m.section === 'primary' ? 'primary' : '',
199
201
  srcId === x.id ? 'dragging' : '',
200
202
  chipHint,
201
203
  ].filter(Boolean).join(' ')}
@@ -206,7 +208,8 @@ export default function ToolActsLayoutPanel({ kind, layout, setLayout, onClose }
206
208
  onDragOver={(e) => overChip(x, e)}
207
209
  onDrop={(e) => dropChip(x, e)}
208
210
  >
209
- {metaOf(kind, x.id).label || x.id}
211
+ {m.icon ? <Icon name={m.icon} size={12} /> : null}
212
+ {m.label || x.id}
210
213
  </span>
211
214
  );
212
215
  })}
@@ -252,6 +255,7 @@ export default function ToolActsLayoutPanel({ kind, layout, setLayout, onClose }
252
255
  title={m.noHide ? '不可隐藏' : '收入「更多」'}
253
256
  />
254
257
  <span className="tlp-nm">
258
+ <span className="tlp-nm-ico">{m.icon ? <Icon name={m.icon} size={13} /> : null}</span>
255
259
  {m.label || item.id}
256
260
  {m.noHide ? <span className="tlp-sub">固定显示</span> : null}
257
261
  </span>
@@ -294,7 +298,7 @@ export default function ToolActsLayoutPanel({ kind, layout, setLayout, onClose }
294
298
  onChange={() => toggleVis(item.id)}
295
299
  title="显示到工具栏"
296
300
  />
297
- <span className="tlp-nm">{m.label || item.id}</span>
301
+ <span className="tlp-nm">{m.icon ? <span className="tlp-nm-ico"><Icon name={m.icon} size={13} /></span> : null}{m.label || item.id}</span>
298
302
  </div>
299
303
  );
300
304
  })}
@@ -11,6 +11,8 @@ export type ToolActsKind = 'dir' | 'group' | 'task' | 'doc' | 'repos' | 'repos-r
11
11
  export interface ToolModule {
12
12
  id: string;
13
13
  label: string;
14
+ /** 按钮/菜单项前的图标(资产名,见 svghub 目录);空 = 纯文字 */
15
+ icon?: string;
14
16
  section?: string;
15
17
  noHide?: boolean;
16
18
  menuGroup?: string;
@@ -28,83 +30,83 @@ export interface LayoutItem {
28
30
  }
29
31
 
30
32
  export const DIR_MODULES: ToolModule[] = [
31
- { id: 'new', label: '+ 新建页', section: 'primary', noHide: true },
32
- { id: 'import', label: '导入', section: 'bar' },
33
- { id: 'progress', label: '进程', section: 'bar' },
34
- { id: 'orch', label: '编排', section: 'bar' },
33
+ { id: 'new', label: '新建页', icon: 'plus', section: 'primary', noHide: true },
34
+ { id: 'import', label: '导入', icon: 'import', section: 'bar' },
35
+ { id: 'progress', label: '进程', icon: 'progress', section: 'bar' },
36
+ { id: 'orch', label: '编排', icon: 'flow', section: 'bar' },
35
37
  // #126:草稿开关作用于选中的任务(没选中时给提示),默认在工具栏可见
36
- { id: 'plan', label: '草稿态', section: 'bar' },
37
- { id: 'more', label: '更多', section: 'bar', noHide: true },
38
- { id: 'refs', label: '查看列表', section: 'more' },
38
+ { id: 'plan', label: '草稿态', icon: 'pin', section: 'bar' },
39
+ { id: 'more', label: '更多', icon: 'dots', section: 'bar', noHide: true },
40
+ { id: 'refs', label: '查看列表', icon: 'list', section: 'more' },
39
41
  ];
40
42
 
41
43
  export const GROUP_MODULES: ToolModule[] = [
42
- { id: 'new', label: '+ 新增任务', section: 'primary', noHide: true },
43
- { id: 'progress', label: '进程', section: 'bar' },
44
- { id: 'addMember', label: '添加成员', section: 'bar' },
45
- { id: 'orch', label: '编排', section: 'bar' },
46
- { id: 'more', label: '更多', section: 'bar', noHide: true },
47
- { id: 'refs', label: '查看列表', section: 'more' },
44
+ { id: 'new', label: '新增任务', icon: 'plus', section: 'primary', noHide: true },
45
+ { id: 'progress', label: '进程', icon: 'progress', section: 'bar' },
46
+ { id: 'addMember', label: '添加成员', icon: 'users', section: 'bar' },
47
+ { id: 'orch', label: '编排', icon: 'flow', section: 'bar' },
48
+ { id: 'more', label: '更多', icon: 'dots', section: 'bar', noHide: true },
49
+ { id: 'refs', label: '查看列表', icon: 'list', section: 'more' },
48
50
  ];
49
51
 
50
52
  // MD 任务编辑器工具区(#143):默认头栏只留 新任务 / 提交 / 更多;
51
53
  // 次级动作默认进更多,可编排提到工具栏。menuGroup 仅影响更多菜单分层。
52
54
  export const TASK_MODULES: ToolModule[] = [
53
- { id: 'new', label: '新任务', section: 'primary', noHide: true },
54
- { id: 'submit', label: '提交', section: 'primary', noHide: true },
55
- { id: 'more', label: '更多', section: 'bar', noHide: true },
56
- { id: 'mode', label: '源码模式', section: 'more', menuGroup: 'edit' },
57
- { id: 'img', label: '插入图片', section: 'more', menuGroup: 'edit' },
58
- { id: 'att', label: '添加附件', section: 'more', menuGroup: 'edit' },
59
- { id: 'import', label: '导入', section: 'more', menuGroup: 'edit' },
60
- { id: 'draft', label: '存草稿', section: 'more', menuGroup: 'edit' },
61
- { id: 'chain', label: '任务链', section: 'more', menuGroup: 'task' },
62
- { id: 'clone', label: '克隆任务', section: 'more', menuGroup: 'task' },
63
- { id: 'fork', label: 'Fork 任务', section: 'more', menuGroup: 'task' },
55
+ { id: 'new', label: '新任务', icon: 'plus', section: 'primary', noHide: true },
56
+ { id: 'submit', label: '提交', icon: 'send', section: 'primary', noHide: true },
57
+ { id: 'more', label: '更多', icon: 'dots', section: 'bar', noHide: true },
58
+ { id: 'mode', label: '源码模式', icon: 'code', section: 'more', menuGroup: 'edit' },
59
+ { id: 'img', label: '插入图片', icon: 'img', section: 'more', menuGroup: 'edit' },
60
+ { id: 'att', label: '添加附件', icon: 'clip', section: 'more', menuGroup: 'edit' },
61
+ { id: 'import', label: '导入', icon: 'import', section: 'more', menuGroup: 'edit' },
62
+ { id: 'draft', label: '存草稿', icon: 'save', section: 'more', menuGroup: 'edit' },
63
+ { id: 'chain', label: '任务链', icon: 'chain', section: 'more', menuGroup: 'task' },
64
+ { id: 'clone', label: '克隆任务', icon: 'copy', section: 'more', menuGroup: 'task' },
65
+ { id: 'fork', label: 'Fork 任务', icon: 'fork', section: 'more', menuGroup: 'task' },
64
66
  // #131:plan 态开关放在任务页「更多」里(与「标为完成」同组)——
65
67
  // 用户在任务详情页就能把这条任务转成草稿态 / 转回待领取,不用回目录页。
66
- { id: 'plan', label: '转为草稿', section: 'more', menuGroup: 'task' },
67
- { id: 'complete', label: '标为完成', section: 'more', menuGroup: 'task' },
68
- { id: 'cancel-task', label: '取消任务', section: 'more', menuGroup: 'task', danger: true },
69
- { id: 'mark', label: '评论', section: 'more', menuGroup: 'task' },
70
- { id: 'delete', label: '删除', section: 'more', menuGroup: 'task', danger: true },
71
- { id: 'preview', label: '预览提示词', section: 'more', menuGroup: 'view' },
72
- { id: 'overview', label: '总览', section: 'more', menuGroup: 'view' },
73
- { id: 'prog', label: '进程', section: 'more', menuGroup: 'view' },
74
- { id: 'source', label: '原文', section: 'more', menuGroup: 'view' },
75
- { id: 'shortcuts', label: '快捷键', section: 'more', menuGroup: 'view' },
68
+ { id: 'plan', label: '转为草稿', icon: 'pin', section: 'more', menuGroup: 'task' },
69
+ { id: 'complete', label: '标为完成', icon: 'check', section: 'more', menuGroup: 'task' },
70
+ { id: 'cancel-task', label: '取消任务', icon: 'ban', section: 'more', menuGroup: 'task', danger: true },
71
+ { id: 'mark', label: '评论', icon: 'comment', section: 'more', menuGroup: 'task' },
72
+ { id: 'delete', label: '删除', icon: 'trash', section: 'more', menuGroup: 'task', danger: true },
73
+ { id: 'preview', label: '预览提示词', icon: 'eye', section: 'more', menuGroup: 'view' },
74
+ { id: 'overview', label: '总览', icon: 'overview', section: 'more', menuGroup: 'view' },
75
+ { id: 'prog', label: '进程', icon: 'progress', section: 'more', menuGroup: 'view' },
76
+ { id: 'source', label: '原文', icon: 'doc', section: 'more', menuGroup: 'view' },
77
+ { id: 'shortcuts', label: '快捷键', icon: 'keyboard', section: 'more', menuGroup: 'view' },
76
78
  ];
77
79
 
78
80
  // MD 文档编辑器(#143):默认「保存 · 更多」(与 task 主按钮在左、更多靠右同构);
79
81
  // 次级动作可编排上栏。
80
82
  export const DOC_MODULES: ToolModule[] = [
81
- { id: 'save', label: '保存', section: 'primary', noHide: true },
82
- { id: 'more', label: '更多', section: 'bar', noHide: true },
83
- { id: 'mode', label: '源码模式', section: 'more', menuGroup: 'edit' },
84
- { id: 'rename', label: '重命名', section: 'more', menuGroup: 'doc' },
85
- { id: 'delete', label: '删除', section: 'more', menuGroup: 'doc', danger: true },
86
- { id: 'list', label: '文字列表', section: 'more', menuGroup: 'view' },
83
+ { id: 'save', label: '保存', icon: 'save', section: 'primary', noHide: true },
84
+ { id: 'more', label: '更多', icon: 'dots', section: 'bar', noHide: true },
85
+ { id: 'mode', label: '源码模式', icon: 'code', section: 'more', menuGroup: 'edit' },
86
+ { id: 'rename', label: '重命名', icon: 'rename', section: 'more', menuGroup: 'doc' },
87
+ { id: 'delete', label: '删除', icon: 'trash', section: 'more', menuGroup: 'doc', danger: true },
88
+ { id: 'list', label: '文字列表', icon: 'list', section: 'more', menuGroup: 'view' },
87
89
  ];
88
90
 
89
91
  // 仓库管理页头部(#145/#147):默认只留「登记仓库 · 更多」(与 task/doc 同构——
90
92
  // 次级动作默认收进更多,可在编排里拖上工具栏/调顺序)。
91
93
  export const REPOS_MODULES: ToolModule[] = [
92
- { id: 'add', label: '登记仓库', section: 'primary', noHide: true },
93
- { id: 'more', label: '更多', section: 'bar', noHide: true },
94
- { id: 'boards', label: '分组管理', section: 'more', menuGroup: 'manage' },
95
- { id: 'refs', label: '参考仓库管理', section: 'more', menuGroup: 'manage' },
96
- { id: 'transfer', label: '导入导出', section: 'more', menuGroup: 'manage' },
94
+ { id: 'add', label: '登记仓库', icon: 'plus', section: 'primary', noHide: true },
95
+ { id: 'more', label: '更多', icon: 'dots', section: 'bar', noHide: true },
96
+ { id: 'boards', label: '分组管理', icon: 'board', section: 'more', menuGroup: 'manage' },
97
+ { id: 'refs', label: '参考仓库管理', icon: 'repo-ref', section: 'more', menuGroup: 'manage' },
98
+ { id: 'transfer', label: '导入导出', icon: 'transfer', section: 'more', menuGroup: 'manage' },
97
99
  ];
98
100
 
99
101
  // 仓库表**行内**动作(#148):默认布局与旧版一致(编辑/打开/删除上栏 + 更多收纳
100
102
  // 持续 get / 对齐 remote),五个动作全部可编排(kind=repos-row)。
101
103
  export const REPOS_ROW_MODULES: ToolModule[] = [
102
- { id: 'edit', label: '编辑', section: 'bar' },
103
- { id: 'open', label: '打开', section: 'bar' },
104
- { id: 'del', label: '删除', section: 'bar', danger: true },
105
- { id: 'more', label: '更多', section: 'bar', noHide: true },
106
- { id: 'getloop', label: '持续 get…', section: 'more', menuGroup: 'repo' },
107
- { id: 'remote', label: '对齐 remote', section: 'more', menuGroup: 'repo' },
104
+ { id: 'edit', label: '编辑', icon: 'edit', section: 'bar' },
105
+ { id: 'open', label: '打开', icon: 'open', section: 'bar' },
106
+ { id: 'del', label: '删除', icon: 'trash', section: 'bar', danger: true },
107
+ { id: 'more', label: '更多', icon: 'dots', section: 'bar', noHide: true },
108
+ { id: 'getloop', label: '持续 get…', icon: 'refresh', section: 'more', menuGroup: 'repo' },
109
+ { id: 'remote', label: '对齐 remote', icon: 'remote', section: 'more', menuGroup: 'repo' },
108
110
  ];
109
111
 
110
112
  // kind → id → 模块(缺 key 的 id 查不到,调用方用 `|| {}` 兜)
@@ -10,10 +10,12 @@
10
10
  }
11
11
  .ta-more-empty { padding: 8px 10px; font-size: 11.5px; color: var(--faint, #8A8578); }
12
12
  .ta-more-it {
13
- display: flex; align-items: center; width: 100%; height: 28px; padding: 0 10px;
13
+ display: flex; align-items: center; gap: 7px; width: 100%; height: 28px; padding: 0 10px;
14
14
  border: 0; border-radius: 5px; background: none; cursor: pointer; text-align: left;
15
15
  font: inherit; font-size: 12px; color: var(--ink, #16181C);
16
16
  }
17
+ .ta-more-it .ic { flex: none; color: var(--mid, #838A93); }
18
+ .ta-more-it:hover:not(:disabled) .ic { color: currentColor; }
17
19
  .ta-more-it:hover:not(:disabled) { background: var(--soft, #F1F0EC); }
18
20
  .ta-more-it:disabled { opacity: .5; cursor: default; }
19
21
  .ta-more-sep { height: 1px; margin: 4px 6px; background: var(--line, #E4E2DC); }
@@ -47,7 +49,7 @@
47
49
  background: var(--soft, #F1F0EC); min-height: 40px;
48
50
  }
49
51
  .tlp-chip {
50
- display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
52
+ display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
51
53
  border: 1px solid var(--line, #E4E2DC); border-radius: 6px;
52
54
  background: var(--paper, #fff); font-size: 12px; color: var(--ink, #16181C);
53
55
  user-select: none;
@@ -96,7 +98,9 @@
96
98
  font-size: 11px; width: 14px; text-align: center; flex: none;
97
99
  }
98
100
  .tlp-row.lock .tlp-hnd { cursor: default; }
99
- .tlp-nm { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink, #16181C); }
101
+ .tlp-nm { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink, #16181C); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
102
+ .tlp-nm-ico { display: inline-flex; align-items: center; }
103
+ .tlp-nm-ico .ic { color: var(--mid, #838A93); }
100
104
  .tlp-sub { display: block; font-size: 11px; color: var(--mid, #838A93); margin-top: 1px; }
101
105
  .tlp-acts { display: inline-flex; gap: 2px; opacity: 0; transition: opacity .12s; }
102
106
  .tlp-row:hover .tlp-acts, .tlp-row:focus-within .tlp-acts { opacity: 1; }
@@ -190,13 +190,6 @@
190
190
  .rp-doclink-note{color:var(--mid,#838A93)}
191
191
  .rp-doclink-tag{font-size:9.5px;padding:0 5px;border-radius:8px;background:rgba(158,76,0,.14)}
192
192
 
193
- /* 模板页:槽位编辑区(正文里的 {{名字}} 处填内容) */
194
- .mdw-tpl-slots{
195
- margin:8px 0 2px;padding:10px 12px;border:1px solid var(--line,#E4E2DC);
196
- border-radius:8px;background:var(--paper,#fff);
197
- }
198
- .mdw-tpl-note{margin-top:6px;font-size:11px;color:var(--mid,#838A93)}
199
-
200
193
  /* 预览提示词弹层(任务 #65):交付原文 + 段落来源 + 开关状态 */
201
194
  .mdw-prev-body{
202
195
  margin:0 0 10px;max-height:52vh;overflow:auto;padding:10px 12px;border-radius:8px;
@@ -341,20 +341,3 @@
341
341
  @media (max-width:720px){
342
342
  .mdw-block-rail{left:auto;right:0;top:-10px}
343
343
  }
344
-
345
- /* ─── 模板编辑页的插槽标记 ──────────────────────────────────────────────
346
- #151 起任务编辑器不再有「骨架只读 / 插槽」概念——模板只在**生成任务正文之前**
347
- 存在,生成后就是纯文本。这里只剩模板编辑页给自己用的插槽左线 + 角标。 */
348
- .mdw-lp-block.is-slot{
349
- padding-left:10px;
350
- box-shadow:inset 2px 0 0 var(--mdw-accent-line,#B7D4C8);
351
- }
352
- .mdw-lp-slot{
353
- position:absolute;right:0;top:0;
354
- font:500 9.5px/1.6 system-ui,-apple-system,sans-serif;
355
- padding:0 6px;border-radius:999px;
356
- border:1px solid var(--line,#E4E2DC);background:var(--soft,#F1F0EC);color:var(--mid,#8A8578);
357
- opacity:0;transition:opacity .12s;pointer-events:none;user-select:none;
358
- }
359
- .mdw-lp-slot{color:var(--mdw-accent,#2F6F5E);border-color:var(--mdw-accent-line,#B7D4C8);background:var(--mdw-accent-soft,#E8F2EE)}
360
- .mdw-lp-block:hover .mdw-lp-slot{opacity:1}
@@ -137,6 +137,9 @@
137
137
  font-weight:650;font-size:12px;font-family:inherit;color:var(--ink,#16181C);
138
138
  }
139
139
  .mdw-fmt-menu-item .hint{margin-left:auto;font-weight:400;font-size:10.5px;font-family:inherit;color:var(--faint,#A9AEB4)}
140
+ .mdw-fmt-menu-item .ic{flex:none;color:var(--mid,#838A93)}
141
+ .mdw-fmt-menu-item:hover .ic{color:currentColor}
142
+ .mdw-fmt-menu-item.danger .ic{color:currentColor}
140
143
  .mdw-fmt-menu-item:hover{background:var(--mdw-accent-soft);color:var(--mdw-accent)}
141
144
  .mdw-fmt-menu-item.danger{color:var(--danger,#b3261e)}
142
145
  .mdw-fmt-menu-item.danger:hover{background:rgba(179,38,30,.07);color:var(--danger,#b3261e)}
@@ -2,12 +2,11 @@
2
2
  //
3
3
  // 模板数据在本机服务(~/.nx-kv/templates.json),与队列同源同构——不落浏览器存储,
4
4
  // 换浏览器/刷新都一致。拉取失败不阻塞工作台:templates 置 null,新建页退回
5
- // #137:模板正文直接渲染(槽位值取模板自己声明的 values);出厂文本只有后端那一份。
5
+ // #137:模板正文原样使用,无渲染替换层;出厂文本只有后端那一份。
6
6
  import { useCallback, useEffect, useState } from 'react';
7
7
  import { api } from '../../api/client.js';
8
8
  import { useApp } from '../../app-context.jsx';
9
9
  import type { PromptTemplate, TemplatesApi } from '../../types.js';
10
- import { renderTemplateBody } from '../prompts/render-template-body.js';
11
10
 
12
11
  /** /api/templates 的出站形状(服务端字段按 index 放行,这里只声明读到的)。 */
13
12
  interface TemplatesPayload {
@@ -53,20 +52,11 @@ export function useTemplates(): TemplatesApi {
53
52
  refetch();
54
53
  }, [refetch]);
55
54
 
56
- /**
57
- * 默认模板的「正文 + 模板身份」。
58
- *
59
- * 为什么要把 id 一起给出来:由模板生成的任务,编辑器要按模板骨架把
60
- * 「骨架块」标成只读(#217)。身份落在正文 frontmatter 的 `template:` 上,
61
- * 刷新 / 换设备 / CLI 侧改过之后仍然成立——只存前端内存的话一刷新就丢。
62
- *
63
- * 正文永远**已渲染**:任务里不能出现裸 `{{槽位}}`。
64
- */
55
+ /** 默认模板的正文(原样,无渲染层)。id 一并给出,供调用方判断是否选中了模板。 */
65
56
  const defaultPick = useCallback(() => {
66
57
  const t = (state.templates || []).find((x) => x.id === state.defaultId);
67
58
  if (!t) return { body: '', id: '' }; // #137:没有可用模板 → 从空稿开始(出厂文本只有后端那一份)
68
- // 缺的键用内置默认值补;用户显式留空('')仍是空——不把标记露回正文。
69
- return { body: renderTemplateBody(t.body, t.values || {}), id: String(t.id || '') };
59
+ return { body: String(t.body || ''), id: String(t.id || '') };
70
60
  }, [state]);
71
61
 
72
62
  /** 默认模板正文(未加载/拉取失败 → 空稿)。 */
@@ -27,8 +27,6 @@ import DagEditor from './dag-editor.jsx';
27
27
  import { findOpenPanel, openPanel } from '../../workspace.js';
28
28
  import { openTemplateEditor } from '../../panels.jsx';
29
29
  import { docIdOf, nextDraftId, saveDoc, scopeOf } from '../../modules/md/doc-store.js';
30
- import { templateDraftBody } from '../../modules/prompts/template-preview.js';
31
- import { startFillIfSlotted } from '../../modules/md/new-task-from-template.js';
32
30
  import { putManageSession } from '../../modules/md/manage-session.js';
33
31
  import { useTemplatesFor } from '../../modules/md/use-templates.js';
34
32
  import type { LocalTask, PromptTemplate, RepoRow } from '../../types.js';
@@ -214,21 +212,14 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
214
212
  ? menuTemplates.map((t: PromptTemplate) => ({
215
213
  label: (t.id === tpl?.defaultId ? '✓ ' : '') + t.name,
216
214
  icon: 'list',
217
- // #151:有 {{槽位}} → 先去参数填写页;无槽位 → 纯文本草稿直进编辑器
218
- onClick: () => {
219
- if (startFillIfSlotted(t, { topic: topicKeyHere, dirKey: dirKey || '' }, app)) return;
220
- newDraft(templateDraftBody(t));
221
- },
215
+ onClick: () => newDraft(String(t.body || '')),
222
216
  }))
223
217
  : [{
224
218
  label: '按默认模板新建一页',
225
219
  icon: 'list',
226
220
  onClick: () => {
227
221
  const p = tpl ? tpl.defaultPick() : null;
228
- // #151:默认模板同样先过槽位检查
229
- const full = (tpl?.templates || []).find((t) => t.id === (p?.id || tpl?.defaultId));
230
- if (full && startFillIfSlotted(full as any, { topic: topicKeyHere, dirKey: dirKey || '' }, app)) return;
231
- newDraft(p && p.id ? templateDraftBody(p) : (p ? p.body : ''));
222
+ newDraft(p ? p.body : '');
232
223
  },
233
224
  }]),
234
225
  'sep',
@@ -476,10 +467,7 @@ export default function DirPanel({ dirKey }: DirPanelProps) {
476
467
  onPage={pager.setPage}
477
468
  onNew={() => {
478
469
  const p = tpl ? tpl.defaultPick() : null;
479
- const full = (tpl?.templates || []).find((t) => t.id === (p?.id || tpl?.defaultId));
480
- // #151:默认模板也带 {{content}} 槽位 → 先进参数页
481
- if (full && startFillIfSlotted(full, { topic: topicKeyHere, dirKey: dirKey || '' }, app)) return;
482
- newDraft(p && p.id ? templateDraftBody(p) : (p ? p.body : ''));
470
+ newDraft(p ? p.body : '');
483
471
  }}
484
472
  onOpenTask={openTask}
485
473
  onDeleteTask={delTask}
@@ -25,8 +25,6 @@ import {
25
25
  stripPhantomEmptyLines,
26
26
  withFrontmatter,
27
27
  } from '../../modules/md/md-parse.js';
28
- import { templateDraftBody } from '../../modules/prompts/template-preview.js';
29
- import { startFillIfSlotted } from '../../modules/md/new-task-from-template.js';
30
28
  import {
31
29
  docIdOf,
32
30
  nextDraftId,
@@ -396,19 +394,6 @@ export function useTaskActions({
396
394
 
397
395
  /** 「更多 → 新任务」:新草稿**带着当前上下文**(工作组 + 归属项目)。 */
398
396
  const newTask = useCallback(() => {
399
- // #151:默认模板带槽位 → 先去参数页(带上当前组/项目上下文)
400
- const full = (tpl?.templates || []).find((t) => t.id === tpl?.defaultId);
401
- if (full && startFillIfSlotted(
402
- full,
403
- {
404
- topic: topicKey,
405
- dirKey: groupAnchored ? '' : topicKey,
406
- groupId: groupAnchored ? groupId : '',
407
- board: boardCtx?.board?.id || '',
408
- project: docFm.project || '',
409
- },
410
- app,
411
- )) return;
412
397
  const draftId = nextDraftId();
413
398
  const docId = docIdOf(groupAnchored ? scopeOf(groupId) : scopeOf(topicKey), draftId);
414
399
  const fm: DocFm = {};
@@ -416,7 +401,7 @@ export function useTaskActions({
416
401
  if (docFm.project) fm.project = docFm.project;
417
402
  saveDoc(docId, {
418
403
  title: '',
419
- body: tpl ? templateDraftBody(tpl.defaultPick(), fm) : withFrontmatter('', fm),
404
+ body: withFrontmatter(tpl ? tpl.defaultPick().body : '', fm),
420
405
  });
421
406
  if (app.openPage) {
422
407
  app.openPage(
@@ -29,13 +29,12 @@ import { persistAtt } from '../../components/md/attachments.js';
29
29
  import type { Attachment } from '../../components/md/attach-common.js';
30
30
  import type { AttachAreaHandle } from '../../components/md/attach-area.jsx';
31
31
  import { pushHistory, redoHistory, undoHistory } from '../../modules/md/md-history.js';
32
- import { takeTaskIntent } from '../../modules/md/task-intent.js';
33
32
  import {
34
33
  liveBodyBlocks,
35
34
  titleFromMd,
36
35
  stripTitleHeading,
36
+ withFrontmatter,
37
37
  } from '../../modules/md/md-parse.js';
38
- import { templateDraftBody } from '../../modules/prompts/template-preview.js';
39
38
  import {
40
39
  docIdOf,
41
40
  getDoc,
@@ -215,7 +214,7 @@ export default function PagePanel({ dirKey, groupId, task, beside = false, tabId
215
214
  getDoc(id, {
216
215
  title: '',
217
216
  body: tpl
218
- ? templateDraftBody(tpl.defaultPick(), groupAnchored ? { board: groupId } : {})
217
+ ? withFrontmatter(tpl.defaultPick().body, groupAnchored ? { board: groupId } : {})
219
218
  : '',
220
219
  });
221
220
  } else if (taskRow) getDoc(id, { title: titleFromMd(taskRow.text), body: taskRow.text });
@@ -231,19 +230,6 @@ export default function PagePanel({ dirKey, groupId, task, beside = false, tabId
231
230
  });
232
231
  const { composeText, submit, importMd, delTask, canComplete, canCancel, closeTask, canPlan, togglePlan, addFiles, newTask, cloneCur, forkCur, openProgress, openAttachPanel } = actions;
233
232
 
234
- // #151「直接提交」:参数填写页在 doc-store 里种好正文、开到这一页并留下一次性
235
- // intent;这里 mount 时取走并等 doc 就绪后自动 submit 一次(落库为待领取任务)。
236
- // StrictMode / 重挂载只会消费一次,避免双提交。
237
- const autoSubmitRef = useRef(false);
238
- useEffect(() => {
239
- if (takeTaskIntent(id)?.submit) autoSubmitRef.current = true;
240
- }, [id]);
241
- useEffect(() => {
242
- if (!autoSubmitRef.current || !doc || !isDraft) return;
243
- autoSubmitRef.current = false;
244
- void submit();
245
- }, [doc, isDraft, submit]);
246
-
247
233
  const feedback = useFeedback({
248
234
  doc, isDraft, task, taskRow, topicKey, topic, isGlobal, dirKey,
249
235
  groupAnchored, groupId, app, model: model || null, tabId, refreshLocal,
@@ -26,10 +26,8 @@ import { openPanel } from '../../workspace.js';
26
26
  import { openTemplateEditor } from '../../panels.jsx';
27
27
  import ToolActsBar from '../../components/tool-acts/bar.jsx';
28
28
  import { docIdOf, nextDraftId, saveDoc, scopeOf } from '../../modules/md/doc-store.js';
29
- import { parseFrontmatter } from '../../modules/md/md-parse.js';
29
+ import { parseFrontmatter, withFrontmatter } from '../../modules/md/md-parse.js';
30
30
  import { hitTaskQuery } from '../../modules/board/task-search.js';
31
- import { templateDraftBody } from '../../modules/prompts/template-preview.js';
32
- import { startFillIfSlotted } from '../../modules/md/new-task-from-template.js';
33
31
  import { putManageSession } from '../../modules/md/manage-session.js';
34
32
  import { useTemplates, useTemplatesFor } from '../../modules/md/use-templates.js';
35
33
  import type { LocalTask, LocalTopic, RepoData } from '../../types.js';
@@ -315,30 +313,19 @@ export default function GroupView({ dirKey, rows, repoData, model }: {
315
313
  const createTask = (pick?: { id?: string; body?: unknown; values?: Record<string, unknown> | null } | null) => {
316
314
  if (!board) return;
317
315
  if (!sel) return toast('这个组还没有成员——先「添加成员」,再建任务');
318
- // #151:带 {{槽位}} 的模板先去参数页(携带组 + 项目上下文)
319
- const chosen = pick || (tpl?.templates || []).find((t) => t.id === tpl.defaultId) || null;
320
- if (chosen && startFillIfSlotted(
321
- chosen,
322
- {
323
- topic: sel.topicKey || '',
324
- group: board.key || '',
325
- repo: sel.key || '',
326
- groupId: board.id,
327
- board: board.id,
328
- project: sel.key,
329
- },
330
- app,
331
- )) return;
332
316
  const id = nextDraftId();
333
317
  // 草稿 doc 种在**组 scope**(docIdOf(scopeOf(board.id), id)):从组路由
334
318
  // #/group/<id>?task=draft-N 打开寻得回同一份(#86)。以前种在成员 scope、
335
319
  // 打开走 dir 路由——组语义在建任务这步就断了。
336
320
  const docId = docIdOf(scopeOf(board.id), id);
337
- // 与目录任务页同一条口径:槽位已渲染、模板身份写进 frontmatter(编辑器据此锁骨架,#217)
321
+ // 与目录任务页同一条口径:正文取模板原文,归属字段写进 frontmatter。
338
322
  const extra = { board: board.id, project: sel.key };
339
323
  saveDoc(docId, {
340
324
  title: '',
341
- body: pick ? templateDraftBody(pick, extra) : templateDraftBody(tpl.defaultPick(), extra),
325
+ body: withFrontmatter(
326
+ pick ? String(pick.body || '') : tpl.defaultPick().body,
327
+ extra,
328
+ ),
342
329
  });
343
330
  app.openPage?.({ groupId: board.id, task: id, name: '新任务' });
344
331
  };
@@ -0,0 +1,32 @@
1
+ // 仓库管理页「分支(组)」选择的持久化(#158)——**只是显示态,不是数据**。
2
+ //
3
+ // 用户在仓库管理页切到某个组分支后,下次进页还落在 main,每次都要重选一遍。
4
+ // 把最后的选择记进 localStorage,重开面板 / 换天回来都还停在那个分支上。
5
+ //
6
+ // 与侧边栏 prefs(nx-kv-sidebar-v1)分开:那边只管侧边栏编排/收起态,
7
+ // 这边是仓库页自己的视图偏好,各存各的键。localStorage 缺席(隐私模式等)
8
+ // 存取静默降级——回落 main,功能不受影响。
9
+
10
+ const KEY = 'nx-kv-repos-branch-v1';
11
+
12
+ /** 读上次选的分支 id;无记录 / 脏数据 / localStorage 不可用 → null(回落 main)。 */
13
+ export function loadBranchPref(): string | null {
14
+ try {
15
+ const raw = localStorage.getItem(KEY);
16
+ // localStorage 是外部数据边界:非空字符串才收(空串当无记录)
17
+ const v = raw == null ? null : String(raw);
18
+ return v ? v : null;
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+
24
+ /** 记下当前分支 id;写不进去就静默放弃(本次会话内仍然生效)。 */
25
+ export function saveBranchPref(id: string): void {
26
+ try {
27
+ const v = String(id || '');
28
+ if (v) localStorage.setItem(KEY, v);
29
+ } catch {
30
+ /* 隐私模式等静默降级 */
31
+ }
32
+ }