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.
- package/CHANGELOG.md +20 -0
- package/package.json +1 -1
- package/src/modules/auth/actions/auth-login.ts +11 -4
- package/src/modules/auth/actions/auth-logout.ts +9 -4
- package/src/modules/auth/actions/auth-me.ts +9 -4
- package/src/modules/auth/actions/auth-status.ts +9 -4
- package/src/modules/bundled/actions/bundled-get.ts +12 -4
- package/src/modules/bundled/actions/bundled-groups.ts +9 -4
- package/src/modules/bundled/actions/bundled-install.ts +13 -4
- package/src/modules/bundled/actions/bundled-list.ts +9 -4
- package/src/modules/db/actions/db-backup.ts +10 -4
- package/src/modules/db/actions/db-migrate.ts +10 -4
- package/src/modules/db/actions/db-status.ts +9 -4
- package/src/modules/db/actions/db-verify.ts +9 -4
- package/src/modules/docs/actions/doc-add.ts +12 -4
- package/src/modules/docs/actions/doc-attach-note.ts +11 -4
- package/src/modules/docs/actions/doc-attach.ts +18 -4
- package/src/modules/docs/actions/doc-attachments.ts +9 -4
- package/src/modules/docs/actions/doc-detach.ts +11 -4
- package/src/modules/docs/actions/doc-get.ts +9 -4
- package/src/modules/docs/actions/doc-list.ts +9 -4
- package/src/modules/docs/actions/doc-remove.ts +9 -4
- package/src/modules/docs/actions/doc-update.ts +12 -4
- package/src/modules/docs/actions/docs-bind.ts +13 -4
- package/src/modules/docs/actions/docs-index.ts +9 -4
- package/src/modules/docs/actions/docs-link.ts +14 -4
- package/src/modules/docs/actions/docs-notebind.ts +13 -4
- package/src/modules/docs/actions/docs-seed.ts +9 -4
- package/src/modules/file/actions/file-content.ts +10 -4
- package/src/modules/file/actions/file-get.ts +10 -4
- package/src/modules/file/actions/file-list.ts +11 -4
- package/src/modules/file/actions/file-orphans.ts +9 -4
- package/src/modules/file/actions/file-prune.ts +10 -4
- package/src/modules/file/actions/file-remove.ts +10 -4
- package/src/modules/file/actions/file-sync.ts +13 -4
- package/src/modules/file/actions/file-upload.ts +15 -4
- package/src/modules/localtask/actions/localtask-add.ts +24 -4
- package/src/modules/localtask/actions/localtask-attach-note.ts +13 -4
- package/src/modules/localtask/actions/localtask-attach.ts +22 -4
- package/src/modules/localtask/actions/localtask-attachments.ts +11 -4
- package/src/modules/localtask/actions/localtask-cancel.ts +10 -4
- package/src/modules/localtask/actions/localtask-cancelMany.ts +11 -4
- package/src/modules/localtask/actions/localtask-chain.ts +11 -4
- package/src/modules/localtask/actions/localtask-claim.ts +12 -4
- package/src/modules/localtask/actions/localtask-clone.ts +11 -4
- package/src/modules/localtask/actions/localtask-closeMany.ts +13 -4
- package/src/modules/localtask/actions/localtask-config.ts +19 -4
- package/src/modules/localtask/actions/localtask-detach.ts +13 -4
- package/src/modules/localtask/actions/localtask-done.ts +12 -4
- package/src/modules/localtask/actions/localtask-events.ts +12 -4
- package/src/modules/localtask/actions/localtask-fork.ts +11 -4
- package/src/modules/localtask/actions/localtask-get.ts +11 -4
- package/src/modules/localtask/actions/localtask-importRemote.ts +13 -4
- package/src/modules/localtask/actions/localtask-list.ts +9 -4
- package/src/modules/localtask/actions/localtask-presence.ts +9 -4
- package/src/modules/localtask/actions/localtask-preview.ts +13 -4
- package/src/modules/localtask/actions/localtask-prune.ts +10 -4
- package/src/modules/localtask/actions/localtask-remove.ts +12 -4
- package/src/modules/localtask/actions/localtask-removeMany.ts +12 -4
- package/src/modules/localtask/actions/localtask-reopen.ts +17 -4
- package/src/modules/localtask/actions/localtask-reorder.ts +15 -4
- package/src/modules/localtask/actions/localtask-task-restore.ts +11 -4
- package/src/modules/localtask/actions/localtask-timegoalLog.ts +11 -4
- package/src/modules/localtask/actions/localtask-topic-add.ts +10 -4
- package/src/modules/localtask/actions/localtask-topic-remove.ts +11 -4
- package/src/modules/localtask/actions/localtask-topic-removeMany.ts +12 -4
- package/src/modules/localtask/actions/localtask-update.ts +22 -4
- package/src/modules/localtask/actions/localtask-wait.ts +13 -4
- package/src/modules/localtask/actions/task-move.ts +21 -4
- package/src/modules/repos/actions/board-add.ts +10 -4
- package/src/modules/repos/actions/board-assign.ts +12 -4
- package/src/modules/repos/actions/board-export.ts +9 -4
- package/src/modules/repos/actions/board-get.ts +9 -4
- package/src/modules/repos/actions/board-import.ts +9 -4
- package/src/modules/repos/actions/board-list.ts +9 -4
- package/src/modules/repos/actions/board-note.ts +11 -4
- package/src/modules/repos/actions/board-prefix.ts +10 -4
- package/src/modules/repos/actions/board-prune.ts +11 -4
- package/src/modules/repos/actions/board-rekey.ts +11 -4
- package/src/modules/repos/actions/board-remove.ts +9 -4
- package/src/modules/repos/actions/board-update.ts +11 -4
- package/src/modules/repos/actions/repo-add.ts +17 -4
- package/src/modules/repos/actions/repo-bind-topics.ts +10 -4
- package/src/modules/repos/actions/repo-bind.ts +12 -4
- package/src/modules/repos/actions/repo-clone.ts +14 -4
- package/src/modules/repos/actions/repo-detect.ts +9 -4
- package/src/modules/repos/actions/repo-doc-add.ts +15 -4
- package/src/modules/repos/actions/repo-doc-list.ts +9 -4
- package/src/modules/repos/actions/repo-doc-remove.ts +10 -4
- package/src/modules/repos/actions/repo-export.ts +12 -4
- package/src/modules/repos/actions/repo-get.ts +9 -4
- package/src/modules/repos/actions/repo-import-diff.ts +10 -4
- package/src/modules/repos/actions/repo-import.ts +14 -4
- package/src/modules/repos/actions/repo-key-migrate.ts +9 -4
- package/src/modules/repos/actions/repo-key-refresh.ts +11 -4
- package/src/modules/repos/actions/repo-key-set.ts +11 -4
- package/src/modules/repos/actions/repo-knowledge.ts +10 -4
- package/src/modules/repos/actions/repo-list.ts +9 -4
- package/src/modules/repos/actions/repo-open.ts +9 -4
- package/src/modules/repos/actions/repo-ref-add.ts +13 -4
- package/src/modules/repos/actions/repo-ref-backfill.ts +10 -4
- package/src/modules/repos/actions/repo-ref-check.ts +9 -4
- package/src/modules/repos/actions/repo-ref-clone.ts +16 -4
- package/src/modules/repos/actions/repo-ref-note.ts +12 -4
- package/src/modules/repos/actions/repo-ref-of.ts +9 -4
- package/src/modules/repos/actions/repo-ref-sync.ts +10 -4
- package/src/modules/repos/actions/repo-remote-check.ts +10 -4
- package/src/modules/repos/actions/repo-remote-list.ts +9 -4
- package/src/modules/repos/actions/repo-remote-pick.ts +10 -4
- package/src/modules/repos/actions/repo-remote.ts +11 -4
- package/src/modules/repos/actions/repo-remove.ts +9 -4
- package/src/modules/repos/actions/repo-scan.ts +11 -4
- package/src/modules/repos/actions/repo-update.ts +21 -4
- package/src/modules/setting/actions/setting-get.ts +9 -4
- package/src/modules/setting/actions/setting-set.ts +12 -4
- package/src/modules/system/actions/bootstrap.ts +7 -4
- package/src/modules/system/actions/health.ts +6 -3
- package/src/modules/system/actions/routes.ts +11 -3
- package/src/modules/system/routes.ts +1 -1
- package/src/modules/tasktool/actions/timegoal-check.ts +11 -4
- package/src/modules/tasktool/actions/timegoal-clear.ts +9 -4
- package/src/modules/tasktool/actions/timegoal-list.ts +9 -4
- package/src/modules/tasktool/actions/timegoal-log.ts +9 -4
- package/src/modules/tasktool/actions/timegoal-prune.ts +9 -4
- package/src/modules/tasktool/actions/timegoal-set.ts +11 -4
- package/src/modules/tasktool/actions/timegoal-show.ts +10 -4
- package/src/modules/tasktool/actions/timegoal-update.ts +11 -4
- package/src/modules/templates/actions/templates-add.ts +17 -4
- package/src/modules/templates/actions/templates-default.ts +13 -4
- package/src/modules/templates/actions/templates-list.ts +11 -4
- package/src/modules/templates/actions/templates-remove.ts +9 -4
- package/src/modules/templates/actions/templates-update.ts +15 -4
- package/src/modules/todo/actions/group-add.ts +10 -4
- package/src/modules/todo/actions/group-current.ts +9 -4
- package/src/modules/todo/actions/group-get.ts +9 -4
- package/src/modules/todo/actions/group-list.ts +9 -4
- package/src/modules/todo/actions/group-members.ts +9 -4
- package/src/modules/todo/actions/group-remove.ts +9 -4
- package/src/modules/todo/actions/group-update.ts +11 -4
- package/src/modules/todo/actions/group-use.ts +9 -4
- package/src/modules/todo/actions/prompt-get.ts +10 -4
- package/src/modules/todo/actions/prompt-remove.ts +10 -4
- package/src/modules/todo/actions/prompt-set.ts +11 -4
- package/src/modules/todo/actions/todo-add.ts +11 -4
- package/src/modules/todo/actions/todo-archive.ts +10 -4
- package/src/modules/todo/actions/todo-attach.ts +17 -4
- package/src/modules/todo/actions/todo-attachments.ts +12 -4
- package/src/modules/todo/actions/todo-done.ts +13 -4
- package/src/modules/todo/actions/todo-freeze.ts +12 -4
- package/src/modules/todo/actions/todo-get.ts +12 -4
- package/src/modules/todo/actions/todo-list.ts +11 -4
- package/src/modules/todo/actions/todo-remove.ts +12 -4
- package/src/modules/todo/actions/todo-unfreeze.ts +12 -4
- package/src/modules/todo/actions/todo-update.ts +15 -4
- package/src/modules/todo/actions/topic-add.ts +10 -4
- package/src/modules/todo/actions/topic-list.ts +9 -4
- package/src/modules/todo/actions/topic-remove.ts +10 -4
- package/src/runtime/action-decorator.ts +2 -2
- package/src/runtime/codegen.ts +26 -41
- package/src/runtime/registry.ts +2 -2
- package/src/web/frontend/api/client.generated.ts +384 -532
- package/src/web/frontend/page/cloud/api.ts +99 -0
- package/src/web/frontend/page/cloud/index.tsx +13 -32
- package/src/web/frontend/page/dag/api.ts +20 -0
- package/src/web/frontend/page/dag/index.tsx +2 -5
- package/src/web/frontend/page/dir/api.ts +135 -0
- package/src/web/frontend/page/dir/index.tsx +37 -57
- package/src/web/frontend/page/dir/task-actions.ts +39 -59
- package/src/web/frontend/page/dir/task-chain.ts +2 -2
- package/src/web/frontend/page/dir/task-feedback.ts +19 -23
- package/src/web/frontend/page/dir/task-goal.ts +3 -3
- package/src/web/frontend/page/dir/task.tsx +3 -3
- package/src/web/frontend/page/doc/api.ts +82 -0
- package/src/web/frontend/page/doc/index.tsx +29 -32
- package/src/web/frontend/page/group/api.ts +24 -0
- package/src/web/frontend/page/group/index.tsx +7 -16
- package/src/web/frontend/page/overview/api.ts +16 -0
- package/src/web/frontend/page/overview/index.tsx +2 -2
- package/src/web/frontend/page/progress/api.ts +20 -0
- package/src/web/frontend/page/progress/index.tsx +3 -6
- package/src/web/frontend/page/refs/api.ts +14 -0
- package/src/web/frontend/page/refs/index.tsx +2 -4
- package/src/web/frontend/page/repos/api.ts +197 -0
- package/src/web/frontend/page/repos/bind-modals.tsx +4 -7
- package/src/web/frontend/page/repos/board-admin.tsx +6 -6
- package/src/web/frontend/page/repos/doc-search-modal.tsx +4 -4
- package/src/web/frontend/page/repos/index.tsx +10 -14
- package/src/web/frontend/page/repos/pending-section.tsx +7 -13
- package/src/web/frontend/page/repos/ref-panel.tsx +9 -14
- package/src/web/frontend/page/repos/remote-modal.tsx +4 -28
- package/src/web/frontend/page/repos/repo-form-modal.tsx +4 -4
- package/src/web/frontend/page/settings/api.ts +29 -0
- package/src/web/frontend/page/settings/index.tsx +3 -3
- package/src/web/frontend/page/settings/prompt-templates-section.tsx +4 -4
- package/src/web/frontend/page/settings/sidebar-section.tsx +2 -2
- package/src/web/public/assets/Introduction-Du_dycft.js +6 -0
- package/src/web/public/assets/{bar-B9WWmCpt.js → bar-B52NTf_v.js} +1 -1
- package/src/web/public/assets/cloud-Droja_aT.js +3 -0
- package/src/web/public/assets/{composer-panel-ByezS8Xv.js → composer-panel-DpiU2h50.js} +1 -1
- package/src/web/public/assets/dag-Ca-wjIxQ.js +1 -0
- package/src/web/public/assets/{deleted-panel-BcbtctNF.js → deleted-panel-K9GgfR8t.js} +1 -1
- package/src/web/public/assets/dir-DacRpcBt.js +5 -0
- package/src/web/public/assets/group-TPuU-QVc.js +2 -0
- package/src/web/public/assets/{index-D8MvtVAm.js → index-BkLkooKe.js} +2 -2
- package/src/web/public/assets/{md-history-BqZvzWiD.js → md-history-0GBWw4qr.js} +1 -1
- package/src/web/public/assets/overview-B3kHI66i.js +1 -0
- package/src/web/public/assets/progress-CdhFz0Lz.js +3 -0
- package/src/web/public/assets/refs-BDxfuH6R.js +1 -0
- package/src/web/public/assets/repos-C8jRM7wS.js +15 -0
- package/src/web/public/assets/{route-crumb-CWVu80du.js → route-crumb-QvahotvN.js} +1 -1
- package/src/web/public/assets/settings-BBcdGLTc.js +1 -0
- package/src/web/public/assets/{status-tag-DRl9E2Os.js → status-tag-BheHByek.js} +1 -1
- package/src/web/public/assets/task-CUkQaLBZ.js +11 -0
- package/src/web/public/assets/task-utils-_JAWRAz6.js +12 -0
- package/src/web/public/assets/{templates-Df__0k-F.js → templates-CbRyW3PJ.js} +1 -1
- package/src/web/public/assets/{tool-bar-Cv7f6p4v.js → tool-bar-BAmT-BI-.js} +1 -1
- package/src/web/public/index.html +1 -1
- package/src/modules/auth/schemas.ts +0 -27
- package/src/modules/bundled/schemas.ts +0 -32
- package/src/modules/db/schemas.ts +0 -27
- package/src/modules/docs/schemas.ts +0 -107
- package/src/modules/file/schemas.ts +0 -61
- package/src/modules/localtask/schemas.ts +0 -310
- package/src/modules/repos/schemas.ts +0 -310
- package/src/modules/setting/schemas.ts +0 -18
- package/src/modules/system/schemas.ts +0 -30
- package/src/modules/tasktool/schemas.ts +0 -52
- package/src/modules/templates/schemas.ts +0 -50
- package/src/modules/todo/schemas.ts +0 -177
- package/src/web/public/assets/Introduction-aQCeCLrV.js +0 -6
- package/src/web/public/assets/cloud-C4b8SU7C.js +0 -3
- package/src/web/public/assets/dag-jvrjx4i7.js +0 -1
- package/src/web/public/assets/dir-B82XBb1J.js +0 -5
- package/src/web/public/assets/group-BPUOO_QM.js +0 -2
- package/src/web/public/assets/overview-DMihuyzh.js +0 -1
- package/src/web/public/assets/progress-D-rMgz3w.js +0 -3
- package/src/web/public/assets/refs-D21jmrn6.js +0 -1
- package/src/web/public/assets/repos-B94tMDGs.js +0 -15
- package/src/web/public/assets/settings-DgTt4JG5.js +0 -1
- package/src/web/public/assets/task-B2x5GoV3.js +0 -11
- package/src/web/public/assets/task-utils-By8gLpHY.js +0 -12
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
// templates.list —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { templatesListInput } from '../schemas.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
import { renderList } from '../support.js';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** templates.list 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
12
|
+
const input = z.object({
|
|
13
|
+
topic: z.string().optional().describe("按队列 topics.key 过滤(可与 --group/--repo 组合;响应带 scoped:true)"),
|
|
14
|
+
group: z.string().optional().describe("按项目组 repos.key 过滤(#132:组本身是可见主体,与 topic/repo 平级)"),
|
|
15
|
+
repo: z.string().optional().describe("按项目 repos.key 过滤"),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export class TemplatesListAction extends ActionBase<typeof input> {
|
|
12
19
|
@action({
|
|
13
20
|
id: 'templates.list',
|
|
14
21
|
cli: ['template', 'list'],
|
|
15
22
|
http: ['GET', '/api/templates'],
|
|
16
23
|
summary: '列出任务模板(含默认模板 id;新建页的起始正文按默认模板取)',
|
|
17
|
-
input
|
|
24
|
+
input,
|
|
18
25
|
render: renderList,
|
|
19
26
|
})
|
|
20
27
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
// templates.remove —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { templatesRemoveInput } from '../schemas.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
import { } from 'node:path';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** templates.remove 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
12
|
+
const input = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export class TemplatesRemoveAction extends ActionBase<typeof input> {
|
|
12
17
|
@action({
|
|
13
18
|
id: 'templates.remove',
|
|
14
19
|
cli: ['template', 'remove'],
|
|
15
20
|
http: ['DELETE', '/api/templates/:id'],
|
|
16
21
|
summary: '删除任务模板(内置默认模板不可删;删的是默认模板则默认回落到内置)',
|
|
17
22
|
args: ['id'],
|
|
18
|
-
input
|
|
23
|
+
input,
|
|
19
24
|
render: (d: any) => `已删除模板「${d.removed.name}」(${d.removed.id})${d.wasDefault ? ',默认模板回落为内置' : ''}`,
|
|
20
25
|
})
|
|
21
26
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
// templates.update —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
+
import { z } from 'zod';
|
|
5
6
|
import { ActionBase, type ActionInput, type ActionRunMeta } from '../../../runtime/action-base.js';
|
|
6
|
-
import { templatesUpdateInput } from '../schemas.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
import { } from 'node:path';
|
|
9
9
|
import { parseScope, parseValues } from '../support.js';
|
|
10
10
|
const service: any = serviceNs;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** templates.update 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
id: z.string(),
|
|
15
|
+
name: z.string().optional().describe("新名字(不传保持不变)"),
|
|
16
|
+
body: z.string().optional().describe("新正文(Markdown;不传保持不变)"),
|
|
17
|
+
bodyFile: z.string().optional().describe("从文件读新正文(--body 优先);`-` = 读标准输入"),
|
|
18
|
+
'body-file': z.string().optional().describe("同 --bodyFile(连字符写法)"),
|
|
19
|
+
scope: z.unknown().optional().describe("可见域(#128):* / topic:<key> / repo:<key> / group:<key>,JSON 数组或逗号短写(不传保持不变)"),
|
|
20
|
+
values: z.string().optional().describe("槽位值 JSON(形如 {\"背景\":\"要做的事\"})——老模板正文里的 {{槽位名}} 处填这段文字(新模板直接写正文即可)"),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export class TemplatesUpdateAction extends ActionBase<typeof input> {
|
|
13
24
|
@action({
|
|
14
25
|
id: 'templates.update',
|
|
15
26
|
cli: ['template', 'update'],
|
|
16
27
|
http: ['PATCH', '/api/templates/:id'],
|
|
17
28
|
summary: '编辑任务模板(--name 改名 / --body 改正文 / --scope 改可见域,只改传入项;多行正文用 --body-file;内置模板的正文也可改)',
|
|
18
29
|
args: ['id'],
|
|
19
|
-
input
|
|
30
|
+
input,
|
|
20
31
|
render: (d: any) => `已更新模板「${d.template.name}」(${d.template.id})`,
|
|
21
32
|
})
|
|
22
33
|
override async run(ctx: ActionInput<this['_input']>, opts: ActionRunMeta = {}) {
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
// group.add —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { groupAddInput } from '../schemas.js';
|
|
7
7
|
import { requireAuth as _requireAuth } from '../../../core/config.js';
|
|
8
8
|
import { createGroup as _createGroup } from '../../../core/kvapi.js';
|
|
9
9
|
const requireAuth: any = _requireAuth;
|
|
10
10
|
const createGroup: any = _createGroup;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** group.add 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
name: z.string(),
|
|
15
|
+
description: z.string().optional().describe("描述"),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export class GroupAddAction extends ActionBase<typeof input> {
|
|
13
19
|
@action({
|
|
14
20
|
id: 'group.add',
|
|
15
21
|
cli: ['group', 'add'],
|
|
16
22
|
http: ['POST', '/api/groups'],
|
|
17
23
|
summary: '新建工作空间',
|
|
18
24
|
args: ['name'],
|
|
19
|
-
input
|
|
25
|
+
input,
|
|
20
26
|
render: (g: any) => `已新建工作空间: ${g.name}(id=${g.id})\n用 nx-kv group use ${g.id} 切过去`,
|
|
21
27
|
})
|
|
22
28
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
// group.current —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { groupCurrentInput } from '../schemas.js';
|
|
7
7
|
import { loadConfig as _loadConfig } from '../../../core/config.js';
|
|
8
8
|
import { listGroups as _listGroups } from '../../../core/kvapi.js';
|
|
9
9
|
const loadConfig: any = _loadConfig;
|
|
10
10
|
const listGroups: any = _listGroups;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** group.current 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class GroupCurrentAction extends ActionBase<typeof input> {
|
|
13
18
|
@action({
|
|
14
19
|
id: 'group.current',
|
|
15
20
|
cli: ['group', 'current'],
|
|
16
21
|
http: ['GET', '/api/group'],
|
|
17
22
|
summary: '查看当前工作空间',
|
|
18
|
-
input
|
|
23
|
+
input,
|
|
19
24
|
render: (d: any) => `当前工作空间: ${d.name}(${d.id === 0 ? '默认组,不传 groupId' : 'id=' + d.id})`,
|
|
20
25
|
})
|
|
21
26
|
override async run(_ctx: ActionInput<this['_input']>) {
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
// group.get —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { groupGetInput } from '../schemas.js';
|
|
7
7
|
import { loadConfig as _loadConfig, requireAuth as _requireAuth } from '../../../core/config.js';
|
|
8
8
|
import { findGroup } from '../support.js';
|
|
9
9
|
const loadConfig: any = _loadConfig;
|
|
10
10
|
const requireAuth: any = _requireAuth;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** group.get 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
id: z.string(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class GroupGetAction extends ActionBase<typeof input> {
|
|
13
18
|
@action({
|
|
14
19
|
id: 'group.get',
|
|
15
20
|
cli: ['group', 'get'],
|
|
16
21
|
http: ['GET', '/api/groups/:id'],
|
|
17
22
|
summary: '查看单个工作空间',
|
|
18
23
|
args: ['id'],
|
|
19
|
-
input
|
|
24
|
+
input,
|
|
20
25
|
render: (g: any) =>
|
|
21
26
|
[
|
|
22
27
|
`${g.name}${g.current ? ' ← 当前' : ''}`,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// group.list —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { groupListInput } from '../schemas.js';
|
|
7
7
|
import { loadConfig as _loadConfig, requireAuth as _requireAuth } from '../../../core/config.js';
|
|
8
8
|
import { listGroups as _listGroups } from '../../../core/kvapi.js';
|
|
9
9
|
import { renderGroupLine } from '../support.js';
|
|
@@ -11,13 +11,18 @@ const loadConfig: any = _loadConfig;
|
|
|
11
11
|
const requireAuth: any = _requireAuth;
|
|
12
12
|
const listGroups: any = _listGroups;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/** group.list 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
15
|
+
const input = z.object({
|
|
16
|
+
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export class GroupListAction extends ActionBase<typeof input> {
|
|
15
20
|
@action({
|
|
16
21
|
id: 'group.list',
|
|
17
22
|
cli: ['group', 'list'],
|
|
18
23
|
http: ['GET', '/api/groups'],
|
|
19
24
|
summary: '列出我的工作空间(* 为当前)',
|
|
20
|
-
input
|
|
25
|
+
input,
|
|
21
26
|
render: (d: any) => {
|
|
22
27
|
if (!d.groups.length) return '(没有可用工作空间)';
|
|
23
28
|
return d.groups.map((g: any) => renderGroupLine(g, g.current)).join('\n');
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
// group.members —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { groupMembersInput } from '../schemas.js';
|
|
7
7
|
import { requireAuth as _requireAuth } from '../../../core/config.js';
|
|
8
8
|
import { listGroupMembers as _listGroupMembers } from '../../../core/kvapi.js';
|
|
9
9
|
import { findGroup } from '../support.js';
|
|
10
10
|
const requireAuth: any = _requireAuth;
|
|
11
11
|
const listGroupMembers: any = _listGroupMembers;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/** group.members 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
14
|
+
const input = z.object({
|
|
15
|
+
id: z.string(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export class GroupMembersAction extends ActionBase<typeof input> {
|
|
14
19
|
@action({
|
|
15
20
|
id: 'group.members',
|
|
16
21
|
cli: ['group', 'members'],
|
|
17
22
|
http: ['GET', '/api/groups/:id/members'],
|
|
18
23
|
summary: '查看工作空间成员',
|
|
19
24
|
args: ['id'],
|
|
20
|
-
input
|
|
25
|
+
input,
|
|
21
26
|
render: (d: any) => {
|
|
22
27
|
if (!d.members.length) return `${d.group.name}: (没有成员)`;
|
|
23
28
|
const w: any = Math.max(...d.members.map((m: any) => m.email.length));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// group.remove —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { groupRemoveInput } from '../schemas.js';
|
|
7
7
|
import { loadConfig as _loadConfig, requireAuth as _requireAuth } from '../../../core/config.js';
|
|
8
8
|
import { deleteGroup as _deleteGroup } from '../../../core/kvapi.js';
|
|
9
9
|
import { badInput as _badInput } from '../../../core/errors.js';
|
|
@@ -13,14 +13,19 @@ const requireAuth: any = _requireAuth;
|
|
|
13
13
|
const deleteGroup: any = _deleteGroup;
|
|
14
14
|
const badInput: any = _badInput;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
/** group.remove 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
17
|
+
const input = z.object({
|
|
18
|
+
id: z.string(),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export class GroupRemoveAction extends ActionBase<typeof input> {
|
|
17
22
|
@action({
|
|
18
23
|
id: 'group.remove',
|
|
19
24
|
cli: ['group', 'remove'],
|
|
20
25
|
http: ['DELETE', '/api/groups/:id'],
|
|
21
26
|
summary: '解散工作空间(后端要求组内已无 KV)',
|
|
22
27
|
args: ['id'],
|
|
23
|
-
input
|
|
28
|
+
input,
|
|
24
29
|
render: (d: any) => `已解散工作空间: ${d.name}(id=${d.id})`,
|
|
25
30
|
})
|
|
26
31
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
// group.update —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { groupUpdateInput } from '../schemas.js';
|
|
7
7
|
import { requireAuth as _requireAuth } from '../../../core/config.js';
|
|
8
8
|
import { updateGroup as _updateGroup } from '../../../core/kvapi.js';
|
|
9
9
|
import { findGroup } from '../support.js';
|
|
10
10
|
const requireAuth: any = _requireAuth;
|
|
11
11
|
const updateGroup: any = _updateGroup;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/** group.update 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
14
|
+
const input = z.object({
|
|
15
|
+
id: z.string(),
|
|
16
|
+
name: z.string().optional().describe("新名称"),
|
|
17
|
+
description: z.string().optional().describe("新描述"),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export class GroupUpdateAction extends ActionBase<typeof input> {
|
|
14
21
|
@action({
|
|
15
22
|
id: 'group.update',
|
|
16
23
|
cli: ['group', 'update'],
|
|
17
24
|
http: ['PATCH', '/api/groups/:id'],
|
|
18
25
|
summary: '改名 / 改描述(只改传入的字段)',
|
|
19
26
|
args: ['id'],
|
|
20
|
-
input
|
|
27
|
+
input,
|
|
21
28
|
render: (g: any) => `已更新工作空间: ${g.name}(id=${g.id})`,
|
|
22
29
|
})
|
|
23
30
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
// group.use —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { groupUseInput } from '../schemas.js';
|
|
7
7
|
import { updateConfig as _updateConfig, requireAuth as _requireAuth } from '../../../core/config.js';
|
|
8
8
|
import { findGroup } from '../support.js';
|
|
9
9
|
const updateConfig: any = _updateConfig;
|
|
10
10
|
const requireAuth: any = _requireAuth;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** group.use 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
locator: z.string(),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class GroupUseAction extends ActionBase<typeof input> {
|
|
13
18
|
@action({
|
|
14
19
|
id: 'group.use',
|
|
15
20
|
cli: [['group', 'use'], ['group', 'switch']],
|
|
16
21
|
http: ['POST', '/api/group'],
|
|
17
22
|
summary: '切换当前工作空间(id 或名称;0 / default 回默认组)',
|
|
18
23
|
args: ['locator'],
|
|
19
|
-
input
|
|
24
|
+
input,
|
|
20
25
|
render: (d: any) =>
|
|
21
26
|
d.id === 0
|
|
22
27
|
? '已切回默认组(后续读写不传 groupId)'
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
// prompt.get —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { promptGetInput } from '../schemas.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** prompt.get 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
topic: z.string(),
|
|
13
|
+
group: z.number().optional().describe("工作空间 id(默认取当前)"),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export class PromptGetAction extends ActionBase<typeof input> {
|
|
11
17
|
@action({
|
|
12
18
|
id: 'prompt.get',
|
|
13
19
|
cli: ['prompt', 'get'],
|
|
14
20
|
http: ['GET', '/api/prompts/:topic'],
|
|
15
21
|
summary: '读取某主题的上下文提示词',
|
|
16
22
|
args: ['topic'],
|
|
17
|
-
input
|
|
23
|
+
input,
|
|
18
24
|
render: (d: any) => (d.hasPrompt ? d.prompt : `(${d.topic} 没有配置提示词)`),
|
|
19
25
|
})
|
|
20
26
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
// prompt.remove —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { promptRemoveInput } from '../schemas.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** prompt.remove 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
topic: z.string(),
|
|
13
|
+
group: z.number().optional().describe("工作空间 id(默认取当前)"),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export class PromptRemoveAction extends ActionBase<typeof input> {
|
|
11
17
|
@action({
|
|
12
18
|
id: 'prompt.remove',
|
|
13
19
|
cli: ['prompt', 'remove'],
|
|
14
20
|
http: ['DELETE', '/api/prompts/:topic'],
|
|
15
21
|
summary: '删除某主题的提示词',
|
|
16
22
|
args: ['topic'],
|
|
17
|
-
input
|
|
23
|
+
input,
|
|
18
24
|
render: (d: any) => (d.removed ? `已删除 ${d.topic} 的提示词` : `${d.topic} 本就没有提示词`),
|
|
19
25
|
})
|
|
20
26
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
// prompt.set —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { promptSetInput } from '../schemas.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** prompt.set 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
topic: z.string(),
|
|
13
|
+
text: z.string(),
|
|
14
|
+
group: z.number().optional().describe("工作空间 id(默认取当前)"),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class PromptSetAction extends ActionBase<typeof input> {
|
|
11
18
|
@action({
|
|
12
19
|
id: 'prompt.set',
|
|
13
20
|
cli: ['prompt', 'set'],
|
|
14
21
|
http: ['POST', '/api/prompts/:topic'],
|
|
15
22
|
summary: '写入某主题的上下文提示词(覆盖)',
|
|
16
23
|
args: ['topic', 'text'],
|
|
17
|
-
input
|
|
24
|
+
input,
|
|
18
25
|
render: (d: any) => `已写入 ${d.topic} 的提示词(${d.bytes} 字节)`,
|
|
19
26
|
})
|
|
20
27
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
// todo.add —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { todoAddInput } from '../schemas.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** todo.add 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
text: z.string(),
|
|
13
|
+
topic: z.string().describe("主题,路由维度"),
|
|
14
|
+
group: z.number().optional().describe("工作空间 id(默认取当前)"),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class TodoAddAction extends ActionBase<typeof input> {
|
|
11
18
|
@action({
|
|
12
19
|
id: 'todo.add',
|
|
13
20
|
cli: ['todo', 'add'],
|
|
14
21
|
http: ['POST', '/api/todo'],
|
|
15
22
|
summary: '新增任务到待办(topic 不在快捷列表时自动补上)',
|
|
16
23
|
args: ['text'],
|
|
17
|
-
input
|
|
24
|
+
input,
|
|
18
25
|
render: (d: any) =>
|
|
19
26
|
`已加入待办: [${d.task.topic}] ${d.task.text}` +
|
|
20
27
|
(d.topicAdded ? `\n(已把 ${d.task.topic} 加入快捷 topic)` : ''),
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
// todo.archive —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { todoArchiveInput } from '../schemas.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** todo.archive 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
before: z.string().optional().describe("截止日期,如 2026-08-01"),
|
|
13
|
+
group: z.number().optional().describe("工作空间 id(默认取当前)"),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export class TodoArchiveAction extends ActionBase<typeof input> {
|
|
11
17
|
@action({
|
|
12
18
|
id: 'todo.archive',
|
|
13
19
|
cli: ['todo', 'archive'],
|
|
14
20
|
http: ['POST', '/api/todo/archive'],
|
|
15
21
|
summary: '把已完成里较旧的条目归档到冷 key(默认 30 天前)',
|
|
16
|
-
input
|
|
22
|
+
input,
|
|
17
23
|
render: (d: any) =>
|
|
18
24
|
d.moved
|
|
19
25
|
? `已归档 ${d.moved} 条 -> ${d.coldKey}(已完成剩 ${d.remaining} 条,冷 key 共 ${d.total} 条)`
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
// todo.attach —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { todoAttachInput } from '../schemas.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** todo.attach 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
ref: z.string().describe("要挂附件的那条任务的内容(整串)"),
|
|
13
|
+
path: z.string().optional().describe("本机文件路径(先上传再嵌入)"),
|
|
14
|
+
fileId: z.string().optional().describe("已上传附件的 id(32 位 hex,可带扩展名)"),
|
|
15
|
+
name: z.string().optional().describe("嵌入文字与本地文件名(默认取原文件名)"),
|
|
16
|
+
kind: z.enum(["image", "file"]).optional().describe("用图片语法还是链接语法(默认按扩展名判断)"),
|
|
17
|
+
accessLevel: z.enum(["public", "private", "protected"]).default('public'),
|
|
18
|
+
topic: z.string().optional().describe("消歧:同内容有多条时用主题收窄"),
|
|
19
|
+
pick: z.number().optional().describe("消歧:同内容多条时按编号选(配合报错里的列表)"),
|
|
20
|
+
group: z.number().optional().describe("工作空间 id(默认取当前)"),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export class TodoAttachAction extends ActionBase<typeof input> {
|
|
11
24
|
@action({
|
|
12
25
|
id: 'todo.attach',
|
|
13
26
|
cli: ['todo', 'attach'],
|
|
14
27
|
http: ['POST', '/api/todo/attach'],
|
|
15
28
|
summary: '给任务追加附件:--path 上传本机文件,或 --fileId 追加已上传附件,以 markdown 嵌入正文末尾',
|
|
16
|
-
input
|
|
29
|
+
input,
|
|
17
30
|
render: (d: any) => `已给 [${d.task.topic}] 追加附件(${d.kind === 'image' ? '图片' : '附件'})\n ${d.markdown}\n 正文: ${d.task.text}`,
|
|
18
31
|
})
|
|
19
32
|
override async run(ctx: ActionInput<this['_input']>) {
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
// todo.attachments —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
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 { todoAttachmentsInput } from '../schemas.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
import { renderTaskAttachments } from '../support.js';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** todo.attachments 的入参契约(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 TodoAttachmentsAction extends ActionBase<typeof input> {
|
|
12
20
|
@action({
|
|
13
21
|
id: 'todo.attachments',
|
|
14
22
|
cli: ['todo', 'attachments'],
|
|
15
23
|
http: ['GET', '/api/todo/attachments'],
|
|
16
24
|
summary: '列出某条任务引用的附件,以及本地是否已有(给 agent 直接读本地文件)',
|
|
17
|
-
input
|
|
25
|
+
input,
|
|
18
26
|
render: renderTaskAttachments,
|
|
19
27
|
})
|
|
20
28
|
override async run(ctx: ActionInput<this['_input']>) {
|