nx-kv 0.48.1 → 0.48.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 (241) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/package.json +1 -1
  3. package/src/modules/auth/actions/auth-login.ts +11 -4
  4. package/src/modules/auth/actions/auth-logout.ts +9 -4
  5. package/src/modules/auth/actions/auth-me.ts +9 -4
  6. package/src/modules/auth/actions/auth-status.ts +9 -4
  7. package/src/modules/bundled/actions/bundled-get.ts +12 -4
  8. package/src/modules/bundled/actions/bundled-groups.ts +9 -4
  9. package/src/modules/bundled/actions/bundled-install.ts +13 -4
  10. package/src/modules/bundled/actions/bundled-list.ts +9 -4
  11. package/src/modules/db/actions/db-backup.ts +10 -4
  12. package/src/modules/db/actions/db-migrate.ts +10 -4
  13. package/src/modules/db/actions/db-status.ts +9 -4
  14. package/src/modules/db/actions/db-verify.ts +9 -4
  15. package/src/modules/docs/actions/doc-add.ts +12 -4
  16. package/src/modules/docs/actions/doc-attach-note.ts +11 -4
  17. package/src/modules/docs/actions/doc-attach.ts +18 -4
  18. package/src/modules/docs/actions/doc-attachments.ts +9 -4
  19. package/src/modules/docs/actions/doc-detach.ts +11 -4
  20. package/src/modules/docs/actions/doc-get.ts +9 -4
  21. package/src/modules/docs/actions/doc-list.ts +9 -4
  22. package/src/modules/docs/actions/doc-remove.ts +9 -4
  23. package/src/modules/docs/actions/doc-update.ts +12 -4
  24. package/src/modules/docs/actions/docs-bind.ts +13 -4
  25. package/src/modules/docs/actions/docs-index.ts +9 -4
  26. package/src/modules/docs/actions/docs-link.ts +14 -4
  27. package/src/modules/docs/actions/docs-notebind.ts +13 -4
  28. package/src/modules/docs/actions/docs-seed.ts +9 -4
  29. package/src/modules/file/actions/file-content.ts +10 -4
  30. package/src/modules/file/actions/file-get.ts +10 -4
  31. package/src/modules/file/actions/file-list.ts +11 -4
  32. package/src/modules/file/actions/file-orphans.ts +9 -4
  33. package/src/modules/file/actions/file-prune.ts +10 -4
  34. package/src/modules/file/actions/file-remove.ts +10 -4
  35. package/src/modules/file/actions/file-sync.ts +13 -4
  36. package/src/modules/file/actions/file-upload.ts +15 -4
  37. package/src/modules/localtask/actions/localtask-add.ts +24 -4
  38. package/src/modules/localtask/actions/localtask-attach-note.ts +13 -4
  39. package/src/modules/localtask/actions/localtask-attach.ts +22 -4
  40. package/src/modules/localtask/actions/localtask-attachments.ts +11 -4
  41. package/src/modules/localtask/actions/localtask-cancel.ts +10 -4
  42. package/src/modules/localtask/actions/localtask-cancelMany.ts +11 -4
  43. package/src/modules/localtask/actions/localtask-chain.ts +11 -4
  44. package/src/modules/localtask/actions/localtask-claim.ts +12 -4
  45. package/src/modules/localtask/actions/localtask-clone.ts +11 -4
  46. package/src/modules/localtask/actions/localtask-closeMany.ts +13 -4
  47. package/src/modules/localtask/actions/localtask-config.ts +19 -4
  48. package/src/modules/localtask/actions/localtask-detach.ts +13 -4
  49. package/src/modules/localtask/actions/localtask-done.ts +12 -4
  50. package/src/modules/localtask/actions/localtask-events.ts +12 -4
  51. package/src/modules/localtask/actions/localtask-fork.ts +11 -4
  52. package/src/modules/localtask/actions/localtask-get.ts +11 -4
  53. package/src/modules/localtask/actions/localtask-importRemote.ts +13 -4
  54. package/src/modules/localtask/actions/localtask-list.ts +9 -4
  55. package/src/modules/localtask/actions/localtask-presence.ts +9 -4
  56. package/src/modules/localtask/actions/localtask-preview.ts +13 -4
  57. package/src/modules/localtask/actions/localtask-prune.ts +10 -4
  58. package/src/modules/localtask/actions/localtask-remove.ts +12 -4
  59. package/src/modules/localtask/actions/localtask-removeMany.ts +12 -4
  60. package/src/modules/localtask/actions/localtask-reopen.ts +17 -4
  61. package/src/modules/localtask/actions/localtask-reorder.ts +15 -4
  62. package/src/modules/localtask/actions/localtask-task-restore.ts +11 -4
  63. package/src/modules/localtask/actions/localtask-timegoalLog.ts +11 -4
  64. package/src/modules/localtask/actions/localtask-topic-add.ts +10 -4
  65. package/src/modules/localtask/actions/localtask-topic-remove.ts +11 -4
  66. package/src/modules/localtask/actions/localtask-topic-removeMany.ts +12 -4
  67. package/src/modules/localtask/actions/localtask-update.ts +22 -4
  68. package/src/modules/localtask/actions/localtask-wait.ts +13 -4
  69. package/src/modules/localtask/actions/task-move.ts +21 -4
  70. package/src/modules/repos/actions/board-add.ts +10 -4
  71. package/src/modules/repos/actions/board-assign.ts +12 -4
  72. package/src/modules/repos/actions/board-export.ts +9 -4
  73. package/src/modules/repos/actions/board-get.ts +9 -4
  74. package/src/modules/repos/actions/board-import.ts +9 -4
  75. package/src/modules/repos/actions/board-list.ts +9 -4
  76. package/src/modules/repos/actions/board-note.ts +11 -4
  77. package/src/modules/repos/actions/board-prefix.ts +10 -4
  78. package/src/modules/repos/actions/board-prune.ts +11 -4
  79. package/src/modules/repos/actions/board-rekey.ts +11 -4
  80. package/src/modules/repos/actions/board-remove.ts +9 -4
  81. package/src/modules/repos/actions/board-update.ts +11 -4
  82. package/src/modules/repos/actions/repo-add.ts +17 -4
  83. package/src/modules/repos/actions/repo-bind-topics.ts +10 -4
  84. package/src/modules/repos/actions/repo-bind.ts +12 -4
  85. package/src/modules/repos/actions/repo-clone.ts +14 -4
  86. package/src/modules/repos/actions/repo-detect.ts +9 -4
  87. package/src/modules/repos/actions/repo-doc-add.ts +15 -4
  88. package/src/modules/repos/actions/repo-doc-list.ts +9 -4
  89. package/src/modules/repos/actions/repo-doc-remove.ts +10 -4
  90. package/src/modules/repos/actions/repo-export.ts +12 -4
  91. package/src/modules/repos/actions/repo-get.ts +9 -4
  92. package/src/modules/repos/actions/repo-import-diff.ts +10 -4
  93. package/src/modules/repos/actions/repo-import.ts +14 -4
  94. package/src/modules/repos/actions/repo-key-migrate.ts +9 -4
  95. package/src/modules/repos/actions/repo-key-refresh.ts +11 -4
  96. package/src/modules/repos/actions/repo-key-set.ts +11 -4
  97. package/src/modules/repos/actions/repo-knowledge.ts +10 -4
  98. package/src/modules/repos/actions/repo-list.ts +9 -4
  99. package/src/modules/repos/actions/repo-open.ts +9 -4
  100. package/src/modules/repos/actions/repo-ref-add.ts +13 -4
  101. package/src/modules/repos/actions/repo-ref-backfill.ts +10 -4
  102. package/src/modules/repos/actions/repo-ref-check.ts +9 -4
  103. package/src/modules/repos/actions/repo-ref-clone.ts +16 -4
  104. package/src/modules/repos/actions/repo-ref-note.ts +12 -4
  105. package/src/modules/repos/actions/repo-ref-of.ts +9 -4
  106. package/src/modules/repos/actions/repo-ref-sync.ts +10 -4
  107. package/src/modules/repos/actions/repo-remote-check.ts +10 -4
  108. package/src/modules/repos/actions/repo-remote-list.ts +9 -4
  109. package/src/modules/repos/actions/repo-remote-pick.ts +10 -4
  110. package/src/modules/repos/actions/repo-remote.ts +11 -4
  111. package/src/modules/repos/actions/repo-remove.ts +9 -4
  112. package/src/modules/repos/actions/repo-scan.ts +11 -4
  113. package/src/modules/repos/actions/repo-update.ts +21 -4
  114. package/src/modules/setting/actions/setting-get.ts +9 -4
  115. package/src/modules/setting/actions/setting-set.ts +12 -4
  116. package/src/modules/system/actions/bootstrap.ts +7 -4
  117. package/src/modules/system/actions/health.ts +6 -3
  118. package/src/modules/system/actions/routes.ts +11 -3
  119. package/src/modules/system/routes.ts +1 -1
  120. package/src/modules/tasktool/actions/timegoal-check.ts +11 -4
  121. package/src/modules/tasktool/actions/timegoal-clear.ts +9 -4
  122. package/src/modules/tasktool/actions/timegoal-list.ts +9 -4
  123. package/src/modules/tasktool/actions/timegoal-log.ts +9 -4
  124. package/src/modules/tasktool/actions/timegoal-prune.ts +9 -4
  125. package/src/modules/tasktool/actions/timegoal-set.ts +11 -4
  126. package/src/modules/tasktool/actions/timegoal-show.ts +10 -4
  127. package/src/modules/tasktool/actions/timegoal-update.ts +11 -4
  128. package/src/modules/templates/actions/templates-add.ts +17 -4
  129. package/src/modules/templates/actions/templates-default.ts +13 -4
  130. package/src/modules/templates/actions/templates-list.ts +11 -4
  131. package/src/modules/templates/actions/templates-remove.ts +9 -4
  132. package/src/modules/templates/actions/templates-update.ts +15 -4
  133. package/src/modules/todo/actions/group-add.ts +10 -4
  134. package/src/modules/todo/actions/group-current.ts +9 -4
  135. package/src/modules/todo/actions/group-get.ts +9 -4
  136. package/src/modules/todo/actions/group-list.ts +9 -4
  137. package/src/modules/todo/actions/group-members.ts +9 -4
  138. package/src/modules/todo/actions/group-remove.ts +9 -4
  139. package/src/modules/todo/actions/group-update.ts +11 -4
  140. package/src/modules/todo/actions/group-use.ts +9 -4
  141. package/src/modules/todo/actions/prompt-get.ts +10 -4
  142. package/src/modules/todo/actions/prompt-remove.ts +10 -4
  143. package/src/modules/todo/actions/prompt-set.ts +11 -4
  144. package/src/modules/todo/actions/todo-add.ts +11 -4
  145. package/src/modules/todo/actions/todo-archive.ts +10 -4
  146. package/src/modules/todo/actions/todo-attach.ts +17 -4
  147. package/src/modules/todo/actions/todo-attachments.ts +12 -4
  148. package/src/modules/todo/actions/todo-done.ts +13 -4
  149. package/src/modules/todo/actions/todo-freeze.ts +12 -4
  150. package/src/modules/todo/actions/todo-get.ts +12 -4
  151. package/src/modules/todo/actions/todo-list.ts +11 -4
  152. package/src/modules/todo/actions/todo-remove.ts +12 -4
  153. package/src/modules/todo/actions/todo-unfreeze.ts +12 -4
  154. package/src/modules/todo/actions/todo-update.ts +15 -4
  155. package/src/modules/todo/actions/topic-add.ts +10 -4
  156. package/src/modules/todo/actions/topic-list.ts +9 -4
  157. package/src/modules/todo/actions/topic-remove.ts +10 -4
  158. package/src/runtime/action-decorator.ts +2 -2
  159. package/src/runtime/codegen.ts +26 -41
  160. package/src/runtime/registry.ts +2 -2
  161. package/src/web/frontend/api/client.generated.ts +384 -532
  162. package/src/web/frontend/page/cloud/api.ts +99 -0
  163. package/src/web/frontend/page/cloud/index.tsx +13 -32
  164. package/src/web/frontend/page/dag/api.ts +20 -0
  165. package/src/web/frontend/page/dag/index.tsx +2 -5
  166. package/src/web/frontend/page/dir/api.ts +135 -0
  167. package/src/web/frontend/page/dir/index.tsx +37 -57
  168. package/src/web/frontend/page/dir/task-actions.ts +39 -59
  169. package/src/web/frontend/page/dir/task-chain.ts +2 -2
  170. package/src/web/frontend/page/dir/task-feedback.ts +19 -23
  171. package/src/web/frontend/page/dir/task-goal.ts +3 -3
  172. package/src/web/frontend/page/dir/task.tsx +3 -3
  173. package/src/web/frontend/page/doc/api.ts +82 -0
  174. package/src/web/frontend/page/doc/index.tsx +29 -32
  175. package/src/web/frontend/page/group/api.ts +24 -0
  176. package/src/web/frontend/page/group/index.tsx +7 -16
  177. package/src/web/frontend/page/overview/api.ts +16 -0
  178. package/src/web/frontend/page/overview/index.tsx +2 -2
  179. package/src/web/frontend/page/progress/api.ts +20 -0
  180. package/src/web/frontend/page/progress/index.tsx +3 -6
  181. package/src/web/frontend/page/refs/api.ts +14 -0
  182. package/src/web/frontend/page/refs/index.tsx +2 -4
  183. package/src/web/frontend/page/repos/api.ts +197 -0
  184. package/src/web/frontend/page/repos/bind-modals.tsx +4 -7
  185. package/src/web/frontend/page/repos/board-admin.tsx +6 -6
  186. package/src/web/frontend/page/repos/doc-search-modal.tsx +4 -4
  187. package/src/web/frontend/page/repos/index.tsx +10 -14
  188. package/src/web/frontend/page/repos/pending-section.tsx +7 -13
  189. package/src/web/frontend/page/repos/ref-panel.tsx +9 -14
  190. package/src/web/frontend/page/repos/remote-modal.tsx +4 -28
  191. package/src/web/frontend/page/repos/repo-form-modal.tsx +4 -4
  192. package/src/web/frontend/page/settings/api.ts +29 -0
  193. package/src/web/frontend/page/settings/index.tsx +3 -3
  194. package/src/web/frontend/page/settings/prompt-templates-section.tsx +4 -4
  195. package/src/web/frontend/page/settings/sidebar-section.tsx +2 -2
  196. package/src/web/public/assets/Introduction-Du_dycft.js +6 -0
  197. package/src/web/public/assets/{bar-B9WWmCpt.js → bar-B52NTf_v.js} +1 -1
  198. package/src/web/public/assets/cloud-Droja_aT.js +3 -0
  199. package/src/web/public/assets/{composer-panel-ByezS8Xv.js → composer-panel-DpiU2h50.js} +1 -1
  200. package/src/web/public/assets/dag-Ca-wjIxQ.js +1 -0
  201. package/src/web/public/assets/{deleted-panel-BcbtctNF.js → deleted-panel-K9GgfR8t.js} +1 -1
  202. package/src/web/public/assets/dir-DacRpcBt.js +5 -0
  203. package/src/web/public/assets/group-TPuU-QVc.js +2 -0
  204. package/src/web/public/assets/{index-D8MvtVAm.js → index-BkLkooKe.js} +2 -2
  205. package/src/web/public/assets/{md-history-BqZvzWiD.js → md-history-0GBWw4qr.js} +1 -1
  206. package/src/web/public/assets/overview-B3kHI66i.js +1 -0
  207. package/src/web/public/assets/progress-CdhFz0Lz.js +3 -0
  208. package/src/web/public/assets/refs-BDxfuH6R.js +1 -0
  209. package/src/web/public/assets/repos-C8jRM7wS.js +15 -0
  210. package/src/web/public/assets/{route-crumb-CWVu80du.js → route-crumb-QvahotvN.js} +1 -1
  211. package/src/web/public/assets/settings-BBcdGLTc.js +1 -0
  212. package/src/web/public/assets/{status-tag-DRl9E2Os.js → status-tag-BheHByek.js} +1 -1
  213. package/src/web/public/assets/task-CUkQaLBZ.js +11 -0
  214. package/src/web/public/assets/task-utils-_JAWRAz6.js +12 -0
  215. package/src/web/public/assets/{templates-Df__0k-F.js → templates-CbRyW3PJ.js} +1 -1
  216. package/src/web/public/assets/{tool-bar-Cv7f6p4v.js → tool-bar-BAmT-BI-.js} +1 -1
  217. package/src/web/public/index.html +1 -1
  218. package/src/modules/auth/schemas.ts +0 -27
  219. package/src/modules/bundled/schemas.ts +0 -32
  220. package/src/modules/db/schemas.ts +0 -27
  221. package/src/modules/docs/schemas.ts +0 -107
  222. package/src/modules/file/schemas.ts +0 -61
  223. package/src/modules/localtask/schemas.ts +0 -310
  224. package/src/modules/repos/schemas.ts +0 -310
  225. package/src/modules/setting/schemas.ts +0 -18
  226. package/src/modules/system/schemas.ts +0 -30
  227. package/src/modules/tasktool/schemas.ts +0 -52
  228. package/src/modules/templates/schemas.ts +0 -50
  229. package/src/modules/todo/schemas.ts +0 -177
  230. package/src/web/public/assets/Introduction-aQCeCLrV.js +0 -6
  231. package/src/web/public/assets/cloud-C4b8SU7C.js +0 -3
  232. package/src/web/public/assets/dag-jvrjx4i7.js +0 -1
  233. package/src/web/public/assets/dir-B82XBb1J.js +0 -5
  234. package/src/web/public/assets/group-BPUOO_QM.js +0 -2
  235. package/src/web/public/assets/overview-DMihuyzh.js +0 -1
  236. package/src/web/public/assets/progress-D-rMgz3w.js +0 -3
  237. package/src/web/public/assets/refs-D21jmrn6.js +0 -1
  238. package/src/web/public/assets/repos-B94tMDGs.js +0 -15
  239. package/src/web/public/assets/settings-DgTt4JG5.js +0 -1
  240. package/src/web/public/assets/task-B2x5GoV3.js +0 -11
  241. package/src/web/public/assets/task-utils-By8gLpHY.js +0 -12
