nx-kv 0.48.0 → 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 (242) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/package.json +1 -1
  3. package/src/modules/auth/actions/auth-login.ts +13 -6
  4. package/src/modules/auth/actions/auth-logout.ts +11 -6
  5. package/src/modules/auth/actions/auth-me.ts +11 -6
  6. package/src/modules/auth/actions/auth-status.ts +11 -6
  7. package/src/modules/bundled/actions/bundled-get.ts +14 -6
  8. package/src/modules/bundled/actions/bundled-groups.ts +11 -6
  9. package/src/modules/bundled/actions/bundled-install.ts +15 -6
  10. package/src/modules/bundled/actions/bundled-list.ts +11 -6
  11. package/src/modules/db/actions/db-backup.ts +12 -6
  12. package/src/modules/db/actions/db-migrate.ts +12 -6
  13. package/src/modules/db/actions/db-status.ts +11 -6
  14. package/src/modules/db/actions/db-verify.ts +11 -6
  15. package/src/modules/docs/actions/doc-add.ts +14 -6
  16. package/src/modules/docs/actions/doc-attach-note.ts +13 -6
  17. package/src/modules/docs/actions/doc-attach.ts +20 -6
  18. package/src/modules/docs/actions/doc-attachments.ts +11 -6
  19. package/src/modules/docs/actions/doc-detach.ts +13 -6
  20. package/src/modules/docs/actions/doc-get.ts +11 -6
  21. package/src/modules/docs/actions/doc-list.ts +11 -6
  22. package/src/modules/docs/actions/doc-remove.ts +11 -6
  23. package/src/modules/docs/actions/doc-update.ts +14 -6
  24. package/src/modules/docs/actions/docs-bind.ts +15 -6
  25. package/src/modules/docs/actions/docs-index.ts +11 -6
  26. package/src/modules/docs/actions/docs-link.ts +16 -6
  27. package/src/modules/docs/actions/docs-notebind.ts +15 -6
  28. package/src/modules/docs/actions/docs-seed.ts +11 -6
  29. package/src/modules/file/actions/file-content.ts +18 -10
  30. package/src/modules/file/actions/file-get.ts +12 -6
  31. package/src/modules/file/actions/file-list.ts +13 -6
  32. package/src/modules/file/actions/file-orphans.ts +11 -6
  33. package/src/modules/file/actions/file-prune.ts +12 -6
  34. package/src/modules/file/actions/file-remove.ts +12 -6
  35. package/src/modules/file/actions/file-sync.ts +15 -6
  36. package/src/modules/file/actions/file-upload.ts +17 -6
  37. package/src/modules/localtask/actions/localtask-add.ts +26 -6
  38. package/src/modules/localtask/actions/localtask-attach-note.ts +15 -6
  39. package/src/modules/localtask/actions/localtask-attach.ts +24 -6
  40. package/src/modules/localtask/actions/localtask-attachments.ts +13 -6
  41. package/src/modules/localtask/actions/localtask-cancel.ts +12 -6
  42. package/src/modules/localtask/actions/localtask-cancelMany.ts +13 -6
  43. package/src/modules/localtask/actions/localtask-chain.ts +13 -6
  44. package/src/modules/localtask/actions/localtask-claim.ts +14 -6
  45. package/src/modules/localtask/actions/localtask-clone.ts +13 -6
  46. package/src/modules/localtask/actions/localtask-closeMany.ts +15 -6
  47. package/src/modules/localtask/actions/localtask-config.ts +23 -8
  48. package/src/modules/localtask/actions/localtask-detach.ts +15 -6
  49. package/src/modules/localtask/actions/localtask-done.ts +14 -6
  50. package/src/modules/localtask/actions/localtask-events.ts +19 -9
  51. package/src/modules/localtask/actions/localtask-fork.ts +13 -6
  52. package/src/modules/localtask/actions/localtask-get.ts +13 -6
  53. package/src/modules/localtask/actions/localtask-importRemote.ts +20 -9
  54. package/src/modules/localtask/actions/localtask-list.ts +11 -6
  55. package/src/modules/localtask/actions/localtask-presence.ts +11 -6
  56. package/src/modules/localtask/actions/localtask-preview.ts +15 -6
  57. package/src/modules/localtask/actions/localtask-prune.ts +12 -6
  58. package/src/modules/localtask/actions/localtask-remove.ts +14 -6
  59. package/src/modules/localtask/actions/localtask-removeMany.ts +14 -6
  60. package/src/modules/localtask/actions/localtask-reopen.ts +22 -7
  61. package/src/modules/localtask/actions/localtask-reorder.ts +17 -6
  62. package/src/modules/localtask/actions/localtask-task-restore.ts +13 -6
  63. package/src/modules/localtask/actions/localtask-timegoalLog.ts +13 -6
  64. package/src/modules/localtask/actions/localtask-topic-add.ts +12 -6
  65. package/src/modules/localtask/actions/localtask-topic-remove.ts +13 -6
  66. package/src/modules/localtask/actions/localtask-topic-removeMany.ts +14 -6
  67. package/src/modules/localtask/actions/localtask-update.ts +24 -6
  68. package/src/modules/localtask/actions/localtask-wait.ts +15 -6
  69. package/src/modules/localtask/actions/task-move.ts +23 -6
  70. package/src/modules/repos/actions/board-add.ts +12 -6
  71. package/src/modules/repos/actions/board-assign.ts +14 -6
  72. package/src/modules/repos/actions/board-export.ts +11 -6
  73. package/src/modules/repos/actions/board-get.ts +11 -6
  74. package/src/modules/repos/actions/board-import.ts +17 -7
  75. package/src/modules/repos/actions/board-list.ts +11 -6
  76. package/src/modules/repos/actions/board-note.ts +13 -6
  77. package/src/modules/repos/actions/board-prefix.ts +12 -6
  78. package/src/modules/repos/actions/board-prune.ts +13 -6
  79. package/src/modules/repos/actions/board-rekey.ts +13 -6
  80. package/src/modules/repos/actions/board-remove.ts +11 -6
  81. package/src/modules/repos/actions/board-update.ts +13 -6
  82. package/src/modules/repos/actions/repo-add.ts +19 -6
  83. package/src/modules/repos/actions/repo-bind-topics.ts +12 -6
  84. package/src/modules/repos/actions/repo-bind.ts +14 -6
  85. package/src/modules/repos/actions/repo-clone.ts +16 -6
  86. package/src/modules/repos/actions/repo-detect.ts +11 -6
  87. package/src/modules/repos/actions/repo-doc-add.ts +17 -6
  88. package/src/modules/repos/actions/repo-doc-list.ts +11 -6
  89. package/src/modules/repos/actions/repo-doc-remove.ts +12 -6
  90. package/src/modules/repos/actions/repo-export.ts +14 -6
  91. package/src/modules/repos/actions/repo-get.ts +11 -6
  92. package/src/modules/repos/actions/repo-import-diff.ts +12 -6
  93. package/src/modules/repos/actions/repo-import.ts +16 -6
  94. package/src/modules/repos/actions/repo-key-migrate.ts +11 -6
  95. package/src/modules/repos/actions/repo-key-refresh.ts +13 -6
  96. package/src/modules/repos/actions/repo-key-set.ts +13 -6
  97. package/src/modules/repos/actions/repo-knowledge.ts +12 -6
  98. package/src/modules/repos/actions/repo-list.ts +11 -6
  99. package/src/modules/repos/actions/repo-open.ts +11 -6
  100. package/src/modules/repos/actions/repo-ref-add.ts +15 -6
  101. package/src/modules/repos/actions/repo-ref-backfill.ts +12 -6
  102. package/src/modules/repos/actions/repo-ref-check.ts +11 -6
  103. package/src/modules/repos/actions/repo-ref-clone.ts +18 -6
  104. package/src/modules/repos/actions/repo-ref-note.ts +14 -6
  105. package/src/modules/repos/actions/repo-ref-of.ts +11 -6
  106. package/src/modules/repos/actions/repo-ref-sync.ts +12 -6
  107. package/src/modules/repos/actions/repo-remote-check.ts +12 -6
  108. package/src/modules/repos/actions/repo-remote-list.ts +11 -6
  109. package/src/modules/repos/actions/repo-remote-pick.ts +12 -6
  110. package/src/modules/repos/actions/repo-remote.ts +13 -6
  111. package/src/modules/repos/actions/repo-remove.ts +11 -6
  112. package/src/modules/repos/actions/repo-scan.ts +13 -6
  113. package/src/modules/repos/actions/repo-update.ts +23 -6
  114. package/src/modules/setting/actions/setting-get.ts +11 -6
  115. package/src/modules/setting/actions/setting-set.ts +14 -6
  116. package/src/modules/system/actions/bootstrap.ts +9 -7
  117. package/src/modules/system/actions/health.ts +8 -6
  118. package/src/modules/system/actions/routes.ts +13 -6
  119. package/src/modules/system/routes.ts +1 -1
  120. package/src/modules/tasktool/actions/timegoal-check.ts +13 -6
  121. package/src/modules/tasktool/actions/timegoal-clear.ts +11 -6
  122. package/src/modules/tasktool/actions/timegoal-list.ts +11 -6
  123. package/src/modules/tasktool/actions/timegoal-log.ts +11 -6
  124. package/src/modules/tasktool/actions/timegoal-prune.ts +11 -6
  125. package/src/modules/tasktool/actions/timegoal-set.ts +13 -6
  126. package/src/modules/tasktool/actions/timegoal-show.ts +12 -6
  127. package/src/modules/tasktool/actions/timegoal-update.ts +13 -6
  128. package/src/modules/templates/actions/templates-add.ts +19 -6
  129. package/src/modules/templates/actions/templates-default.ts +15 -6
  130. package/src/modules/templates/actions/templates-list.ts +13 -6
  131. package/src/modules/templates/actions/templates-remove.ts +11 -6
  132. package/src/modules/templates/actions/templates-update.ts +17 -6
  133. package/src/modules/todo/actions/group-add.ts +12 -6
  134. package/src/modules/todo/actions/group-current.ts +11 -6
  135. package/src/modules/todo/actions/group-get.ts +11 -6
  136. package/src/modules/todo/actions/group-list.ts +11 -6
  137. package/src/modules/todo/actions/group-members.ts +11 -6
  138. package/src/modules/todo/actions/group-remove.ts +11 -6
  139. package/src/modules/todo/actions/group-update.ts +13 -6
  140. package/src/modules/todo/actions/group-use.ts +11 -6
  141. package/src/modules/todo/actions/prompt-get.ts +12 -6
  142. package/src/modules/todo/actions/prompt-remove.ts +12 -6
  143. package/src/modules/todo/actions/prompt-set.ts +13 -6
  144. package/src/modules/todo/actions/todo-add.ts +13 -6
  145. package/src/modules/todo/actions/todo-archive.ts +12 -6
  146. package/src/modules/todo/actions/todo-attach.ts +19 -6
  147. package/src/modules/todo/actions/todo-attachments.ts +14 -6
  148. package/src/modules/todo/actions/todo-done.ts +15 -6
  149. package/src/modules/todo/actions/todo-freeze.ts +14 -6
  150. package/src/modules/todo/actions/todo-get.ts +14 -6
  151. package/src/modules/todo/actions/todo-list.ts +13 -6
  152. package/src/modules/todo/actions/todo-remove.ts +14 -6
  153. package/src/modules/todo/actions/todo-unfreeze.ts +14 -6
  154. package/src/modules/todo/actions/todo-update.ts +17 -6
  155. package/src/modules/todo/actions/topic-add.ts +12 -6
  156. package/src/modules/todo/actions/topic-list.ts +11 -6
  157. package/src/modules/todo/actions/topic-remove.ts +12 -6
  158. package/src/runtime/action-base.ts +41 -1
  159. package/src/runtime/action-decorator.ts +28 -13
  160. package/src/runtime/codegen.ts +26 -41
  161. package/src/runtime/registry.ts +2 -2
  162. package/src/web/frontend/api/client.generated.ts +550 -698
  163. package/src/web/frontend/page/cloud/api.ts +99 -0
  164. package/src/web/frontend/page/cloud/index.tsx +13 -32
  165. package/src/web/frontend/page/dag/api.ts +20 -0
  166. package/src/web/frontend/page/dag/index.tsx +2 -5
  167. package/src/web/frontend/page/dir/api.ts +135 -0
  168. package/src/web/frontend/page/dir/index.tsx +37 -57
  169. package/src/web/frontend/page/dir/task-actions.ts +39 -59
  170. package/src/web/frontend/page/dir/task-chain.ts +2 -2
  171. package/src/web/frontend/page/dir/task-feedback.ts +19 -23
  172. package/src/web/frontend/page/dir/task-goal.ts +3 -3
  173. package/src/web/frontend/page/dir/task.tsx +3 -3
  174. package/src/web/frontend/page/doc/api.ts +82 -0
  175. package/src/web/frontend/page/doc/index.tsx +29 -32
  176. package/src/web/frontend/page/group/api.ts +24 -0
  177. package/src/web/frontend/page/group/index.tsx +7 -16
  178. package/src/web/frontend/page/overview/api.ts +16 -0
  179. package/src/web/frontend/page/overview/index.tsx +2 -2
  180. package/src/web/frontend/page/progress/api.ts +20 -0
  181. package/src/web/frontend/page/progress/index.tsx +3 -6
  182. package/src/web/frontend/page/refs/api.ts +14 -0
  183. package/src/web/frontend/page/refs/index.tsx +2 -4
  184. package/src/web/frontend/page/repos/api.ts +197 -0
  185. package/src/web/frontend/page/repos/bind-modals.tsx +4 -7
  186. package/src/web/frontend/page/repos/board-admin.tsx +6 -6
  187. package/src/web/frontend/page/repos/doc-search-modal.tsx +4 -4
  188. package/src/web/frontend/page/repos/index.tsx +10 -14
  189. package/src/web/frontend/page/repos/pending-section.tsx +7 -13
  190. package/src/web/frontend/page/repos/ref-panel.tsx +9 -14
  191. package/src/web/frontend/page/repos/remote-modal.tsx +4 -28
  192. package/src/web/frontend/page/repos/repo-form-modal.tsx +4 -4
  193. package/src/web/frontend/page/settings/api.ts +29 -0
  194. package/src/web/frontend/page/settings/index.tsx +3 -3
  195. package/src/web/frontend/page/settings/prompt-templates-section.tsx +4 -4
  196. package/src/web/frontend/page/settings/sidebar-section.tsx +2 -2
  197. package/src/web/public/assets/Introduction-Du_dycft.js +6 -0
  198. package/src/web/public/assets/{bar-B9WWmCpt.js → bar-B52NTf_v.js} +1 -1
  199. package/src/web/public/assets/cloud-Droja_aT.js +3 -0
  200. package/src/web/public/assets/{composer-panel-ByezS8Xv.js → composer-panel-DpiU2h50.js} +1 -1
  201. package/src/web/public/assets/dag-Ca-wjIxQ.js +1 -0
  202. package/src/web/public/assets/{deleted-panel-BcbtctNF.js → deleted-panel-K9GgfR8t.js} +1 -1
  203. package/src/web/public/assets/dir-DacRpcBt.js +5 -0
  204. package/src/web/public/assets/group-TPuU-QVc.js +2 -0
  205. package/src/web/public/assets/{index-D8MvtVAm.js → index-BkLkooKe.js} +2 -2
  206. package/src/web/public/assets/{md-history-BqZvzWiD.js → md-history-0GBWw4qr.js} +1 -1
  207. package/src/web/public/assets/overview-B3kHI66i.js +1 -0
  208. package/src/web/public/assets/progress-CdhFz0Lz.js +3 -0
  209. package/src/web/public/assets/refs-BDxfuH6R.js +1 -0
  210. package/src/web/public/assets/repos-C8jRM7wS.js +15 -0
  211. package/src/web/public/assets/{route-crumb-CWVu80du.js → route-crumb-QvahotvN.js} +1 -1
  212. package/src/web/public/assets/settings-BBcdGLTc.js +1 -0
  213. package/src/web/public/assets/{status-tag-DRl9E2Os.js → status-tag-BheHByek.js} +1 -1
  214. package/src/web/public/assets/task-CUkQaLBZ.js +11 -0
  215. package/src/web/public/assets/task-utils-_JAWRAz6.js +12 -0
  216. package/src/web/public/assets/{templates-Df__0k-F.js → templates-CbRyW3PJ.js} +1 -1
  217. package/src/web/public/assets/{tool-bar-Cv7f6p4v.js → tool-bar-BAmT-BI-.js} +1 -1
  218. package/src/web/public/index.html +1 -1
  219. package/src/modules/auth/schemas.ts +0 -27
  220. package/src/modules/bundled/schemas.ts +0 -32
  221. package/src/modules/db/schemas.ts +0 -27
  222. package/src/modules/docs/schemas.ts +0 -107
  223. package/src/modules/file/schemas.ts +0 -61
  224. package/src/modules/localtask/schemas.ts +0 -310
  225. package/src/modules/repos/schemas.ts +0 -310
  226. package/src/modules/setting/schemas.ts +0 -18
  227. package/src/modules/system/schemas.ts +0 -29
  228. package/src/modules/tasktool/schemas.ts +0 -52
  229. package/src/modules/templates/schemas.ts +0 -50
  230. package/src/modules/todo/schemas.ts +0 -177
  231. package/src/web/public/assets/Introduction-aQCeCLrV.js +0 -6
  232. package/src/web/public/assets/cloud-C4b8SU7C.js +0 -3
  233. package/src/web/public/assets/dag-jvrjx4i7.js +0 -1
  234. package/src/web/public/assets/dir-B82XBb1J.js +0 -5
  235. package/src/web/public/assets/group-BPUOO_QM.js +0 -2
  236. package/src/web/public/assets/overview-DMihuyzh.js +0 -1
  237. package/src/web/public/assets/progress-D-rMgz3w.js +0 -3
  238. package/src/web/public/assets/refs-D21jmrn6.js +0 -1
  239. package/src/web/public/assets/repos-B94tMDGs.js +0 -15
  240. package/src/web/public/assets/settings-DgTt4JG5.js +0 -1
  241. package/src/web/public/assets/task-B2x5GoV3.js +0 -11
  242. package/src/web/public/assets/task-utils-By8gLpHY.js +0 -12
