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.
- package/CHANGELOG.md +43 -0
- package/package.json +1 -1
- package/src/modules/auth/actions/auth-login.ts +13 -6
- package/src/modules/auth/actions/auth-logout.ts +11 -6
- package/src/modules/auth/actions/auth-me.ts +11 -6
- package/src/modules/auth/actions/auth-status.ts +11 -6
- package/src/modules/bundled/actions/bundled-get.ts +14 -6
- package/src/modules/bundled/actions/bundled-groups.ts +11 -6
- package/src/modules/bundled/actions/bundled-install.ts +15 -6
- package/src/modules/bundled/actions/bundled-list.ts +11 -6
- package/src/modules/db/actions/db-backup.ts +12 -6
- package/src/modules/db/actions/db-migrate.ts +12 -6
- package/src/modules/db/actions/db-status.ts +11 -6
- package/src/modules/db/actions/db-verify.ts +11 -6
- package/src/modules/docs/actions/doc-add.ts +14 -6
- package/src/modules/docs/actions/doc-attach-note.ts +13 -6
- package/src/modules/docs/actions/doc-attach.ts +20 -6
- package/src/modules/docs/actions/doc-attachments.ts +11 -6
- package/src/modules/docs/actions/doc-detach.ts +13 -6
- package/src/modules/docs/actions/doc-get.ts +11 -6
- package/src/modules/docs/actions/doc-list.ts +11 -6
- package/src/modules/docs/actions/doc-remove.ts +11 -6
- package/src/modules/docs/actions/doc-update.ts +14 -6
- package/src/modules/docs/actions/docs-bind.ts +15 -6
- package/src/modules/docs/actions/docs-index.ts +11 -6
- package/src/modules/docs/actions/docs-link.ts +16 -6
- package/src/modules/docs/actions/docs-notebind.ts +15 -6
- package/src/modules/docs/actions/docs-seed.ts +11 -6
- package/src/modules/file/actions/file-content.ts +18 -10
- package/src/modules/file/actions/file-get.ts +12 -6
- package/src/modules/file/actions/file-list.ts +13 -6
- package/src/modules/file/actions/file-orphans.ts +11 -6
- package/src/modules/file/actions/file-prune.ts +12 -6
- package/src/modules/file/actions/file-remove.ts +12 -6
- package/src/modules/file/actions/file-sync.ts +15 -6
- package/src/modules/file/actions/file-upload.ts +17 -6
- package/src/modules/localtask/actions/localtask-add.ts +26 -6
- package/src/modules/localtask/actions/localtask-attach-note.ts +15 -6
- package/src/modules/localtask/actions/localtask-attach.ts +24 -6
- package/src/modules/localtask/actions/localtask-attachments.ts +13 -6
- package/src/modules/localtask/actions/localtask-cancel.ts +12 -6
- package/src/modules/localtask/actions/localtask-cancelMany.ts +13 -6
- package/src/modules/localtask/actions/localtask-chain.ts +13 -6
- package/src/modules/localtask/actions/localtask-claim.ts +14 -6
- package/src/modules/localtask/actions/localtask-clone.ts +13 -6
- package/src/modules/localtask/actions/localtask-closeMany.ts +15 -6
- package/src/modules/localtask/actions/localtask-config.ts +23 -8
- package/src/modules/localtask/actions/localtask-detach.ts +15 -6
- package/src/modules/localtask/actions/localtask-done.ts +14 -6
- package/src/modules/localtask/actions/localtask-events.ts +19 -9
- package/src/modules/localtask/actions/localtask-fork.ts +13 -6
- package/src/modules/localtask/actions/localtask-get.ts +13 -6
- package/src/modules/localtask/actions/localtask-importRemote.ts +20 -9
- package/src/modules/localtask/actions/localtask-list.ts +11 -6
- package/src/modules/localtask/actions/localtask-presence.ts +11 -6
- package/src/modules/localtask/actions/localtask-preview.ts +15 -6
- package/src/modules/localtask/actions/localtask-prune.ts +12 -6
- package/src/modules/localtask/actions/localtask-remove.ts +14 -6
- package/src/modules/localtask/actions/localtask-removeMany.ts +14 -6
- package/src/modules/localtask/actions/localtask-reopen.ts +22 -7
- package/src/modules/localtask/actions/localtask-reorder.ts +17 -6
- package/src/modules/localtask/actions/localtask-task-restore.ts +13 -6
- package/src/modules/localtask/actions/localtask-timegoalLog.ts +13 -6
- package/src/modules/localtask/actions/localtask-topic-add.ts +12 -6
- package/src/modules/localtask/actions/localtask-topic-remove.ts +13 -6
- package/src/modules/localtask/actions/localtask-topic-removeMany.ts +14 -6
- package/src/modules/localtask/actions/localtask-update.ts +24 -6
- package/src/modules/localtask/actions/localtask-wait.ts +15 -6
- package/src/modules/localtask/actions/task-move.ts +23 -6
- package/src/modules/repos/actions/board-add.ts +12 -6
- package/src/modules/repos/actions/board-assign.ts +14 -6
- package/src/modules/repos/actions/board-export.ts +11 -6
- package/src/modules/repos/actions/board-get.ts +11 -6
- package/src/modules/repos/actions/board-import.ts +17 -7
- package/src/modules/repos/actions/board-list.ts +11 -6
- package/src/modules/repos/actions/board-note.ts +13 -6
- package/src/modules/repos/actions/board-prefix.ts +12 -6
- package/src/modules/repos/actions/board-prune.ts +13 -6
- package/src/modules/repos/actions/board-rekey.ts +13 -6
- package/src/modules/repos/actions/board-remove.ts +11 -6
- package/src/modules/repos/actions/board-update.ts +13 -6
- package/src/modules/repos/actions/repo-add.ts +19 -6
- package/src/modules/repos/actions/repo-bind-topics.ts +12 -6
- package/src/modules/repos/actions/repo-bind.ts +14 -6
- package/src/modules/repos/actions/repo-clone.ts +16 -6
- package/src/modules/repos/actions/repo-detect.ts +11 -6
- package/src/modules/repos/actions/repo-doc-add.ts +17 -6
- package/src/modules/repos/actions/repo-doc-list.ts +11 -6
- package/src/modules/repos/actions/repo-doc-remove.ts +12 -6
- package/src/modules/repos/actions/repo-export.ts +14 -6
- package/src/modules/repos/actions/repo-get.ts +11 -6
- package/src/modules/repos/actions/repo-import-diff.ts +12 -6
- package/src/modules/repos/actions/repo-import.ts +16 -6
- package/src/modules/repos/actions/repo-key-migrate.ts +11 -6
- package/src/modules/repos/actions/repo-key-refresh.ts +13 -6
- package/src/modules/repos/actions/repo-key-set.ts +13 -6
- package/src/modules/repos/actions/repo-knowledge.ts +12 -6
- package/src/modules/repos/actions/repo-list.ts +11 -6
- package/src/modules/repos/actions/repo-open.ts +11 -6
- package/src/modules/repos/actions/repo-ref-add.ts +15 -6
- package/src/modules/repos/actions/repo-ref-backfill.ts +12 -6
- package/src/modules/repos/actions/repo-ref-check.ts +11 -6
- package/src/modules/repos/actions/repo-ref-clone.ts +18 -6
- package/src/modules/repos/actions/repo-ref-note.ts +14 -6
- package/src/modules/repos/actions/repo-ref-of.ts +11 -6
- package/src/modules/repos/actions/repo-ref-sync.ts +12 -6
- package/src/modules/repos/actions/repo-remote-check.ts +12 -6
- package/src/modules/repos/actions/repo-remote-list.ts +11 -6
- package/src/modules/repos/actions/repo-remote-pick.ts +12 -6
- package/src/modules/repos/actions/repo-remote.ts +13 -6
- package/src/modules/repos/actions/repo-remove.ts +11 -6
- package/src/modules/repos/actions/repo-scan.ts +13 -6
- package/src/modules/repos/actions/repo-update.ts +23 -6
- package/src/modules/setting/actions/setting-get.ts +11 -6
- package/src/modules/setting/actions/setting-set.ts +14 -6
- package/src/modules/system/actions/bootstrap.ts +9 -7
- package/src/modules/system/actions/health.ts +8 -6
- package/src/modules/system/actions/routes.ts +13 -6
- package/src/modules/system/routes.ts +1 -1
- package/src/modules/tasktool/actions/timegoal-check.ts +13 -6
- package/src/modules/tasktool/actions/timegoal-clear.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-list.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-log.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-prune.ts +11 -6
- package/src/modules/tasktool/actions/timegoal-set.ts +13 -6
- package/src/modules/tasktool/actions/timegoal-show.ts +12 -6
- package/src/modules/tasktool/actions/timegoal-update.ts +13 -6
- package/src/modules/templates/actions/templates-add.ts +19 -6
- package/src/modules/templates/actions/templates-default.ts +15 -6
- package/src/modules/templates/actions/templates-list.ts +13 -6
- package/src/modules/templates/actions/templates-remove.ts +11 -6
- package/src/modules/templates/actions/templates-update.ts +17 -6
- package/src/modules/todo/actions/group-add.ts +12 -6
- package/src/modules/todo/actions/group-current.ts +11 -6
- package/src/modules/todo/actions/group-get.ts +11 -6
- package/src/modules/todo/actions/group-list.ts +11 -6
- package/src/modules/todo/actions/group-members.ts +11 -6
- package/src/modules/todo/actions/group-remove.ts +11 -6
- package/src/modules/todo/actions/group-update.ts +13 -6
- package/src/modules/todo/actions/group-use.ts +11 -6
- package/src/modules/todo/actions/prompt-get.ts +12 -6
- package/src/modules/todo/actions/prompt-remove.ts +12 -6
- package/src/modules/todo/actions/prompt-set.ts +13 -6
- package/src/modules/todo/actions/todo-add.ts +13 -6
- package/src/modules/todo/actions/todo-archive.ts +12 -6
- package/src/modules/todo/actions/todo-attach.ts +19 -6
- package/src/modules/todo/actions/todo-attachments.ts +14 -6
- package/src/modules/todo/actions/todo-done.ts +15 -6
- package/src/modules/todo/actions/todo-freeze.ts +14 -6
- package/src/modules/todo/actions/todo-get.ts +14 -6
- package/src/modules/todo/actions/todo-list.ts +13 -6
- package/src/modules/todo/actions/todo-remove.ts +14 -6
- package/src/modules/todo/actions/todo-unfreeze.ts +14 -6
- package/src/modules/todo/actions/todo-update.ts +17 -6
- package/src/modules/todo/actions/topic-add.ts +12 -6
- package/src/modules/todo/actions/topic-list.ts +11 -6
- package/src/modules/todo/actions/topic-remove.ts +12 -6
- package/src/runtime/action-base.ts +41 -1
- package/src/runtime/action-decorator.ts +28 -13
- package/src/runtime/codegen.ts +26 -41
- package/src/runtime/registry.ts +2 -2
- package/src/web/frontend/api/client.generated.ts +550 -698
- 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 -29
- 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,25 @@
|
|
|
1
1
|
// timegoal.log —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 { fmtDur } from '../support.js';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** timegoal.log 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
12
|
+
const input = z.object({
|
|
13
|
+
cwd: z.string().describe("工作目录(与 timegoal 一对一)"),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export class TimegoalLogAction extends ActionBase<typeof input> {
|
|
12
17
|
@action({
|
|
13
18
|
id: 'timegoal.log',
|
|
14
19
|
cli: ['timegoal', 'log'],
|
|
15
20
|
http: ['GET', '/api/timegoals/log'],
|
|
16
21
|
summary: '查看本目录 timegoal 的检查日志(每轮 check 的现状)',
|
|
17
|
-
input
|
|
22
|
+
input,
|
|
18
23
|
render: (d: any) => {
|
|
19
24
|
if (!d.hasGoal) return `[timegoal] 主题「${d.name}」暂无目标,也没有日志。`;
|
|
20
25
|
if (!d.count) return `[timegoal] 主题「${d.name}」暂无检查日志。`;
|
|
@@ -29,7 +34,7 @@ export class TimegoalLogAction extends ActionBase {
|
|
|
29
34
|
return lines.join('\n');
|
|
30
35
|
},
|
|
31
36
|
})
|
|
32
|
-
async
|
|
37
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
33
38
|
|
|
34
39
|
return service.getTimegoalLog({ cwd: ctx.cwd });
|
|
35
40
|
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
// timegoal.prune —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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
|
const service: any = serviceNs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** timegoal.prune 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
11
|
+
const input = z.object({
|
|
12
|
+
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export class TimegoalPruneAction extends ActionBase<typeof input> {
|
|
11
16
|
@action({
|
|
12
17
|
id: 'timegoal.prune',
|
|
13
18
|
cli: ['timegoal', 'prune'],
|
|
14
19
|
http: ['POST', '/api/timegoals/prune'],
|
|
15
20
|
summary: '彻底清除已到点 / 已归档的时间目标(到点本身已自动归档,这里是连归档区一起清)',
|
|
16
|
-
input
|
|
21
|
+
input,
|
|
17
22
|
render: (d: any) =>
|
|
18
23
|
d.count
|
|
19
24
|
? `已彻底清除 ${d.count} 个到点/已归档的时间目标:\n` +
|
|
20
25
|
d.removed.map((g: any) => ` - ${g.name} ${g.cwd} 截止 ${g.deadline}`).join('\n')
|
|
21
26
|
: '没有到点或已归档的时间目标(还在跑的不动手)。',
|
|
22
27
|
})
|
|
23
|
-
async
|
|
28
|
+
override async run(_ctx: ActionInput<this['_input']>) {
|
|
24
29
|
|
|
25
30
|
return service.pruneExpired();
|
|
26
31
|
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
// timegoal.set —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 { renderSet } from '../support.js';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** timegoal.set 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
12
|
+
const input = z.object({
|
|
13
|
+
cwd: z.string().describe("工作目录(与 timegoal 一对一)"),
|
|
14
|
+
duration: z.string().describe("持续时长(10800 秒 / 5h / 90m / 2d / 5小时)"),
|
|
15
|
+
prompt: z.string().describe("完整全局提示词(≤20000 字,每轮 check 会原文回显)"),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export class TimegoalSetAction extends ActionBase<typeof input> {
|
|
12
19
|
@action({
|
|
13
20
|
id: 'timegoal.set',
|
|
14
21
|
cli: ['timegoal', 'set'],
|
|
15
22
|
http: ['POST', '/api/timegoals'],
|
|
16
23
|
summary: '为本目录设置/替换 timegoal:duration + 完整全局提示词(原文固化到 store)',
|
|
17
|
-
input
|
|
24
|
+
input,
|
|
18
25
|
render: renderSet,
|
|
19
26
|
})
|
|
20
|
-
async
|
|
27
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
21
28
|
|
|
22
29
|
return service.setTimegoal({ cwd: ctx.cwd, durationSec: ctx.duration, prompt: ctx.prompt });
|
|
23
30
|
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
// timegoal.show —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 { renderShow } from '../support.js';
|
|
10
10
|
const service: any = serviceNs;
|
|
11
11
|
const badInput: any = _badInput;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/** timegoal.show 的入参契约(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
|
+
});
|
|
18
|
+
|
|
19
|
+
export class TimegoalShowAction extends ActionBase<typeof input> {
|
|
14
20
|
@action({
|
|
15
21
|
id: 'timegoal.show',
|
|
16
22
|
cli: ['timegoal', 'show'],
|
|
17
23
|
http: ['GET', '/api/timegoals'],
|
|
18
24
|
summary: '查看当前 timegoal(不算时间):--cwd 目录级,--task 任务级(key 在领取交付里自带)',
|
|
19
|
-
input
|
|
25
|
+
input,
|
|
20
26
|
render: renderShow,
|
|
21
27
|
})
|
|
22
|
-
async
|
|
28
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
23
29
|
|
|
24
30
|
if (!ctx.cwd && !ctx.task) throw badInput('请给 --cwd <工作目录> 或 --task <任务goal key>');
|
|
25
31
|
return ctx.task ? service.showGoalByKey(ctx.task) : service.showTimegoal({ cwd: ctx.cwd });
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
// timegoal.update —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 { renderUpdate } from '../support.js';
|
|
9
9
|
const service: any = serviceNs;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/** timegoal.update 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
12
|
+
const input = z.object({
|
|
13
|
+
cwd: z.string().describe("工作目录(与 timegoal 一对一)"),
|
|
14
|
+
prompt: z.string().describe("新版提示词(≤20000 字)"),
|
|
15
|
+
duration: z.string().optional().describe("同时改时长(10800 / 5h / 90m / 2d);省略则时长不变"),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export class TimegoalUpdateAction extends ActionBase<typeof input> {
|
|
12
19
|
@action({
|
|
13
20
|
id: 'timegoal.update',
|
|
14
21
|
cli: ['timegoal', 'update'],
|
|
15
22
|
http: ['PATCH', '/api/timegoals'],
|
|
16
23
|
summary: '更新本目录 timegoal 的提示词(可选同时改时长,--duration;保留起点,不重置计时)',
|
|
17
|
-
input
|
|
24
|
+
input,
|
|
18
25
|
render: renderUpdate,
|
|
19
26
|
})
|
|
20
|
-
async
|
|
27
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
21
28
|
|
|
22
29
|
return service.updateTimegoal({ cwd: ctx.cwd, prompt: ctx.prompt, durationSec: ctx.duration });
|
|
23
30
|
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
// templates.add —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput, type ActionRunMeta } from '../../../runtime/action-base.js';
|
|
7
7
|
import * as serviceNs from '../service.js';
|
|
8
8
|
import { } from 'node:path';
|
|
9
9
|
import { parseScope, topicFromCwd } from '../support.js';
|
|
10
10
|
const service: any = serviceNs;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** templates.add 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
name: z.string(),
|
|
15
|
+
body: z.string().optional().describe("模板正文(Markdown;首行写 `# 标题` 则提交时作为任务标题)"),
|
|
16
|
+
bodyFile: z.string().optional().describe("从文件读模板正文(--body 优先);`-` = 读标准输入"),
|
|
17
|
+
'body-file': z.string().optional().describe("同 --bodyFile(连字符写法)"),
|
|
18
|
+
setDefault: z.boolean().optional().describe("新增后立即设为默认模板"),
|
|
19
|
+
'set-default': z.boolean().optional().describe("同 --setDefault(连字符写法)"),
|
|
20
|
+
scope: z.unknown().optional().describe("可见域(#128/#131):* 全局 / topic:<key> 队列 / repo:<key> 项目 / group:<key> 组——JSON 数组或逗号短写;缺省空(未配置,不默认全局);带 --topic 时默认仅该主题"),
|
|
21
|
+
topic: z.string().optional().describe("创建主题锚(topics.key):默认仅该主题可见,origin_topic 记它"),
|
|
22
|
+
cwd: z.string().optional().describe("同 --topic,但给工作目录(按目录派生主题 key)"),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export class TemplatesAddAction extends ActionBase<typeof input> {
|
|
13
26
|
@action({
|
|
14
27
|
id: 'templates.add',
|
|
15
28
|
cli: ['template', 'add'],
|
|
16
29
|
http: ['POST', '/api/templates'],
|
|
17
30
|
summary: '新增任务模板(--body 给 Markdown 正文;多行正文用 --body-file <文件> 或 --body - 读管道;--setDefault 同时设为默认;--scope 设可见域、--topic 记创建主题并默认仅该主题可见)',
|
|
18
31
|
args: ['name'],
|
|
19
|
-
input
|
|
32
|
+
input,
|
|
20
33
|
render: (d: any) =>
|
|
21
34
|
`已新增模板「${d.template.name}」(${d.template.id})${d.defaultId === d.template.id ? ',并设为默认' : ''}${
|
|
22
35
|
Array.isArray(d.template.scope) && !d.template.scope.includes('*')
|
|
@@ -24,7 +37,7 @@ export class TemplatesAddAction extends ActionBase {
|
|
|
24
37
|
: ''
|
|
25
38
|
}`,
|
|
26
39
|
})
|
|
27
|
-
async
|
|
40
|
+
override async run(ctx: ActionInput<this['_input']>, opts: ActionRunMeta = {}) {
|
|
28
41
|
|
|
29
42
|
return service.addTemplate({
|
|
30
43
|
name: ctx.name,
|
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
// templates.default —— 由 .tool/migrate-module.mjs 从 legacy 形态迁来(模板形态:一条 action 一个文件)。
|
|
2
2
|
//
|
|
3
|
-
//
|
|
3
|
+
// 契约(zod schema)就声明在本文件里——入参类型由基类泛型模板封装;本文件只做「声明 + 实现」,业务在服务层。
|
|
4
4
|
import { action } from '../../../runtime/action-decorator.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 { } from 'node:path';
|
|
9
9
|
import { parseValues, parseScope } from '../support.js';
|
|
10
10
|
const service: any = serviceNs;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** templates.default 的入参契约(CLI 与 HTTP 共用同一份)。 */
|
|
13
|
+
const input = z.object({
|
|
14
|
+
id: z.string(),
|
|
15
|
+
name: z.string().optional().describe("新名字(配合 --body/--scope 时改默认模板本身)"),
|
|
16
|
+
body: z.string().optional().describe("新正文(配合时改默认模板本身)"),
|
|
17
|
+
values: z.unknown().optional().describe("槽位值 JSON(CLI 传 JSON 串;HTTP 可直接给对象)"),
|
|
18
|
+
scope: z.unknown().optional().describe("可见域(#128):* / topic:<key> / repo:<key> / group:<key>,JSON 数组或逗号短写"),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export class TemplatesDefaultAction extends ActionBase<typeof input> {
|
|
13
22
|
@action({
|
|
14
23
|
id: 'templates.default',
|
|
15
24
|
cli: ['template', 'default'],
|
|
16
25
|
http: ['PATCH', '/api/templates/default'],
|
|
17
26
|
summary: '设置默认模板(新建页的起始正文换成它);带 --body/--name/--scope 则改默认模板本身',
|
|
18
27
|
args: ['id'],
|
|
19
|
-
input
|
|
28
|
+
input,
|
|
20
29
|
render: (d: any) => `默认模板已设为「${d.template.name}」(${d.template.id})`,
|
|
21
30
|
})
|
|
22
|
-
async
|
|
31
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
23
32
|
|
|
24
33
|
if (
|
|
25
34
|
ctx.body !== undefined || ctx.name !== undefined ||
|
|
@@ -1,23 +1,30 @@
|
|
|
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 {
|
|
6
|
-
import {
|
|
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 { 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
|
-
async
|
|
27
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
21
28
|
|
|
22
29
|
return ctx.topic || ctx.group || ctx.repo
|
|
23
30
|
? service.listTemplatesForTopic({ topic: ctx.topic, group: ctx.group, repo: ctx.repo })
|
|
@@ -1,24 +1,29 @@
|
|
|
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 {
|
|
6
|
-
import {
|
|
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 { } 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
|
-
async
|
|
26
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
22
27
|
|
|
23
28
|
return service.removeTemplate({ id: ctx.id });
|
|
24
29
|
|
|
@@ -1,25 +1,36 @@
|
|
|
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 {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput, type ActionRunMeta } from '../../../runtime/action-base.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
|
-
async
|
|
33
|
+
override async run(ctx: ActionInput<this['_input']>, opts: ActionRunMeta = {}) {
|
|
23
34
|
|
|
24
35
|
return service.updateTemplate({
|
|
25
36
|
id: ctx.id,
|
|
@@ -1,25 +1,31 @@
|
|
|
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 {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.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
|
-
async
|
|
28
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
23
29
|
|
|
24
30
|
await requireAuth();
|
|
25
31
|
return createGroup({ name: ctx.name, description: ctx.description });
|
|
@@ -1,24 +1,29 @@
|
|
|
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 {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.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
|
-
async
|
|
26
|
+
override async run(_ctx: ActionInput<this['_input']>) {
|
|
22
27
|
|
|
23
28
|
const cfg: any = await loadConfig();
|
|
24
29
|
if (!cfg.groupId) return { id: 0, name: '默认组' };
|
|
@@ -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 {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.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 ? ' ← 当前' : ''}`,
|
|
@@ -27,7 +32,7 @@ export class GroupGetAction extends ActionBase {
|
|
|
27
32
|
` 创建: ${String(g.createdAt || '').slice(0, 10) || '-'}`,
|
|
28
33
|
].join('\n'),
|
|
29
34
|
})
|
|
30
|
-
async
|
|
35
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
31
36
|
|
|
32
37
|
await requireAuth();
|
|
33
38
|
const g: any = await findGroup(ctx.id);
|
|
@@ -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 {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.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,19 +11,24 @@ 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');
|
|
24
29
|
},
|
|
25
30
|
})
|
|
26
|
-
async
|
|
31
|
+
override async run(_ctx: ActionInput<this['_input']>) {
|
|
27
32
|
|
|
28
33
|
await requireAuth();
|
|
29
34
|
const [groups, cfg] = await Promise.all([listGroups(), loadConfig()]);
|
|
@@ -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 {
|
|
6
|
-
import {
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionBase, type ActionInput } from '../../../runtime/action-base.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));
|
|
@@ -26,7 +31,7 @@ export class GroupMembersAction extends ActionBase {
|
|
|
26
31
|
.join('\n');
|
|
27
32
|
},
|
|
28
33
|
})
|
|
29
|
-
async
|
|
34
|
+
override async run(ctx: ActionInput<this['_input']>) {
|
|
30
35
|
|
|
31
36
|
await requireAuth();
|
|
32
37
|
const g: any = await findGroup(ctx.id);
|