@@ -1,19 +1,28 @@
1
1
  // todo.done —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
2
2
  //
3
- // 契约常量在 ../schemas.ts(zod);本文件只做「声明 + 实现」,业务在服务层。
3
+ // 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
+ import { z } from 'zod';
5
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
6
- import { todoDoneInput } from '../schemas.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class TodoDoneAction extends ActionBase<typeof todoDoneInput> {
10
+ /** todo.done 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ ref: z.string().describe("要完成的那条的内容(整串)"),
13
+ result: z.string().optional().describe("完成结果摘要"),
14
+ topic: z.string().optional().describe("消歧:同内容有多条时用主题收窄"),
15
+ pick: z.number().optional().describe("消歧:同内容多条时按编号选(配合报错里的列表)"),
16
+ group: z.number().optional().describe("工作空间 id(默认取当前)"),
17
+ });
18
+
19
+ export class TodoDoneAction extends ActionBase<typeof input> {
11
20
  @action({
12
21
  id: 'todo.done',
13
22
  cli: ['todo', 'done'],
14
23
  http: ['POST', '/api/todo/done'],
15
24
  summary: '标记完成(--ref 定位;--result 写进 note 作为完成结果)',
16
- input: todoDoneInput,
25
+ input,
17
26
  render: (d: any) => `已完成 [${d.task.topic}] ${d.task.text}\n ${d.task.doneAt}`,
18
27
  })
19
28
  override async run(ctx: ActionInput<this['_input']>) {
@@ -1,19 +1,27 @@
1
1
  // todo.freeze —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
2
2
  //
3
- // 契约常量在 ../schemas.ts(zod);本文件只做「声明 + 实现」,业务在服务层。
3
+ // 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
+ import { z } from 'zod';
5
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
6
- import { todoFreezeInput } from '../schemas.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class TodoFreezeAction extends ActionBase<typeof todoFreezeInput> {
10
+ /** todo.freeze 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ ref: z.string().describe("要冻结的那条的内容(整串)"),
13
+ topic: z.string().optional().describe("消歧:同内容有多条时用主题收窄"),
14
+ pick: z.number().optional().describe("消歧:同内容多条时按编号选(配合报错里的列表)"),
15
+ group: z.number().optional().describe("工作空间 id(默认取当前)"),
16
+ });
17
+
18
+ export class TodoFreezeAction extends ActionBase<typeof input> {
11
19
  @action({
12
20
  id: 'todo.freeze',
13
21
  cli: ['todo', 'freeze'],
14
22
  http: ['POST', '/api/todo/freeze'],
15
23
  summary: '冻结任务(按内容定位;id 保留,解冻时校验冲突)',
16
- input: todoFreezeInput,
24
+ input,
17
25
  render: (d: any) => `已冻结 [${d.task.topic}] ${d.task.text}`,
18
26
  })
19
27
  override async run(ctx: ActionInput<this['_input']>) {
@@ -1,20 +1,28 @@
1
1
  // todo.get —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
2
2
  //
3
- // 契约常量在 ../schemas.ts(zod);本文件只做「声明 + 实现」,业务在服务层。
3
+ // 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
+ import { z } from 'zod';
5
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
6
- import { todoGetInput } from '../schemas.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  import { renderTask } from '../support.js';
9
9
  const service: any = serviceNs;
10
10
 
11
- export class TodoGetAction extends ActionBase<typeof todoGetInput> {
11
+ /** todo.get 的入参契约(CLI 与 HTTP 共用同一份)。 */
12
+ const input = z.object({
13
+ ref: z.string().describe("任务内容(整串)"),
14
+ topic: z.string().optional().describe("消歧:同内容有多条时用主题收窄"),
15
+ pick: z.number().optional().describe("消歧:同内容多条时按编号选(配合报错里的列表)"),
16
+ group: z.number().optional().describe("工作空间 id(默认取当前)"),
17
+ });
18
+
19
+ export class TodoGetAction extends ActionBase<typeof input> {
12
20
  @action({
13
21
  id: 'todo.get',
14
22
  cli: ['todo', 'get'],
15
23
  http: ['GET', '/api/todo/item'],
16
24
  summary: '查看单个任务(按内容定位;自动在待办/已完成/冻结里找)',
17
- input: todoGetInput,
25
+ input,
18
26
  render: renderTask,
19
27
  })
20
28
  override async run(ctx: ActionInput<this['_input']>) {
@@ -1,20 +1,27 @@
1
1
  // todo.list —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
2
2
  //
3
- // 契约常量在 ../schemas.ts(zod);本文件只做「声明 + 实现」,业务在服务层。
3
+ // 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
+ import { z } from 'zod';
5
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
6
- import { todoListInput } from '../schemas.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  import { renderTaskList } from '../support.js';
9
9
  const service: any = serviceNs;
10
10
 
11
- export class TodoListAction extends ActionBase<typeof todoListInput> {
11
+ /** todo.list 的入参契约(CLI 与 HTTP 共用同一份)。 */
12
+ const input = z.object({
13
+ topic: z.string().optional().describe("只看某个主题"),
14
+ status: z.enum(["open", "done", "freeze", "all"]).default('all'),
15
+ group: z.number().optional().describe("工作空间 id(默认取当前)"),
16
+ });
17
+
18
+ export class TodoListAction extends ActionBase<typeof input> {
12
19
  @action({
13
20
  id: 'todo.list',
14
21
  cli: ['todo', 'list'],
15
22
  http: ['GET', '/api/todo'],
16
23
  summary: '列出任务(--topic / --status 过滤;默认三个桶全列)',
17
- input: todoListInput,
24
+ input,
18
25
  render: renderTaskList,
19
26
  })
20
27
  override async run(ctx: ActionInput<this['_input']>) {
@@ -1,19 +1,27 @@
1
1
  // todo.remove —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
2
2
  //
3
- // 契约常量在 ../schemas.ts(zod);本文件只做「声明 + 实现」,业务在服务层。
3
+ // 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
+ import { z } from 'zod';
5
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
6
- import { todoRemoveInput } from '../schemas.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class TodoRemoveAction extends ActionBase<typeof todoRemoveInput> {
10
+ /** todo.remove 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ ref: z.string().describe("要删的那条的内容(整串)"),
13
+ topic: z.string().optional().describe("消歧:同内容有多条时用主题收窄"),
14
+ pick: z.number().optional().describe("消歧:同内容多条时按编号选(配合报错里的列表)"),
15
+ group: z.number().optional().describe("工作空间 id(默认取当前)"),
16
+ });
17
+
18
+ export class TodoRemoveAction extends ActionBase<typeof input> {
11
19
  @action({
12
20
  id: 'todo.remove',
13
21
  cli: ['todo', 'remove'],
14
22
  http: ['DELETE', '/api/todo/item'],
15
23
  summary: '删除任务(按内容定位,只删命中的那一条)',
16
- input: todoRemoveInput,
24
+ input,
17
25
  render: (d: any) => `已删除 [${d.removed.topic}] ${d.removed.text}`,
18
26
  })
19
27
  override async run(ctx: ActionInput<this['_input']>) {
@@ -1,19 +1,27 @@
1
1
  // todo.unfreeze —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
2
2
  //
3
- // 契约常量在 ../schemas.ts(zod);本文件只做「声明 + 实现」,业务在服务层。
3
+ // 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
+ import { z } from 'zod';
5
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
6
- import { todoUnfreezeInput } from '../schemas.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class TodoUnfreezeAction extends ActionBase<typeof todoUnfreezeInput> {
10
+ /** todo.unfreeze 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ ref: z.string().describe("要解冻的那条的内容(整串)"),
13
+ topic: z.string().optional().describe("消歧:同内容有多条时用主题收窄"),
14
+ pick: z.number().optional().describe("消歧:同内容多条时按编号选(配合报错里的列表)"),
15
+ group: z.number().optional().describe("工作空间 id(默认取当前)"),
16
+ });
17
+
18
+ export class TodoUnfreezeAction extends ActionBase<typeof input> {
11
19
  @action({
12
20
  id: 'todo.unfreeze',
13
21
  cli: ['todo', 'unfreeze'],
14
22
  http: ['POST', '/api/todo/unfreeze'],
15
23
  summary: '解冻回待办(按内容定位;id 撞车时自动换新 id)',
16
- input: todoUnfreezeInput,
24
+ input,
17
25
  render: (d: any) =>
18
26
  `已解冻 [${d.task.topic}] ${d.task.text}` +
19
27
  (d.reIded ? '\n(原 id 与现有待办冲突,已分配新 id)' : ''),
@@ -1,19 +1,30 @@
1
1
  // todo.update —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
2
2
  //
3
- // 契约常量在 ../schemas.ts(zod);本文件只做「声明 + 实现」,业务在服务层。
3
+ // 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
+ import { z } from 'zod';
5
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
6
- import { todoUpdateInput } from '../schemas.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class TodoUpdateAction extends ActionBase<typeof todoUpdateInput> {
10
+ /** todo.update 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ ref: z.string().describe("要改的那条的内容(整串)"),
13
+ topic: z.string().optional().describe("改成这个主题"),
14
+ text: z.string().optional().describe("改成这个内容"),
15
+ note: z.string().optional(),
16
+ matchTopic: z.string().optional().describe("消歧:同内容有多条时用主题收窄"),
17
+ pick: z.number().optional().describe("消歧:同内容多条时按编号选(配合报错里的列表)"),
18
+ group: z.number().optional().describe("工作空间 id(默认取当前)"),
19
+ });
20
+
21
+ export class TodoUpdateAction extends ActionBase<typeof input> {
11
22
  @action({
12
23
  id: 'todo.update',
13
24
  cli: ['todo', 'update'],
14
25
  http: ['PATCH', '/api/todo/item'],
15
26
  summary: '编辑任务(按内容定位,只改传入的字段)',
16
- input: todoUpdateInput,
27
+ input,
17
28
  render: (d: any) => `已更新(在 ${d.bucket}): [${d.task.topic}] ${d.task.text}`,
18
29
  })
19
30
  override async run(ctx: ActionInput<this['_input']>) {
@@ -1,20 +1,26 @@
1
1
  // topic.add —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
2
2
  //
3
- // 契约常量在 ../schemas.ts(zod);本文件只做「声明 + 实现」,业务在服务层。
3
+ // 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
+ import { z } from 'zod';
5
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
6
- import { topicAddInput } from '../schemas.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class TopicAddAction extends ActionBase<typeof topicAddInput> {
10
+ /** topic.add 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ name: z.string(),
13
+ group: z.number().optional().describe("工作空间 id(默认取当前)"),
14
+ });
15
+
16
+ export class TopicAddAction extends ActionBase<typeof input> {
11
17
  @action({
12
18
  id: 'topic.add',
13
19
  cli: ['topic', 'add'],
14
20
  http: ['POST', '/api/topics'],
15
21
  summary: '加入快捷主题',
16
22
  args: ['name'],
17
- input: topicAddInput,
23
+ input,
18
24
  render: (d: any) => (d.added ? `已加入快捷主题: ${d.name}` : `${d.name} 已在快捷列表中`),
19
25
  })
20
26
  override async run(ctx: ActionInput<this['_input']>) {
@@ -1,19 +1,24 @@
1
1
  // topic.list —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
2
2
  //
3
- // 契约常量在 ../schemas.ts(zod);本文件只做「声明 + 实现」,业务在服务层。
3
+ // 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
+ import { z } from 'zod';
5
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
6
- import { topicListInput } from '../schemas.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class TopicListAction extends ActionBase<typeof topicListInput> {
10
+ /** topic.list 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ group: z.number().optional().describe("工作空间 id(默认取当前)"),
13
+ });
14
+
15
+ export class TopicListAction extends ActionBase<typeof input> {
11
16
  @action({
12
17
  id: 'topic.list',
13
18
  cli: ['topic', 'list'],
14
19
  http: ['GET', '/api/topics'],
15
20
  summary: '快捷主题列表(含各状态任务数)',
16
- input: topicListInput,
21
+ input,
17
22
  render: (list: any) => {
18
23
  if (!list.length) return '(暂无快捷主题)';
19
24
  const w: any = Math.max(...list.map((t: any) => t.name.length));
@@ -1,20 +1,26 @@
1
1
  // topic.remove —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
2
2
  //
3
- // 契约常量在 ../schemas.ts(zod);本文件只做「声明 + 实现」,业务在服务层。
3
+ // 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
4
4
  import { action } from '../../../runtime/action-decorator.js';
5
+ import { z } from 'zod';
5
6
  import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
6
- import { topicRemoveInput } from '../schemas.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class TopicRemoveAction extends ActionBase<typeof topicRemoveInput> {
10
+ /** topic.remove 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ name: z.string(),
13
+ group: z.number().optional().describe("工作空间 id(默认取当前)"),
14
+ });
15
+
16
+ export class TopicRemoveAction extends ActionBase<typeof input> {
11
17
  @action({
12
18
  id: 'topic.remove',
13
19
  cli: ['topic', 'remove'],
14
20
  http: ['DELETE', '/api/topics'],
15
21
  summary: '移出快捷主题(不动已有任务;仍被任务使用时会在结果里提示)',
16
22
  args: ['name'],
17
- input: topicRemoveInput,
23
+ input,
18
24
  render: (d: any) => {
19
25
  if (!d.removed) return `${d.name} 本就不在快捷列表中`;
20
26
  return d.inUse
@@ -1,7 +1,7 @@
1
1
  // action 装饰器:在 ModuleBase 子类的方法上声明 action(zod schema 即契约)。
2
2
  //
3
- // 单一通道:全部新业务 action 都走这里——声明(@action 元数据)与实现同文件,
4
- // 契约常量放同域 schemas.ts;模块的 actions 字段由 zodActionsOf(instance) 收集。
3
+ // 单一通道:全部新业务 action 都走这里——声明(@action 元数据)、契约(zod schema)
4
+ // 与实现同文件;模块的 actions 字段由 zodActionsOf(instance) 收集。
5
5
  // legacy plain-object action(flags 表契约)只剩 runtime 内建命令在用
6
6
  // (serve / help / version)——它们是平台命令,不是业务 action。
7
7
  // Registry / CliApp / ApiRouter 仍对两通道无感;内建命令迁进 platform 模块后,
@@ -15,9 +15,10 @@
15
15
  // 只生成 zod 通道(@action 装饰)的 action;legacy flags 通道的 action 继续由前端
16
16
  // 手写 client.js 调用(迁移完成后删除)。
17
17
  //
18
- // 入参 schema 常量命名约定:<camelCase(actionId)>Input(如 system.bootstrap →
19
- // systemBootstrapInput)。约定破了 codegen 会生成指向不存在符号的 import,
20
- // tests/unit/api-client.test.mjs 的新鲜度对账会当场红。
18
+ // 入参 schema 常量**不再跨文件引用**:契约(zod)就声明在各自的 action 文件里,
19
+ // 入参类型经基类泛型模板(ActionBase<typeof input> + 幻影字段 _input)流到前端——
20
+ // 生成物只引 action 类(清单),不引契约文件,也不再依赖
21
+ // `<camelCase(actionId)>Input` 命名约定。
21
22
  //
22
23
  // 出参没有 schema——**实现即契约**:返回类型直接从 action 类的方法签名推断,
23
24
  // 同一信息只声明一次,「两份声明漂移」无从发生。
@@ -25,16 +26,9 @@ import { describeInput } from './zod-bridge.js';
25
26
  import { routeParams, type ZodBoundAction } from './action-decorator.js';
26
27
  import { cliPathsOf } from './spec.js';
27
28
 
28
- /** actionId → 入参 schema 常量名:system.bootstrap → systemBootstrapInput */
29
- export function schemaName(actionId: string): string {
30
- const parts = actionId.split(/[.\-_]/).filter(Boolean);
31
- const camel = parts
32
- .map((seg, i) => (i === 0 ? seg : seg[0]!.toUpperCase() + seg.slice(1)))
33
- .join('');
34
- return camel + 'Input';
35
- }
36
-
37
- /** 前端方法名:取 actionId 最后一段,撞名时加模块前缀(todo.get 与 repo.get → get / repoGet)。 */
29
+ /**
30
+ * 前端方法名:取 actionId 最后一段,撞名时加模块前缀(todo.get 与 repo.get → get / repoGet)。
31
+ */
38
32
  export function clientMethodNames(actions: readonly ZodBoundAction[]): Map<string, string> {
39
33
  const used = new Set<string>();
40
34
  const names = new Map<string, string>();
@@ -56,53 +50,44 @@ export function clientMethodNames(actions: readonly ZodBoundAction[]): Map<strin
56
50
  }
57
51
 
58
52
  /**
59
- * schema 常量按**模块**分组 import:一个模块一份 schemas.ts
60
- * (src/modules/<域>/schemas.ts),生成物从 src/web/frontend/api/ 算起
61
- * 的相对路径固定为 '../../../modules/<域>/schemas.js'。
53
+ * 入参类型锚点:**从 action 类反推**——类上的泛型实参(基类模板封装的 schema 类型)
54
+ * 经幻影字段 `_input` 露出,前端只引 action 类即可拿到入参形状:
55
+ *
56
+ * z.input<InstanceType<typeof LocaltaskGetAction>['_input']>
57
+ *
58
+ * 契约常量因此降级为「文件内的实现细节」——不再有独立的 schemas.ts,
59
+ * 也不再需要 `<camelCase(actionId)>Input` 命名约定(约定破了会生成指向不存在
60
+ * 符号的代码,是旧方案最大的脆弱点)。
62
61
  */
63
- function schemaModuleOf(moduleId: string): string {
64
- return `../../../modules/${moduleId}/schemas.js`;
62
+ function inputTypeOf(a: ZodBoundAction): string {
63
+ return `z.input<InstanceType<typeof ${a.className}>['_input']>`;
65
64
  }
66
65
 
67
- /** 生成前端 apiclient 的 TS 源码(type-only 引 schema:zod 不进浏览器包)。 */
66
+ /** 生成前端 apiclient 的 TS 源码(type-only 引 action 类:zod 不进浏览器包)。 */
68
67
  export function generateClientSource(actions: readonly ZodBoundAction[]): string {
69
68
  const withHttp = actions.filter((a) => a.http);
70
69
  const methodNames = clientMethodNames(withHttp);
71
70
 
72
- // 按模块分组收集两类类型锚点:入参 schema 常量(schemas.ts)+ action 类(清单)。
73
- // 返回类型不引 schema——**实现即契约**:从 action 类的方法签名直接推断。
74
- const inputTypes = new Map<string, Set<string>>();
71
+ // 类型锚点只有一类:action 类(清单)。入参形状由类上的泛型推出来,
72
+ // 返回类型则从方法签名直接推断——**实现即契约**。
75
73
  const actionClasses = new Map<string, Set<string>>();
76
74
  for (const a of withHttp) {
77
- if (describeInput(a.input, a.args ?? []).length) {
78
- const set = inputTypes.get(a.module) || new Set<string>();
79
- set.add(schemaName(a.id));
80
- inputTypes.set(a.module, set);
81
- }
82
75
  const classes = actionClasses.get(a.module) || new Set<string>();
83
76
  classes.add(a.className);
84
77
  actionClasses.set(a.module, classes);
85
78
  }
86
- const imports = [...inputTypes.entries()]
79
+ const imports = [...actionClasses.entries()]
87
80
  .sort(([a], [b]) => a.localeCompare(b))
88
81
  .map(([module, names]) => {
89
82
  const list = [...names].sort().map((n) => ` ${n},`).join('\n');
90
- return `import type {\n${list}\n} from '${schemaModuleOf(module)}';`;
83
+ return `import type {\n${list}\n} from '../../../modules/${module}/actions/_manifest.generated.js';`;
91
84
  })
92
- .concat(
93
- [...actionClasses.entries()]
94
- .sort(([a], [b]) => a.localeCompare(b))
95
- .map(([module, names]) => {
96
- const list = [...names].sort().map((n) => ` ${n},`).join('\n');
97
- return `import type {\n${list}\n} from '../../../modules/${module}/actions/_manifest.generated.js';`;
98
- }),
99
- )
100
85
  .join('\n');
101
86
 
102
87
  const iface = withHttp
103
88
  .map((a) => {
104
89
  const fields = describeInput(a.input, a.args ?? []);
105
- const paramType = `z.input<typeof ${schemaName(a.id)}>`;
90
+ const paramType = inputTypeOf(a);
106
91
  const required = fields.some((f) => f.required);
107
92
  const sig = fields.length === 0 ? '' : required ? `input: ${paramType}` : `input?: ${paramType}`;
108
93
  const doc = a.summary ? `/** ${a.summary} */\n ` : '';
@@ -112,7 +97,7 @@ export function generateClientSource(actions: readonly ZodBoundAction[]): string
112
97
 
113
98
  const impl = withHttp
114
99
  .map((a) => {
115
- const inName = schemaName(a.id);
100
+ const paramType = inputTypeOf(a);
116
101
  const methodName = methodNames.get(a.id)!;
117
102
  const [method, pattern] = a.http!;
118
103
  const params = routeParams(pattern);
@@ -124,11 +109,11 @@ export function generateClientSource(actions: readonly ZodBoundAction[]): string
124
109
  const lines: string[] = [];
125
110
  lines.push(` // action: ${a.id}`);
126
111
  const argSig =
127
- fields.length === 0 ? '' : required ? `input: z.input<typeof ${inName}>` : `input?: z.input<typeof ${inName}>`;
112
+ fields.length === 0 ? '' : required ? `input: ${paramType}` : `input?: ${paramType}`;
128
113
  lines.push(` async ${methodName}(${argSig}) {`);
129
114
  if (fields.length) {
130
115
  // 可选入参统一兜底成对象:后面的索引访问不用再判 undefined
131
- lines.push(` const inp = input ?? ({} as z.input<typeof ${inName}>);`);
116
+ lines.push(` const inp = input ?? ({} as ${paramType});`);
132
117
  }
133
118
 
134
119
  // 路径参数是位置参数(zodActionsOf 已校验 :param ⊆ args),编码后插进模板。
@@ -5,8 +5,8 @@
5
5
  // 一条 action 同时声明 cli 与 http,二者写在同一处,不可能分叉。
6
6
  //
7
7
  // 新增功能域:
8
- // 1. 写 src/modules/<name>/(模板形态:index.ts 装配 ModuleBase 子类 + schemas.ts
9
- // 契约 + actions/*.ts 一条 action 一个文件 + _manifest.generated.ts)
8
+ // 1. 写 src/modules/<name>/(模板形态:index.ts 装配 ModuleBase 子类 +
9
+ // actions/*.ts 一条 action 一个文件(契约 zod 就声明在该文件里)+ _manifest.generated.ts)
10
10
  // 2. 在下面的 create 调用里加上它的实例
11
11
  // 3. 需要面板的话,到 web/frontend/ 写视图并在前端 registry 登记——**不经过后端**
12
12
  //