@@ -1,26 +1,32 @@
1
1
  // repo.remote.check —— 由 .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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { repoRemoteCheckInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as remoteNs from '../remote.js';
8
8
  const remote: any = remoteNs;
9
9
 
10
- export class RepoRemoteCheckAction extends ActionBase {
10
+ /** repo.remote.check 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ id: z.string().optional(),
13
+ url: z.string().optional().describe("要检查的地址;缺省 = 当前采纳的 remote"),
14
+ });
15
+
16
+ export class RepoRemoteCheckAction extends ActionBase<typeof input> {
11
17
  @action({
12
18
  id: 'repo.remote.check',
13
19
  cli: ['repo', 'remote', 'check'],
14
20
  http: ['GET', '/api/repos/remote/check'],
15
21
  summary: '检查 remote 是否存在(git ls-remote:存在 / 不存在 / 不可达,三种结论分清)',
16
22
  args: ['id'],
17
- input: repoRemoteCheckInput,
23
+ input,
18
24
  render: (d: any) => {
19
25
  const mark: any = ({ exists: '✓ 存在', missing: '✗ 不存在', unreachable: '? 不可达' } as any)[d.status] || d.status;
20
26
  return `${mark} ${d.url} —— ${d.detail}`;
21
27
  },
22
28
  })
23
- async check(ctx: any) {
29
+ override async run(ctx: ActionInput<this['_input']>) {
24
30
 
25
31
  return remote.checkRemote(ctx.id, ctx.url);
26
32
 
@@ -1,20 +1,25 @@
1
1
  // repo.remote.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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { repoRemoteListInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as remoteNs from '../remote.js';
8
8
  const remote: any = remoteNs;
9
9
 
10
- export class RepoRemoteListAction extends ActionBase {
10
+ /** repo.remote.list 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ id: z.string().optional(),
13
+ });
14
+
15
+ export class RepoRemoteListAction extends ActionBase<typeof input> {
11
16
  @action({
12
17
  id: 'repo.remote.list',
13
18
  cli: ['repo', 'remote', 'list'],
14
19
  http: ['GET', '/api/repos/remote/list'],
15
20
  summary: '列出仓库的全部 remote 候选(git remote -v),标出当前采纳的那条',
16
21
  args: ['id'],
17
- input: repoRemoteListInput,
22
+ input,
18
23
  render: (d: any) => {
19
24
  const lines: any = [`「${d.name}」的 remote(当前采纳: ${d.current || '(无)'})`];
20
25
  for (const r of d.remotes) {
@@ -24,7 +29,7 @@ export class RepoRemoteListAction extends ActionBase {
24
29
  return lines.join('\n');
25
30
  },
26
31
  })
27
- async list(ctx: any) {
32
+ override async run(ctx: ActionInput<this['_input']>) {
28
33
 
29
34
  return remote.listRemotes(ctx.id);
30
35
 
@@ -1,23 +1,29 @@
1
1
  // repo.remote.pick —— 由 .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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { repoRemotePickInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as remoteNs from '../remote.js';
8
8
  const remote: any = remoteNs;
9
9
 
10
- export class RepoRemotePickAction extends ActionBase {
10
+ /** repo.remote.pick 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ id: z.string(),
13
+ url: z.string(),
14
+ });
15
+
16
+ export class RepoRemotePickAction extends ActionBase<typeof input> {
11
17
  @action({
12
18
  id: 'repo.remote.pick',
13
19
  cli: ['repo', 'remote', 'pick'],
14
20
  http: ['POST', '/api/repos/remote/pick'],
15
21
  summary: '人工指定采纳哪条 remote(key 随之重算;自定义 key 不动)',
16
22
  args: ['id', 'url'],
17
- input: repoRemotePickInput,
23
+ input,
18
24
  render: (d: any) => `已对齐 remote: ${d.key} → ${d.remote}${d.keyCustom ? '(自定义 key 不变)' : ''}`,
19
25
  })
20
- async pick(ctx: any) {
26
+ override async run(ctx: ActionInput<this['_input']>) {
21
27
 
22
28
  return remote.pickRemote(ctx.id, ctx.url);
23
29
 
@@ -1,9 +1,9 @@
1
1
  // repo.remote —— 由 .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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { repoRemoteInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  import * as keysNs from '../keys.js';
9
9
  import { gitOrigin as _gitOrigin } from '../git.js';
@@ -13,17 +13,24 @@ const keys: any = keysNs;
13
13
  const gitOrigin: any = _gitOrigin;
14
14
  const badInput: any = _badInput;
15
15
 
16
- export class RepoRemoteAction extends ActionBase {
16
+ /** repo.remote 的入参契约(CLI 与 HTTP 共用同一份)。 */
17
+ const input = z.object({
18
+ id: z.string(),
19
+ url: z.string().optional().describe("远程地址;缺省时 git remote get-url origin"),
20
+ refresh: z.boolean().optional().describe("同时扫描全部 remote 并提示可更新的 key(同 repo key refresh)"),
21
+ });
22
+
23
+ export class RepoRemoteAction extends ActionBase<typeof input> {
17
24
  @action({
18
25
  id: 'repo.remote',
19
26
  cli: ['repo', 'remote'],
20
27
  http: ['POST', '/api/repos/remote'],
21
28
  summary: '登记/更新仓库的远程 git 地址(无 --url = 从目录 origin 读取存档并重算 key)',
22
29
  args: ['id'],
23
- input: repoRemoteInput,
30
+ input,
24
31
  render: (r: any) => (r.items ? keys.renderRefresh(r) : `已登记远程地址: ${r.name} -> ${r.remote}(key: ${r.key})`),
25
32
  })
26
- async remote(ctx: any) {
33
+ override async run(ctx: ActionInput<this['_input']>) {
27
34
 
28
35
  if (ctx.refresh) return keys.refreshKeys({ id: ctx.id, apply: false });
29
36
  let url: any = String(ctx.url || '').trim();
@@ -1,23 +1,28 @@
1
1
  // repo.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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { repoRemoveInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class RepoRemoveAction extends ActionBase {
10
+ /** repo.remove 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ id: z.string(),
13
+ });
14
+
15
+ export class RepoRemoveAction extends ActionBase<typeof input> {
11
16
  @action({
12
17
  id: 'repo.remove',
13
18
  cli: ['repo', 'remove'],
14
19
  http: ['DELETE', '/api/repos/:id'],
15
20
  summary: '移除登记(不动磁盘文件)',
16
21
  args: ['id'],
17
- input: repoRemoveInput,
22
+ input,
18
23
  render: (r: any) => `已移除登记: ${r.name}(磁盘文件未动)`,
19
24
  })
20
- async remove(ctx: any) {
25
+ override async run(ctx: ActionInput<this['_input']>) {
21
26
 
22
27
  return service.removeRepo(ctx.id);
23
28
 
@@ -1,22 +1,29 @@
1
1
  // repo.scan —— 由 .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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { repoScanInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  import { lastSeg as _lastSeg } from '../cli/render.js';
9
9
  const service: any = serviceNs;
10
10
  const lastSeg: any = _lastSeg;
11
11
 
12
- export class RepoScanAction extends ActionBase {
12
+ /** repo.scan 的入参契约(CLI 与 HTTP 共用同一份)。 */
13
+ const input = z.object({
14
+ root: z.string().optional(),
15
+ depth: z.number().default(3),
16
+ 'dry-run': z.boolean().optional().describe("只列出发现的仓库,不登记"),
17
+ });
18
+
19
+ export class RepoScanAction extends ActionBase<typeof input> {
13
20
  @action({
14
21
  id: 'repo.scan',
15
22
  cli: ['repo', 'scan'],
16
23
  http: ['POST', '/api/repos/scan'],
17
24
  summary: '扫描目录发现 git 仓库;--dry-run 只列出(发现模式,不登记)',
18
25
  args: ['root'],
19
- input: repoScanInput,
26
+ input,
20
27
  render: (d: any) => {
21
28
  const head: any = `${d.dryRun ? '发现(未登记)' : '扫描'} ${d.root}: ${d.scanned} 个 git 仓库`;
22
29
  if (!d.scanned) return `${head}\n(这个深度下没有找到)`;
@@ -33,7 +40,7 @@ export class RepoScanAction extends ActionBase {
33
40
  return lines.join('\n');
34
41
  },
35
42
  })
36
- async scan(ctx: any) {
43
+ override async run(ctx: ActionInput<this['_input']>) {
37
44
 
38
45
  return service.scanRepos(ctx.root || process.cwd(), ctx.depth, { dryRun: ctx['dry-run'] === true });
39
46
 
@@ -1,23 +1,40 @@
1
1
  // repo.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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { repoUpdateInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class RepoUpdateAction extends ActionBase {
10
+ /** repo.update 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ id: z.string(),
13
+ path: z.string().optional(),
14
+ name: z.string().optional(),
15
+ icon: z.string().optional().describe("项目图标(emoji 或单字符,≤8 字;留空 = 用默认图标)"),
16
+ desc: z.string().optional().describe("(已废弃)描述是文档:改正文用 docs set,换绑用 docs bind —— 传了会报错"),
17
+ notes: z.string().optional(),
18
+ type: z.enum(["dev", "ref"]).optional().describe("dev=开发仓库,ref=参考仓库"),
19
+ remote: z.string().optional().describe("远程 git 地址"),
20
+ key: z.string().optional().describe("自定义 key(给了就视为 keyCustom)"),
21
+ 'key-custom': z.boolean().optional().describe("key 是否自定义(true=不跟随 remote)"),
22
+ 'get-loop': z.enum(["on", "off"]).optional().describe("持续 get 开关"),
23
+ 'get-loop-minutes': z.number().optional().describe("无任务时的阻塞窗口(分钟,默认 10,上限 600s 夹制)"),
24
+ 'get-loop-template': z.string().optional().describe("领到任务时追加的「继续 get」模板——整体替换为这一条(多条在设置面板按条增删;占位符 {{task.id}}/{{task.text}} 等;置空 = 用默认模板)"),
25
+ });
26
+
27
+ export class RepoUpdateAction extends ActionBase<typeof input> {
11
28
  @action({
12
29
  id: 'repo.update',
13
30
  cli: ['repo', 'update'],
14
31
  http: ['PATCH', '/api/repos/:id'],
15
32
  summary: '修改仓库路径 / 名称 / 备注 / 类型 / 远程地址 / key;--get-loop* 配置项目级「持续 get」(waitgoal:该项目 get 无任务时阻塞等人回填 + 交付文本带继续 get 模板)。描述已改为文档,不再经这里改',
16
33
  args: ['id'],
17
- input: repoUpdateInput,
34
+ input,
18
35
  render: (r: any) => `已更新: ${r.name}(key: ${r.key})`,
19
36
  })
20
- async update(ctx: any) {
37
+ override async run(ctx: ActionInput<this['_input']>) {
21
38
 
22
39
  const patch: any = { ...ctx, keyCustom: ctx['key-custom'] === undefined ? undefined : ctx['key-custom'] === true };
23
40
  if (ctx['get-loop'] !== undefined || ctx['get-loop-minutes'] !== undefined || ctx['get-loop-template'] !== undefined) {
@@ -1,22 +1,27 @@
1
1
  // setting.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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { settingGetInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class SettingGetAction extends ActionBase {
10
+ /** setting.get 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+
13
+ });
14
+
15
+ export class SettingGetAction extends ActionBase<typeof input> {
11
16
  @action({
12
17
  id: 'setting.get',
13
18
  cli: ['setting', 'get'],
14
19
  http: ['GET', '/api/setting'],
15
20
  summary: '读本机设置(附件自动下载、附件目录、参考仓库存储根)',
16
- input: settingGetInput,
21
+ input,
17
22
  render: (d: any) => service.renderSettings(d),
18
23
  })
19
- async get(_ctx: any) {
24
+ override async run(_ctx: ActionInput<this['_input']>) {
20
25
 
21
26
  return service.getSettings();
22
27
 
@@ -1,22 +1,30 @@
1
1
  // setting.set —— 由 .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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { settingSetInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as serviceNs from '../service.js';
8
8
  const service: any = serviceNs;
9
9
 
10
- export class SettingSetAction extends ActionBase {
10
+ /** setting.set 的入参契约(CLI 与 HTTP 共用同一份)。 */
11
+ const input = z.object({
12
+ autoSyncAttachments: z.boolean().optional().describe("读任务时自动把附件下载到本地"),
13
+ attachmentsDir: z.string().optional().describe("附件本地目录(空 = ~/.nx-kv/attachments/<工作空间>/)"),
14
+ gitRepoRoot: z.string().optional().describe("参考仓库存储根目录(非 C 盘;空 = clone 参考仓库被拒绝)"),
15
+ gitDevRoot: z.string().optional().describe("导入布局时开发仓库的默认克隆根(空 = 只登记不克隆)"),
16
+ });
17
+
18
+ export class SettingSetAction extends ActionBase<typeof input> {
11
19
  @action({
12
20
  id: 'setting.set',
13
21
  cli: ['setting', 'set'],
14
22
  http: ['POST', '/api/setting'],
15
23
  summary: '改本机设置(只改传入项)',
16
- input: settingSetInput,
24
+ input,
17
25
  render: (d: any) => service.renderSettings(d),
18
26
  })
19
- async set(ctx: any) {
27
+ override async run(ctx: ActionInput<this['_input']>) {
20
28
 
21
29
  return service.setSettings(ctx);
22
30
 
@@ -1,29 +1,31 @@
1
1
  // system.bootstrap —— 面板启动上下文:版本 / 登录态 / 工作空间 / 命令表。
2
2
  //
3
- // 「一条 action 一个文件」:声明(@action 元数据)与实现同文件;契约在 ../schemas.ts。
3
+ // 「一条 action 一个文件」:声明(@action 元数据)、契约(zod)与实现同文件。
4
4
  // 依赖经 IoC 容器取(this.deps.get('config'))——测试可换一整个容器,不必改构造参数。
5
- import { z } from 'zod';
6
5
  import { readFileSync } from 'node:fs';
6
+ import { z } from 'zod';
7
7
  import { action } from '../../../runtime/action-decorator.js';
8
- import { ActionBase } from '../../../runtime/action-base.js';
8
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
9
9
  import { commandTable, type CommandEntry } from '../../../core/command-table.js';
10
10
  import { APP_NAME, DEFAULT_PORT } from '../../../core/paths.js';
11
- import { systemBootstrapInput } from '../schemas.js';
12
11
 
13
12
  /** package.json 的版本号(只读一次;与 cli.ts 各读各的,避免引入跨层依赖)。 */
14
13
  const VERSION: string = JSON.parse(
15
14
  readFileSync(new URL('../../../../package.json', import.meta.url), 'utf8'),
16
15
  ).version;
17
16
 
18
- export class BootstrapAction extends ActionBase {
17
+ /** system.bootstrap 的入参契约(CLI 与 HTTP 共用同一份)。 */
18
+ const input = z.object({});
19
+
20
+ export class BootstrapAction extends ActionBase<typeof input> {
19
21
  @action({
20
22
  id: 'system.bootstrap',
21
23
  cli: ['bootstrap'],
22
24
  http: ['GET', '/api/bootstrap'],
23
25
  summary: '聚合上下文:版本 / 登录态 / 工作空间 / 命令表',
24
- input: systemBootstrapInput,
26
+ input,
25
27
  })
26
- async bootstrap(_ctx: z.output<typeof systemBootstrapInput>): Promise<{
28
+ override async run(_ctx: ActionInput<this['_input']>): Promise<{
27
29
  app: { name: string; version: string };
28
30
  version: string;
29
31
  configPath: string;
@@ -2,11 +2,10 @@
2
2
  //
3
3
  // 依赖经 IoC 容器取(config);后端探测是**只读**的 /api/v1/user/info,
4
4
  // 失败不算错误(health 的语义是「如实报告」,错误文案进 backendError 字段)。
5
- import { z } from 'zod';
6
5
  import { readFileSync } from 'node:fs';
6
+ import { z } from 'zod';
7
7
  import { action } from '../../../runtime/action-decorator.js';
8
- import { ActionBase } from '../../../runtime/action-base.js';
9
- import { systemHealthInput } from '../schemas.js';
8
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
10
9
 
11
10
  const VERSION: string = JSON.parse(
12
11
  readFileSync(new URL('../../../../package.json', import.meta.url), 'utf8'),
@@ -22,15 +21,18 @@ export interface HealthReport {
22
21
  backendError: string;
23
22
  }
24
23
 
25
- export class HealthAction extends ActionBase {
24
+ /** system.health 的入参契约(CLI 与 HTTP 共用同一份)。 */
25
+ const input = z.object({});
26
+
27
+ export class HealthAction extends ActionBase<typeof input> {
26
28
  @action({
27
29
  id: 'system.health',
28
30
  cli: ['health'],
29
31
  http: ['GET', '/api/health'],
30
32
  summary: '健康检查(本机配置 + 后端可达性)',
31
- input: systemHealthInput,
33
+ input,
32
34
  })
33
- async health(_ctx: z.output<typeof systemHealthInput>): Promise<HealthReport> {
35
+ override async run(_ctx: ActionInput<this['_input']>): Promise<HealthReport> {
34
36
  const config = this.deps.get('config');
35
37
  const cfg = await config.loadConfig();
36
38
  let backend = 'unreachable';
@@ -4,23 +4,30 @@
4
4
  // 写入**含平台命令的完整版**(registry 先写过一次 action 版)。所以这条命令
5
5
  // 看到的表与 `help --json` 看到的完全同源同长。过滤逻辑在 ../routes.ts(纯函数),
6
6
  // 这里只做声明与装配。
7
- import { z } from 'zod';
8
7
  import { action } from '../../../runtime/action-decorator.js';
9
- import { ActionBase } from '../../../runtime/action-base.js';
8
+ import { z } from 'zod';
9
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
10
10
  import { commandTable, type CommandEntry } from '../../../core/command-table.js';
11
11
  import { filterRoutes, renderRoutes } from '../routes.js';
12
- import { systemRoutesInput } from '../schemas.js';
13
12
 
14
- export class RoutesAction extends ActionBase {
13
+ /** system.routes 的入参契约(CLI 与 HTTP 共用同一份)。 */
14
+ const input = z.object({
15
+ // 模块 id 过滤(正查)
16
+ module: z.string().optional(),
17
+ // `METHOD /api/path`(反查,:param 视为通配)
18
+ http: z.string().optional(),
19
+ });
20
+
21
+ export class RoutesAction extends ActionBase<typeof input> {
15
22
  @action({
16
23
  id: 'system.routes',
17
24
  cli: ['routes'],
18
25
  http: null, // 纯 CLI:对照表本身没有 HTTP 端点(面板从 /api/bootstrap 拿同一张表)
19
26
  summary: '命令 ↔ 路由对照表(--module 过滤;--http 反查命令)',
20
- input: systemRoutesInput,
27
+ input,
21
28
  render: (list) => renderRoutes(list as CommandEntry[]),
22
29
  })
23
- async routes(ctx: z.output<typeof systemRoutesInput>): Promise<CommandEntry[]> {
30
+ override async run(ctx: ActionInput<this['_input']>): Promise<CommandEntry[]> {
24
31
  return filterRoutes(commandTable(), ctx);
25
32
  }
26
33
  }
@@ -8,7 +8,7 @@
8
8
  import { badInput, notFound } from '../../core/errors.js';
9
9
  import type { CommandEntry } from '../../core/command-table.js';
10
10
 
11
- /** routes 的输入(--module / --http,schema 见 ../schemas.ts)。 */
11
+ /** routes 的输入(--module / --http,schema 见本文件下方)。 */
12
12
  export interface RoutesCtx {
13
13
  module?: string;
14
14
  http?: string;
@@ -1,25 +1,32 @@
1
1
  // timegoal.check —— 由 .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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { timegoalCheckInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as serviceNs from '../timegoal.js';
8
8
  import { badInput as _badInput } from '../../../core/errors.js';
9
9
  import { renderCheck } from '../support.js';
10
10
  const service: any = serviceNs;
11
11
  const badInput: any = _badInput;
12
12
 
13
- export class TimegoalCheckAction extends ActionBase {
13
+ /** timegoal.check 的入参契约(CLI 与 HTTP 共用同一份)。 */
14
+ const input = z.object({
15
+ cwd: z.string().optional().describe("工作目录(与 --task 二选一)"),
16
+ task: z.string().optional().describe("任务级 goal key(task:<topicKey>:<taskId>;带时长任务领取时自带)"),
17
+ summary: z.string().describe("当前现状(每次 check 记录到日志,≤2000 字)"),
18
+ });
19
+
20
+ export class TimegoalCheckAction extends ActionBase<typeof input> {
14
21
  @action({
15
22
  id: 'timegoal.check',
16
23
  cli: ['timegoal', 'check'],
17
24
  http: ['GET', '/api/timegoals/check'],
18
25
  summary: '时间运算 + 原文回显 prompt + 写入一次状态日志;每次必须提供当前现状 --summary',
19
- input: timegoalCheckInput,
26
+ input,
20
27
  render: renderCheck,
21
28
  })
22
- async check(ctx: any) {
29
+ override async run(ctx: ActionInput<this['_input']>) {
23
30
 
24
31
  if (!ctx.cwd && !ctx.task) throw badInput('请给 --cwd <工作目录> 或 --task <任务goal key>');
25
32
  return ctx.task
@@ -1,23 +1,28 @@
1
1
  // timegoal.clear —— 由 .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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { timegoalClearInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as serviceNs from '../timegoal.js';
8
8
  import { renderClear } from '../support.js';
9
9
  const service: any = serviceNs;
10
10
 
11
- export class TimegoalClearAction extends ActionBase {
11
+ /** timegoal.clear 的入参契约(CLI 与 HTTP 共用同一份)。 */
12
+ const input = z.object({
13
+ cwd: z.string().describe("工作目录(与 timegoal 一对一)"),
14
+ });
15
+
16
+ export class TimegoalClearAction extends ActionBase<typeof input> {
12
17
  @action({
13
18
  id: 'timegoal.clear',
14
19
  cli: ['timegoal', 'clear'],
15
20
  http: ['DELETE', '/api/timegoals'],
16
21
  summary: '清空本目录 timegoal(无则 no_goal,不抛错)',
17
- input: timegoalClearInput,
22
+ input,
18
23
  render: renderClear,
19
24
  })
20
- async clear(ctx: any) {
25
+ override async run(ctx: ActionInput<this['_input']>) {
21
26
 
22
27
  return service.clearTimegoal({ cwd: ctx.cwd });
23
28
 
@@ -1,23 +1,28 @@
1
1
  // timegoal.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 { ActionBase } from '../../../runtime/action-base.js';
6
- import { timegoalListInput } from '../schemas.js';
5
+ import { z } from 'zod';
6
+ import { ActionBase, type ActionInput } from '../../../runtime/action-base.js';
7
7
  import * as serviceNs from '../timegoal.js';
8
8
  import { renderList } from '../support.js';
9
9
  const service: any = serviceNs;
10
10
 
11
- export class TimegoalListAction extends ActionBase {
11
+ /** timegoal.list 的入参契约(CLI 与 HTTP 共用同一份)。 */
12
+ const input = z.object({
13
+
14
+ });
15
+
16
+ export class TimegoalListAction extends ActionBase<typeof input> {
12
17
  @action({
13
18
  id: 'timegoal.list',
14
19
  cli: ['timegoal', 'list'],
15
20
  http: ['GET', '/api/timegoals/all'],
16
21
  summary: '列出所有有 timegoal 的目录(按截止升序;已到点的单列在归档区)',
17
- input: timegoalListInput,
22
+ input,
18
23
  render: renderList,
19
24
  })
20
- async list(_ctx: any) {
25
+ override async run(_ctx: ActionInput<this['_input']>) {
21
26
 
22
27
  return service.listTimegoals();
23
28