nx-kv 0.56.1 → 0.57.0
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 +59 -0
- package/assets/nx-kv/references/A03-/346/226/207/346/241/243/344/270/216/345/275/222/345/261/236.md +4 -3
- package/assets/nx-kv/references/A04-/344/273/223/345/272/223/344/270/216/351/241/271/347/233/256/347/273/204.md +7 -2
- package/assets/nx-kv/references/B02-CLI/351/200/237/346/237/245.md +2 -2
- package/package.json +1 -1
- package/src/modules/docs/link-note.ts +171 -0
- package/src/modules/localtask/actions/_manifest.generated.ts +3 -0
- package/src/modules/localtask/actions/localtask-boardtasks.ts +156 -0
- package/src/modules/localtask/actions/localtask-tasks.ts +12 -2
- package/src/modules/repos/actions/repo-ref-note.ts +9 -5
- package/src/modules/repos/link-note.ts +111 -0
- package/src/modules/repos/ref.ts +40 -71
- package/src/web/frontend/api/cli-tree.json +17 -2
- package/src/web/frontend/api/client.generated.ts +15 -2
- package/src/web/frontend/page/repos/api.ts +0 -5
- package/src/web/frontend/page/repos/bind-modals.tsx +6 -55
- package/src/web/frontend/page/repos/board-refs.tsx +8 -18
- package/src/web/frontend/page/repos/index.tsx +2 -20
- package/src/web/frontend/page/repos/ref-panel.tsx +4 -8
- package/src/web/frontend/refs/api.ts +0 -5
- package/src/web/frontend/styles/modals.css +0 -30
- package/src/web/public/assets/{composer-panel-CzUeT8Wm.js → composer-panel-qX7uVyLW.js} +1 -1
- package/src/web/public/assets/{dir-T3tJ6mj6.js → dir-B360Miyq.js} +1 -1
- package/src/web/public/assets/{group-D5sEX31u.js → group-CCcRCEjR.js} +1 -1
- package/src/web/public/assets/{index-ChaDvo2D.js → index-BLrw-ZQc.js} +2 -2
- package/src/web/public/assets/index-BPxgsnXM.css +1 -0
- package/src/web/public/assets/repo-form-modal-pyqiC7pB.js +1 -0
- package/src/web/public/assets/repos-CeyrjSQ_.js +11 -0
- package/src/web/public/assets/{settings-bvwdOF-n.js → settings-DhX_fRMm.js} +1 -1
- package/src/web/public/assets/{task-D7taZbrH.js → task-XXG4USTn.js} +1 -1
- package/src/web/public/assets/{templates-CRHBAwpm.js → templates-C9a5CUFd.js} +1 -1
- package/src/web/public/index.html +3 -3
- package/src/web/public/assets/index-CLGiMYZc.css +0 -1
- package/src/web/public/assets/repo-form-modal-DxEqerLy.js +0 -1
- package/src/web/public/assets/repos-CKbhG3cI.js +0 -14
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// 绑定描述(组 ↔ 参考仓库 / 开发仓库 ↔ 参考仓库)——#134:归档成**文档**。
|
|
2
|
+
//
|
|
3
|
+
// 描述不再写在关系边上(group_refs.note / ext_linked[].note),也不再有专属弹窗:
|
|
4
|
+
// 它是这个参考仓库的一篇文档(ref_bindings.tag = `link-note:<关系 key>`),
|
|
5
|
+
// 在右侧栏的「<参考仓库名> · 文档列表」里可见可编辑。
|
|
6
|
+
//
|
|
7
|
+
// 单独成文件的原因:ref.ts 已在行数门禁的上限上,绑定描述这套逻辑独立成块
|
|
8
|
+
// (校验关系存在 → 写文档),拆出去两边都清爽。
|
|
9
|
+
import * as service from './service.js';
|
|
10
|
+
import { loadRef, boardKeyInside, repoKeyInside } from './ref.js';
|
|
11
|
+
import { badInput, notFound, conflict } from '../../core/errors.js';
|
|
12
|
+
|
|
13
|
+
/** setLinkNote 的返回:写组级带 group、写仓库级带 repo。 */
|
|
14
|
+
export interface SetLinkNoteResult {
|
|
15
|
+
key: string;
|
|
16
|
+
name: string;
|
|
17
|
+
group?: string;
|
|
18
|
+
repo?: string;
|
|
19
|
+
note: string;
|
|
20
|
+
/** #134:描述落成的文档(refId / docId);清除时为空 */
|
|
21
|
+
refId?: string;
|
|
22
|
+
docId?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** setLinkNote 的参数。 */
|
|
26
|
+
export interface SetLinkNoteInput {
|
|
27
|
+
id?: unknown;
|
|
28
|
+
key?: unknown;
|
|
29
|
+
repo?: unknown;
|
|
30
|
+
board?: unknown;
|
|
31
|
+
note?: unknown;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 绑定描述:这条绑定「参考什么」。note 留空 = 清除。
|
|
36
|
+
* --board b 写组级绑定(组 ↔ 参考仓库)的描述
|
|
37
|
+
* --repo x 写仓库级绑定(开发仓库 ↔ 参考仓库)的描述
|
|
38
|
+
* 两者只能选一个(一条绑定一条描述);目标关系不存在时显式报错。
|
|
39
|
+
*
|
|
40
|
+
* 关系必须真实存在——描述得挂在一条存在的关系上;描述本身则落成文档。
|
|
41
|
+
*/
|
|
42
|
+
export async function setLinkNote({ id, key, repo, board, note }: SetLinkNoteInput = {}): Promise<SetLinkNoteResult> {
|
|
43
|
+
const ref = await loadRef(id || key);
|
|
44
|
+
if (!repo && !board) throw badInput('请给 --repo <开发仓库> 或 --board <看板>');
|
|
45
|
+
if (repo && board) throw badInput('--repo 与 --board 只能选一个(一条绑定一条描述)');
|
|
46
|
+
const text = String(note || '').trim();
|
|
47
|
+
|
|
48
|
+
const s = await service.loadStore();
|
|
49
|
+
const r = s.repos.find((x) => x.id === ref.id)!;
|
|
50
|
+
const refKey = service.deriveKey(r);
|
|
51
|
+
|
|
52
|
+
let scope: { kind: 'board' | 'repo'; key: string; name: string };
|
|
53
|
+
let relation: { group?: string; repo?: string };
|
|
54
|
+
if (board) {
|
|
55
|
+
const bkey = boardKeyInside(s, board);
|
|
56
|
+
if (!bkey) throw notFound('看板不存在: ' + board);
|
|
57
|
+
const b = s.boards.find((x) => service.storedBoardKey(x) === bkey)!;
|
|
58
|
+
const link = (b.refs || []).find((l) => l.id === refKey);
|
|
59
|
+
if (!link) {
|
|
60
|
+
throw conflict(`「${ref.name}」未绑定到组「${b.name}」—— 先 repo bind ${ref.id} --board ${bkey}`);
|
|
61
|
+
}
|
|
62
|
+
scope = { kind: 'board', key: bkey, name: b.name };
|
|
63
|
+
relation = { group: b.name };
|
|
64
|
+
} else {
|
|
65
|
+
const rkey = repoKeyInside(s, repo);
|
|
66
|
+
if (!rkey) throw notFound('绑定的开发仓库不存在: ' + repo);
|
|
67
|
+
const dev = s.repos.find((x) => service.deriveKey(x) === rkey)!;
|
|
68
|
+
if ((dev.type || 'dev') === 'ref') {
|
|
69
|
+
throw badInput(`「${dev.name}」是参考仓库 —— 仓库级绑定描述只挂在开发仓库上`);
|
|
70
|
+
}
|
|
71
|
+
const link = (dev.linked || []).find((l) => l && l.kind === 'ref' && String(l.id) === refKey);
|
|
72
|
+
if (!link) {
|
|
73
|
+
throw conflict(`「${ref.name}」未直接绑定到仓库「${dev.name}」—— 先 repo bind ${ref.id} --repo ${rkey}`);
|
|
74
|
+
}
|
|
75
|
+
scope = { kind: 'repo', key: rkey, name: dev.name };
|
|
76
|
+
relation = { repo: dev.name };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// docs 域用**动态 import**(模块之间不静态互依,见 docs/repos-bridge 的同款约定)
|
|
80
|
+
const { setLinkNoteDoc } = await import('../docs/link-note.js');
|
|
81
|
+
const out = await setLinkNoteDoc({ refKey, scope, text });
|
|
82
|
+
|
|
83
|
+
// 关系边上的 note 同步写一份(**冗余副本**):导出/导入要把它带走(备份不能丢描述),
|
|
84
|
+
// 而面板与交付上下文读的是文档(真身)。文档为准,副本只服务导出。
|
|
85
|
+
await service.mutateStore((d: any) => {
|
|
86
|
+
const dr = d.repos.find((x: any) => service.deriveKey(x) === refKey);
|
|
87
|
+
if (!dr) return;
|
|
88
|
+
if (scope.kind === 'board') {
|
|
89
|
+
const db = d.boards.find((x: any) => service.storedBoardKey(x) === scope.key);
|
|
90
|
+
const link = db && (db.refs || []).find((l: any) => l.id === refKey);
|
|
91
|
+
if (!link) return;
|
|
92
|
+
if (text) link.note = text;
|
|
93
|
+
else delete link.note;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const dev = d.repos.find((x: any) => service.deriveKey(x) === scope.key);
|
|
97
|
+
const link = dev && (dev.linked || []).find((l: any) => l && l.kind === 'ref' && String(l.id) === refKey);
|
|
98
|
+
if (!link) return;
|
|
99
|
+
if (text) link.note = text;
|
|
100
|
+
else delete link.note;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
key: refKey,
|
|
105
|
+
name: r.name,
|
|
106
|
+
...relation,
|
|
107
|
+
note: text,
|
|
108
|
+
refId: out.refId,
|
|
109
|
+
docId: out.refId ? `ref:${out.refId}` : '',
|
|
110
|
+
};
|
|
111
|
+
}
|
package/src/modules/repos/ref.ts
CHANGED
|
@@ -70,7 +70,7 @@ async function findRef(idOrNameOrUrl: unknown): Promise<RepoEntry> {
|
|
|
70
70
|
return r;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
async function loadRef(id: unknown): Promise<RepoEntry> {
|
|
73
|
+
export async function loadRef(id: unknown): Promise<RepoEntry> {
|
|
74
74
|
const r = await findRef(id);
|
|
75
75
|
if ((r.type || 'dev') !== 'ref') throw conflict(`「${r.name}」不是参考仓库(type=dev)——绑定/同步只对 ref 有意义`);
|
|
76
76
|
return r;
|
|
@@ -184,7 +184,7 @@ export async function registerRef({ path, remote, name, desc, notes }: RegisterR
|
|
|
184
184
|
|
|
185
185
|
// mutateStore 的 fn 是同步的——所以绑定里的目标解析用同步变体(store 已在手)。
|
|
186
186
|
// 目标一律解析成 **key**(身份),不再用随机 id。
|
|
187
|
-
function repoKeyInside(s: Store, idOrKey: unknown): string | null {
|
|
187
|
+
export function repoKeyInside(s: Store, idOrKey: unknown): string | null {
|
|
188
188
|
const raw = String(idOrKey || '').trim();
|
|
189
189
|
if (!raw) return null;
|
|
190
190
|
let r = s.repos.find((x) => x.id === raw);
|
|
@@ -200,7 +200,7 @@ function repoKeyInside(s: Store, idOrKey: unknown): string | null {
|
|
|
200
200
|
return r ? service.deriveKey(r) : null;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
function boardKeyInside(s: Store, idOrKey: unknown): string | null {
|
|
203
|
+
export function boardKeyInside(s: Store, idOrKey: unknown): string | null {
|
|
204
204
|
const raw = String(idOrKey || '').trim();
|
|
205
205
|
if (!raw) return null;
|
|
206
206
|
let b = s.boards.find((x) => x.id === raw);
|
|
@@ -418,66 +418,6 @@ export async function bindTarget({ id, key, repo, board, remove }: BindTargetInp
|
|
|
418
418
|
});
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
/** setLinkNote 的返回:写组级带 group、写仓库级带 repo。 */
|
|
422
|
-
export interface SetLinkNoteResult {
|
|
423
|
-
key: string;
|
|
424
|
-
name: string;
|
|
425
|
-
group?: string;
|
|
426
|
-
repo?: string;
|
|
427
|
-
note: string;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/** setLinkNote 的参数。 */
|
|
431
|
-
export interface SetLinkNoteInput {
|
|
432
|
-
id?: unknown;
|
|
433
|
-
key?: unknown;
|
|
434
|
-
repo?: unknown;
|
|
435
|
-
board?: unknown;
|
|
436
|
-
note?: unknown;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* 绑定描述:这条绑定「参考什么」。note 留空 = 清除。
|
|
441
|
-
* --board b 写组级绑定(group_refs)的描述
|
|
442
|
-
* --repo x 写仓库级绑定(dev.ext.ext_linked)的描述
|
|
443
|
-
* 两者只能选一个(一条绑定一条描述);目标关系不存在时显式报错。
|
|
444
|
-
*/
|
|
445
|
-
export async function setLinkNote({ id, key, repo, board, note }: SetLinkNoteInput = {}): Promise<SetLinkNoteResult> {
|
|
446
|
-
const ref = await loadRef(id || key);
|
|
447
|
-
if (!repo && !board) throw badInput('请给 --repo <开发仓库> 或 --board <看板>');
|
|
448
|
-
if (repo && board) throw badInput('--repo 与 --board 只能选一个(一条绑定一条描述)');
|
|
449
|
-
const text = String(note || '').trim();
|
|
450
|
-
return service.mutateStore((s) => {
|
|
451
|
-
const r = s.repos.find((x) => x.id === ref.id)!;
|
|
452
|
-
const refKey = service.deriveKey(r);
|
|
453
|
-
if (board) {
|
|
454
|
-
const bkey = boardKeyInside(s, board);
|
|
455
|
-
if (!bkey) throw notFound('看板不存在: ' + board);
|
|
456
|
-
const b = s.boards.find((x) => service.storedBoardKey(x) === bkey)!;
|
|
457
|
-
const link = (b.refs || []).find((l) => l.id === refKey);
|
|
458
|
-
if (!link) {
|
|
459
|
-
throw conflict(`「${ref.name}」未绑定到组「${b.name}」—— 先 repo bind ${ref.id} --board ${bkey}`);
|
|
460
|
-
}
|
|
461
|
-
if (text) link.note = text;
|
|
462
|
-
else delete link.note;
|
|
463
|
-
return { key: refKey, name: r.name, group: b.name, note: text };
|
|
464
|
-
}
|
|
465
|
-
const rkey = repoKeyInside(s, repo);
|
|
466
|
-
if (!rkey) throw notFound('绑定的开发仓库不存在: ' + repo);
|
|
467
|
-
const dev = s.repos.find((x) => service.deriveKey(x) === rkey)!;
|
|
468
|
-
if ((dev.type || 'dev') === 'ref') {
|
|
469
|
-
throw badInput(`「${dev.name}」是参考仓库 —— 仓库级绑定描述只挂在开发仓库上`);
|
|
470
|
-
}
|
|
471
|
-
const link = (dev.linked || []).find((l) => l && l.kind === 'ref' && String(l.id) === refKey);
|
|
472
|
-
if (!link) {
|
|
473
|
-
throw conflict(`「${ref.name}」未直接绑定到仓库「${dev.name}」—— 先 repo bind ${ref.id} --repo ${rkey}`);
|
|
474
|
-
}
|
|
475
|
-
if (text) link.note = text;
|
|
476
|
-
else delete link.note;
|
|
477
|
-
return { key: refKey, name: r.name, repo: dev.name, note: text };
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
|
|
481
421
|
/** refReposOfRepo 的返回:direct(仓库级)与 boards(组级)两类并列。 */
|
|
482
422
|
export interface RefsOfRepoResult {
|
|
483
423
|
repo: { id: string; key: string; name: string; path: string; desc: string };
|
|
@@ -516,16 +456,28 @@ export async function refReposOfRepo(idOrPathOrName: unknown): Promise<RefsOfRep
|
|
|
516
456
|
|
|
517
457
|
const repoKey = service.deriveKey(repo);
|
|
518
458
|
const groups = groupsOfRepo(s, repoKey);
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
name: b.name
|
|
523
|
-
|
|
524
|
-
|
|
459
|
+
// #134:描述已经不在关系边上了(在文档里)——只读展示从文档取,缺省回落旧 note。
|
|
460
|
+
const boardsOut = await Promise.all(groups.map(async (b) => {
|
|
461
|
+
const bkey = service.storedBoardKey(b);
|
|
462
|
+
const bodies = await linkNoteBodiesOf({ kind: 'board', key: bkey, name: b.name });
|
|
463
|
+
return {
|
|
464
|
+
id: b.id,
|
|
465
|
+
key: bkey,
|
|
466
|
+
name: b.name,
|
|
467
|
+
desc: b.desc || '',
|
|
468
|
+
refRepos: linksOfBoard(s, b).map(({ ref, note }) => ({
|
|
469
|
+
...projectRef(ref),
|
|
470
|
+
note: bodies.get(service.deriveKey(ref)) || note,
|
|
471
|
+
})),
|
|
472
|
+
};
|
|
525
473
|
}));
|
|
526
474
|
|
|
527
475
|
// 仓库级直接绑定:与组无关,永远原样回显(组级结果不覆盖它)
|
|
528
|
-
const
|
|
476
|
+
const repoBodies = await linkNoteBodiesOf({ kind: 'repo', key: repoKey, name: repo.name });
|
|
477
|
+
const direct = directLinksOfRepo(s, repo).map(({ ref, note }) => ({
|
|
478
|
+
...projectRef(ref),
|
|
479
|
+
note: repoBodies.get(service.deriveKey(ref)) || note,
|
|
480
|
+
}));
|
|
529
481
|
|
|
530
482
|
return {
|
|
531
483
|
repo: { id: repo.id, key: repoKey, name: repo.name, path: repo.path, desc: repo.desc || '' },
|
|
@@ -534,6 +486,18 @@ export async function refReposOfRepo(idOrPathOrName: unknown): Promise<RefsOfRep
|
|
|
534
486
|
};
|
|
535
487
|
}
|
|
536
488
|
|
|
489
|
+
/**
|
|
490
|
+
* #134:这条关系下各参考仓库的**描述正文**(refKey → 正文)。
|
|
491
|
+
*
|
|
492
|
+
* 描述已经不在关系边上了(归档成文档),但只读展示(面板 chip、交付上下文)
|
|
493
|
+
* 仍要给出「这个参考在本组里参考什么」——出处是文档。docs 域用**动态 import**
|
|
494
|
+
* (模块之间不静态互依,见 docs/repos-bridge 的同款约定)。
|
|
495
|
+
*/
|
|
496
|
+
async function linkNoteBodiesOf(scope: { kind: 'board' | 'repo'; key: string; name: string }): Promise<Map<string, string>> {
|
|
497
|
+
const { linkNoteBodiesOf: f } = await import('../docs/link-note.js');
|
|
498
|
+
return f(scope);
|
|
499
|
+
}
|
|
500
|
+
|
|
537
501
|
/** syncRef 的结果(status: missing/upToDate/updated/conflict;syncAllRefs 里还有 error)。 */
|
|
538
502
|
export interface SyncRefResult {
|
|
539
503
|
id: string;
|
|
@@ -673,8 +637,13 @@ export async function refReposOfBoard(boardIdOrKey: unknown): Promise<RefsOfBoar
|
|
|
673
637
|
if (!b) b = s.boards.find((x) => String(x.name).toLowerCase() === raw.toLowerCase());
|
|
674
638
|
if (!b) throw notFound('看板不存在: ' + raw);
|
|
675
639
|
const bkey = service.storedBoardKey(b);
|
|
640
|
+
// #134:描述正文从文档取(关系边上已经没有它了)
|
|
641
|
+
const bodies = await linkNoteBodiesOf({ kind: 'board', key: bkey, name: b.name });
|
|
676
642
|
return {
|
|
677
643
|
board: { id: b.id, key: bkey, name: b.name },
|
|
678
|
-
refRepos: linksOfBoard(s, b).map(({ ref, note }) => ({
|
|
644
|
+
refRepos: linksOfBoard(s, b).map(({ ref, note }) => ({
|
|
645
|
+
...projectRef(ref),
|
|
646
|
+
note: bodies.get(service.deriveKey(ref)) || note,
|
|
647
|
+
})),
|
|
679
648
|
};
|
|
680
649
|
}
|
|
@@ -658,7 +658,7 @@
|
|
|
658
658
|
"action": {
|
|
659
659
|
"id": "repo.ref.note",
|
|
660
660
|
"module": "repos",
|
|
661
|
-
"summary": "
|
|
661
|
+
"summary": "写/清绑定描述:这个参考在该组/该仓库里参考什么(#134:描述归档成该参考仓库的一篇文档,在「<参考仓库名> · 文档列表」里可见可编辑;--note 留空 = 清除)",
|
|
662
662
|
"usage": "repo ref note",
|
|
663
663
|
"http": "POST /api/repos/ref/note"
|
|
664
664
|
},
|
|
@@ -1182,6 +1182,21 @@
|
|
|
1182
1182
|
},
|
|
1183
1183
|
"children": []
|
|
1184
1184
|
},
|
|
1185
|
+
{
|
|
1186
|
+
"name": "boardtasks",
|
|
1187
|
+
"path": [
|
|
1188
|
+
"localtask",
|
|
1189
|
+
"boardtasks"
|
|
1190
|
+
],
|
|
1191
|
+
"action": {
|
|
1192
|
+
"id": "localtask.boardtasks",
|
|
1193
|
+
"module": "localtask",
|
|
1194
|
+
"summary": "全部项目组的本组任务(端侧组页 / 侧栏徽标一次拿全):按 frontmatter 的 board 归属聚合,带归属项目",
|
|
1195
|
+
"usage": "localtask boardtasks",
|
|
1196
|
+
"http": "GET /api/localtasks/boardtasks"
|
|
1197
|
+
},
|
|
1198
|
+
"children": []
|
|
1199
|
+
},
|
|
1185
1200
|
{
|
|
1186
1201
|
"name": "cancel",
|
|
1187
1202
|
"path": [
|
|
@@ -1532,7 +1547,7 @@
|
|
|
1532
1547
|
"action": {
|
|
1533
1548
|
"id": "localtask.tasks",
|
|
1534
1549
|
"module": "localtask",
|
|
1535
|
-
"summary": "看一个主题的任务清单(按 --key 或 --cwd
|
|
1550
|
+
"summary": "看一个主题的任务清单(按 --key 或 --cwd 定位):只回列表需要的字段(标题/状态/轮次/可领/组标注),不含正文",
|
|
1536
1551
|
"usage": "localtask tasks",
|
|
1537
1552
|
"http": "GET /api/localtasks/tasks"
|
|
1538
1553
|
},
|
|
@@ -43,6 +43,7 @@ import type {
|
|
|
43
43
|
LocaltaskAttachAction,
|
|
44
44
|
LocaltaskAttachNoteAction,
|
|
45
45
|
LocaltaskAttachmentsAction,
|
|
46
|
+
LocaltaskBoardTasksAction,
|
|
46
47
|
LocaltaskCancelAction,
|
|
47
48
|
LocaltaskCancelManyAction,
|
|
48
49
|
LocaltaskChainAction,
|
|
@@ -226,7 +227,7 @@ export interface ApiClient {
|
|
|
226
227
|
check(): Promise<Awaited<ReturnType<InstanceType<typeof RepoRefCheckAction>['run']>>>;
|
|
227
228
|
/** 克隆远程仓库为参考仓库(落到 gitRepoRoot,登记 + 可选绑定当前目录的开发仓库) */
|
|
228
229
|
refClone(input: z.input<InstanceType<typeof RepoRefCloneAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof RepoRefCloneAction>['run']>>>;
|
|
229
|
-
/**
|
|
230
|
+
/** 写/清绑定描述:这个参考在该组/该仓库里参考什么(#134:描述归档成该参考仓库的一篇文档,在「<参考仓库名> · 文档列表」里可见可编辑;--note 留空 = 清除) */
|
|
230
231
|
refNote(input: z.input<InstanceType<typeof RepoRefNoteAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof RepoRefNoteAction>['run']>>>;
|
|
231
232
|
/** 查参考仓库:--id 某仓库(缺省当前目录)看它直接绑的 + 所属组绑的,两类并列;--board 某组 看这个组绑定的(带绑定描述) */
|
|
232
233
|
of(input?: z.input<InstanceType<typeof RepoRefOfAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof RepoRefOfAction>['run']>>>;
|
|
@@ -288,6 +289,8 @@ export interface ApiClient {
|
|
|
288
289
|
localtaskAttach(input: z.input<InstanceType<typeof LocaltaskAttachAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof LocaltaskAttachAction>['run']>>>;
|
|
289
290
|
/** 列出某条任务引用的附件(正文里的  嵌入),以及本地是否已有(给 agent 直接读本地文件) */
|
|
290
291
|
localtaskAttachments(input: z.input<InstanceType<typeof LocaltaskAttachmentsAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof LocaltaskAttachmentsAction>['run']>>>;
|
|
292
|
+
/** 全部项目组的本组任务(端侧组页 / 侧栏徽标一次拿全):按 frontmatter 的 board 归属聚合,带归属项目 */
|
|
293
|
+
boardtasks(input?: z.input<InstanceType<typeof LocaltaskBoardTasksAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof LocaltaskBoardTasksAction>['run']>>>;
|
|
291
294
|
/** 关闭某主题的等待:阻塞中的 wait 立即收尾(与超时同一出口,带 cancelled 标记;不删主题与任务) */
|
|
292
295
|
cancel(input?: z.input<InstanceType<typeof LocaltaskCancelAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof LocaltaskCancelAction>['run']>>>;
|
|
293
296
|
/** 批量取消待领取任务(按 --ids,定位到 --cwd 主题或 --key):只处理 pending,已领取/已完成/已取消跳过;取消为终态,原文留档 */
|
|
@@ -332,7 +335,7 @@ export interface ApiClient {
|
|
|
332
335
|
reorder(input: z.input<InstanceType<typeof LocaltaskReorderAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof LocaltaskReorderAction>['run']>>>;
|
|
333
336
|
/** 恢复一条被删除(软删除)的任务(撤销删除) */
|
|
334
337
|
restore(input: z.input<InstanceType<typeof LocaltaskTaskRestoreAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof LocaltaskTaskRestoreAction>['run']>>>;
|
|
335
|
-
/** 看一个主题的任务清单(按 --key 或 --cwd
|
|
338
|
+
/** 看一个主题的任务清单(按 --key 或 --cwd 定位):只回列表需要的字段(标题/状态/轮次/可领/组标注),不含正文 */
|
|
336
339
|
tasks(input?: z.input<InstanceType<typeof LocaltaskTasksAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof LocaltaskTasksAction>['run']>>>;
|
|
337
340
|
/** 查看任务级时间目标的每轮 check 记录(时间、已用/剩余、是否到点、当轮总结) */
|
|
338
341
|
timegoalLog(input: z.input<InstanceType<typeof LocaltaskTimegoalLogAction>['_input']>): Promise<Awaited<ReturnType<InstanceType<typeof LocaltaskTimegoalLogAction>['run']>>>;
|
|
@@ -907,6 +910,16 @@ export function createApiClient(transport: Transport): ApiClient {
|
|
|
907
910
|
if (query) path += path.includes('?') ? '&' + query : '?' + query;
|
|
908
911
|
return (await transport.request("GET", path)) as Awaited<ReturnType<InstanceType<typeof LocaltaskAttachmentsAction>['run']>>;
|
|
909
912
|
},
|
|
913
|
+
// action: localtask.boardtasks
|
|
914
|
+
async boardtasks(input?: z.input<InstanceType<typeof LocaltaskBoardTasksAction>['_input']>) {
|
|
915
|
+
const inp = input ?? ({} as z.input<InstanceType<typeof LocaltaskBoardTasksAction>['_input']>);
|
|
916
|
+
let path = `/api/localtasks/boardtasks`;
|
|
917
|
+
const q = new URLSearchParams();
|
|
918
|
+
if (inp["board"] !== undefined) q.set("board", String(inp["board"]));
|
|
919
|
+
const query = q.toString();
|
|
920
|
+
if (query) path += path.includes('?') ? '&' + query : '?' + query;
|
|
921
|
+
return (await transport.request("GET", path)) as Awaited<ReturnType<InstanceType<typeof LocaltaskBoardTasksAction>['run']>>;
|
|
922
|
+
},
|
|
910
923
|
// action: localtask.cancel
|
|
911
924
|
async cancel(input?: z.input<InstanceType<typeof LocaltaskCancelAction>['_input']>) {
|
|
912
925
|
const inp = input ?? ({} as z.input<InstanceType<typeof LocaltaskCancelAction>['_input']>);
|
|
@@ -85,11 +85,6 @@ export function bindRef(body: { id?: string; board?: string[]; repo?: string[];
|
|
|
85
85
|
return api('/api/repos/bind', { method: 'POST', body });
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
/** 给参考仓库写备注(POST /api/repos/ref/note)。 */
|
|
89
|
-
export function refNote(body: { id?: string; board?: string; note?: string }): Promise<any> {
|
|
90
|
-
return api('/api/repos/ref/note', { method: 'POST', body });
|
|
91
|
-
}
|
|
92
|
-
|
|
93
88
|
/** 同步参考仓库(POST /api/repos/ref/sync;{id} 单个或 {all:true} 全量)。 */
|
|
94
89
|
export function refSync(body: { id?: string; all?: boolean }): Promise<any> {
|
|
95
90
|
return api('/api/repos/ref/sync', { method: 'POST', body });
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
// 绑定关系弹窗:dev
|
|
1
|
+
// 绑定关系弹窗:dev 侧绑定(一个开发仓库所属组挂哪些参考)。
|
|
2
2
|
// v4 语义:参考仓库绑定在「组」上,组内所有仓库共享;仓库不属于任何组时无处可挂。
|
|
3
|
+
//
|
|
4
|
+
// #134:**组级绑定描述的弹窗整块删掉**——描述不再是关系边上的一个字符串,
|
|
5
|
+
// 而是归档成这个参考仓库的一篇文档(见仓库管理页的「文档列表」入口)。
|
|
6
|
+
// 这里只保留「绑定」这件事本身。
|
|
3
7
|
import { useState } from 'react';
|
|
4
|
-
import { bindRef
|
|
8
|
+
import { bindRef } from './api.js';
|
|
5
9
|
import { useGuard, useToast } from '../../components/toast/index.jsx';
|
|
6
10
|
import { Modal } from '../../components/popup/index.jsx';
|
|
7
11
|
import { Button } from '../../components/button/index.jsx';
|
|
8
12
|
import type { BoardRecord, RepoRecord } from './repo-table.js';
|
|
9
13
|
|
|
10
|
-
/** 组级绑定描述的目标:组 ↔ 参考仓库这条关系(note 为空 = 清除)。 */
|
|
11
|
-
export interface LinkNoteTarget {
|
|
12
|
-
ref: RepoRecord;
|
|
13
|
-
groupId: string;
|
|
14
|
-
groupName: string;
|
|
15
|
-
note: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
14
|
// dev 侧绑定弹窗:某个开发仓库 → 勾选绑到它所属组的参考(组内共享)
|
|
19
15
|
export default function BindRepoModal({ repo, refRepos, boardList, currentRefs, onClose, onSaved }: {
|
|
20
16
|
repo: RepoRecord;
|
|
@@ -88,48 +84,3 @@ export default function BindRepoModal({ repo, refRepos, boardList, currentRefs,
|
|
|
88
84
|
</Modal>
|
|
89
85
|
);
|
|
90
86
|
}
|
|
91
|
-
|
|
92
|
-
// 组级绑定描述弹窗:组 ↔ 参考仓库这条关系上「参考什么」(摘绑即清)。
|
|
93
|
-
// 从 dev 行的参考 chip、看板参考区块或参考面板的绑定 chip 进入。
|
|
94
|
-
export function LinkNoteModal({ linkNoteFor, onClose, onSaved }: {
|
|
95
|
-
linkNoteFor: LinkNoteTarget;
|
|
96
|
-
onClose: () => void;
|
|
97
|
-
onSaved: () => void | Promise<void>;
|
|
98
|
-
}) {
|
|
99
|
-
const guard = useGuard();
|
|
100
|
-
const toast = useToast();
|
|
101
|
-
const { ref, groupId, groupName, note } = linkNoteFor;
|
|
102
|
-
const [text, setText] = useState(() => note || '');
|
|
103
|
-
|
|
104
|
-
const save = () => guard(async () => {
|
|
105
|
-
await refNote({ id: ref.key, board: groupId, note: text });
|
|
106
|
-
onClose();
|
|
107
|
-
await onSaved();
|
|
108
|
-
toast('已保存组级绑定描述');
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
return (
|
|
112
|
-
<Modal
|
|
113
|
-
title={`组级绑定描述 · ${ref.name} @ 「${groupName}」`}
|
|
114
|
-
onClose={onClose}
|
|
115
|
-
>
|
|
116
|
-
<div className="form-grid">
|
|
117
|
-
<div className="form-field">
|
|
118
|
-
<label htmlFor="link-note">
|
|
119
|
-
「{ref.name}」在这个组里参考什么
|
|
120
|
-
</label>
|
|
121
|
-
<div className="form-hint">
|
|
122
|
-
写这条参考在此处的角色与用法(可多行、可含关键路径/搜索词)。留空保存 = 清除。
|
|
123
|
-
</div>
|
|
124
|
-
<textarea id="link-note" rows={5} spellCheck="false"
|
|
125
|
-
placeholder={'如:project-graph 画布交互的实现参考;\n看 src/extensions/ 的注册方式,搜 registerExtension。'}
|
|
126
|
-
value={text} onChange={(e) => setText(e.target.value)} />
|
|
127
|
-
</div>
|
|
128
|
-
<div className="form-acts">
|
|
129
|
-
<Button onClick={onClose}>取消</Button>
|
|
130
|
-
<Button onClick={save}>保存</Button>
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
</Modal>
|
|
134
|
-
);
|
|
135
|
-
}
|
|
@@ -12,7 +12,7 @@ import { DocsEntry } from './repo-table.jsx';
|
|
|
12
12
|
import { Button } from '../../components/button/index.jsx';
|
|
13
13
|
import type { BoardRecord, RefCheckMap, RepoRecord } from './repo-table.js';
|
|
14
14
|
|
|
15
|
-
export default function BoardRefs({ filterBoard, refRepos, checkOf, onOpenDoc, onOpenRefDocs, onAddMember, onSync, onOpen,
|
|
15
|
+
export default function BoardRefs({ filterBoard, refRepos, checkOf, onOpenDoc, onOpenRefDocs, onAddMember, onSync, onOpen, onUnbind }: {
|
|
16
16
|
filterBoard: BoardRecord | null;
|
|
17
17
|
refRepos: RepoRecord[];
|
|
18
18
|
checkOf: RefCheckMap;
|
|
@@ -22,19 +22,16 @@ export default function BoardRefs({ filterBoard, refRepos, checkOf, onOpenDoc, o
|
|
|
22
22
|
onAddMember: (boardId: string) => void;
|
|
23
23
|
onSync: (r: RepoRecord) => void;
|
|
24
24
|
onOpen: (r: RepoRecord) => void;
|
|
25
|
-
onLinkNote: (r: RepoRecord, groupId: string, groupName: string, note: string) => void;
|
|
26
25
|
onUnbind: (r: RepoRecord, groupId: string) => void;
|
|
27
26
|
}) {
|
|
28
27
|
// 组上绑定的参考仓库(组内共享;不再有「经由成员仓库」)
|
|
28
|
+
// #134:组级描述不再挂在这条边上(那是文档列表里的一篇文档),这里只取参考本身。
|
|
29
29
|
const boardRefRepos = useMemo(() => {
|
|
30
|
-
if (!filterBoard) return [] as
|
|
30
|
+
if (!filterBoard) return [] as RepoRecord[];
|
|
31
31
|
const byKey = new Map<string, RepoRecord>(refRepos.map((r): [string, RepoRecord] => [r.key, r]));
|
|
32
32
|
return (filterBoard.refs || [])
|
|
33
|
-
.map((l) =>
|
|
34
|
-
|
|
35
|
-
return r ? { ...r, boardNote: l.note || '' } : null;
|
|
36
|
-
})
|
|
37
|
-
.filter((r): r is RepoRecord & { boardNote: string } => r !== null);
|
|
33
|
+
.map((l) => byKey.get(l.id) || null)
|
|
34
|
+
.filter((r): r is RepoRecord => r !== null);
|
|
38
35
|
}, [refRepos, filterBoard]);
|
|
39
36
|
|
|
40
37
|
// 组参考区块的折叠:条目多(>8)默认收起,别让一屏全是参考仓库;
|
|
@@ -87,18 +84,11 @@ export default function BoardRefs({ filterBoard, refRepos, checkOf, onOpenDoc, o
|
|
|
87
84
|
title={c ? (c.ok ? '检查通过' : (c.issues || []).join('\n')) : '尚未检查'} />
|
|
88
85
|
<Copyable text={r.remote || r.name} title="点击复制远程地址" className="rp-ref-mounted-name">{r.name}</Copyable>
|
|
89
86
|
{/* #132:参考仓库也是文档宿主——和开发仓库一样,点开就是
|
|
90
|
-
「<参考仓库名> · 文档列表」(右侧栏,同一套筛选器与新建)。
|
|
87
|
+
「<参考仓库名> · 文档列表」(右侧栏,同一套筛选器与新建)。
|
|
88
|
+
#134:这个入口也是「它在本组里参考什么」的落点——描述归档成
|
|
89
|
+
它的一篇文档,没有单独的弹窗与「写描述」按钮。 */}
|
|
91
90
|
<DocsEntry docs={r.descDocs} onOpen={() => onOpenRefDocs(r)} />
|
|
92
91
|
{r.desc ? <span className="muted rp-ref-mounted-desc" title={r.desc}>{r.desc}</span> : null}
|
|
93
|
-
{r.boardNote ? (
|
|
94
|
-
<button className="rp-ref-note-chip" title={`${r.boardNote}\n点击编辑这条组级描述`}
|
|
95
|
-
onClick={() => onLinkNote(r, filterBoard.id, filterBoard.name, r.boardNote)}>
|
|
96
|
-
{r.boardNote.split('\n')[0]}
|
|
97
|
-
</button>
|
|
98
|
-
) : (
|
|
99
|
-
<Button small title={`写「${r.name}」在这个组里参考什么(组级描述)`}
|
|
100
|
-
onClick={() => onLinkNote(r, filterBoard.id, filterBoard.name, '')}>写描述</Button>
|
|
101
|
-
)}
|
|
102
92
|
<span className="acts">
|
|
103
93
|
<Button small onClick={() => onSync(r)}>同步</Button>
|
|
104
94
|
<Button small onClick={() => onOpen(r)}>打开</Button>
|
|
@@ -44,8 +44,7 @@ import RefPanel from './ref-panel.jsx';
|
|
|
44
44
|
import DocSearchModal from './doc-search-modal.jsx';
|
|
45
45
|
import BoardAdminModal from './board-admin.jsx';
|
|
46
46
|
import RepoFormModal from './repo-form-modal.jsx';
|
|
47
|
-
import BindRepoModal
|
|
48
|
-
import type { LinkNoteTarget } from './bind-modals.jsx';
|
|
47
|
+
import BindRepoModal from './bind-modals.jsx';
|
|
49
48
|
import RemoteModal from './remote-modal.jsx';
|
|
50
49
|
|
|
51
50
|
/** /api/repos/ref/check 的出站形状。 */
|
|
@@ -101,8 +100,6 @@ export default function ReposView() {
|
|
|
101
100
|
const [glFor, setGlFor] = useState<RepoRecord | null>(null);
|
|
102
101
|
const [remoteFor, setRemoteFor] = useState<RepoRecord | null>(null); // 对齐 remote 的目标仓库
|
|
103
102
|
const [bindRepoFor, setBindRepoFor] = useState<RepoRecord | null>(null); // dev 侧绑定弹窗的目标仓库
|
|
104
|
-
// 绑定描述编辑(组 ↔ 参考仓库这条关系):{ ref, groupId, groupName, note } | null
|
|
105
|
-
const [linkNoteFor, setLinkNoteFor] = useState<LinkNoteTarget | null>(null);
|
|
106
103
|
|
|
107
104
|
// 从别处跳进来的定位:#/repos?board=<组id>&add=1
|
|
108
105
|
// (组详情页的「添加成员」走这条:不在组页内嵌弹窗,直接落到仓库页对应分组的成员管理)
|
|
@@ -265,11 +262,6 @@ export default function ReposView() {
|
|
|
265
262
|
await Promise.all([loadRepos(), loadBoards(), loadRefCheck()]);
|
|
266
263
|
});
|
|
267
264
|
|
|
268
|
-
// 绑定描述 = 组 ↔ 参考仓库这条关系上的描述(组级描述是**关系**的说明,不是文档)
|
|
269
|
-
const openLinkNote = (ref: RepoRecord, groupId: string, groupName: string, note?: string) => {
|
|
270
|
-
setLinkNoteFor({ ref, groupId, groupName, note: note || '' });
|
|
271
|
-
};
|
|
272
|
-
|
|
273
265
|
// #132:参考仓库的**文档**和开发仓库完全同构——点它的文档入口就在右侧栏开
|
|
274
266
|
// 「<参考仓库名> · 文档列表」(同一个面板、同一套筛选器、同一个 + 新建)。
|
|
275
267
|
const openRefDocs = (ref: RepoRecord) => {
|
|
@@ -460,7 +452,6 @@ export default function ReposView() {
|
|
|
460
452
|
onAddMember={setImpBoardId}
|
|
461
453
|
onSync={syncOne}
|
|
462
454
|
onOpen={(r) => rowAct('open', r)}
|
|
463
|
-
onLinkNote={openLinkNote}
|
|
464
455
|
onUnbind={unbindOne}
|
|
465
456
|
/>
|
|
466
457
|
|
|
@@ -486,8 +477,7 @@ export default function ReposView() {
|
|
|
486
477
|
onSyncOne={syncOne}
|
|
487
478
|
onUnbind={unbindOne}
|
|
488
479
|
onUnbindRepo={unbindRepo}
|
|
489
|
-
|
|
490
|
-
onGoBind={goBindTarget}
|
|
480
|
+
onGoBind={goBindTarget}
|
|
491
481
|
onDocs={rowActs.docs}
|
|
492
482
|
onRowAct={rowAct}
|
|
493
483
|
reload={reload}
|
|
@@ -548,14 +538,6 @@ export default function ReposView() {
|
|
|
548
538
|
/>
|
|
549
539
|
) : null}
|
|
550
540
|
|
|
551
|
-
{linkNoteFor ? (
|
|
552
|
-
<LinkNoteModal
|
|
553
|
-
linkNoteFor={linkNoteFor}
|
|
554
|
-
onClose={() => setLinkNoteFor(null)}
|
|
555
|
-
onSaved={reload.all}
|
|
556
|
-
/>
|
|
557
|
-
) : null}
|
|
558
|
-
|
|
559
541
|
{/* 导入导出:全屏覆盖层面板(逐条选择 / 冲突方案 / 差异检查)。
|
|
560
542
|
面板自己调 /api/repos/export 与 /api/repos/import*,执行完通过 onChanged 让本页刷新。 */}
|
|
561
543
|
{transferOpen ? (
|
|
@@ -28,7 +28,7 @@ interface CloneBody {
|
|
|
28
28
|
|
|
29
29
|
export default function RefPanel({
|
|
30
30
|
refRepos, devRepos, boardList, checkOf, refRepoBackLinks, refBindOpen, onRefBindOpen,
|
|
31
|
-
onClose, onSyncOne, onUnbind, onUnbindRepo,
|
|
31
|
+
onClose, onSyncOne, onUnbind, onUnbindRepo, onGoBind, onDocs, onRowAct, reload,
|
|
32
32
|
}: {
|
|
33
33
|
refRepos: RepoRecord[];
|
|
34
34
|
devRepos: RepoRecord[];
|
|
@@ -41,7 +41,6 @@ export default function RefPanel({
|
|
|
41
41
|
onSyncOne: (r: RepoRecord) => void;
|
|
42
42
|
onUnbind: (r: RepoRecord, groupId: string) => void;
|
|
43
43
|
onUnbindRepo: (r: RepoRecord, repoKey: string) => void;
|
|
44
|
-
onLinkNote: (r: RepoRecord, groupId: string, groupName: string, note: string) => void;
|
|
45
44
|
onGoBind: (kind: string, target: string) => void;
|
|
46
45
|
onDocs: (r: RepoRecord) => void;
|
|
47
46
|
onRowAct: (act: string, r: RepoRecord) => void;
|
|
@@ -230,16 +229,13 @@ export default function RefPanel({
|
|
|
230
229
|
{shownGroups.map((l) => (
|
|
231
230
|
<span className="rp-link-chip rp-link-chip-group" key={'board:' + l.board.id}>
|
|
232
231
|
<button className="rp-link-chip-main"
|
|
233
|
-
title={[
|
|
232
|
+
title={['点击跳到这个组', '组级绑定(组内共享)'].join('\n')}
|
|
234
233
|
onClick={() => onGoBind('board', l.board.id)}>
|
|
235
234
|
<b>组</b>
|
|
236
235
|
<span className="rp-link-chip-name">{l.board.name}</span>
|
|
237
236
|
</button>
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
onClick={() => onLinkNote(r, l.board.id, l.board.name, l.note)}>
|
|
241
|
-
{l.note ? l.note.split('\n')[0] : '+'}
|
|
242
|
-
</button>
|
|
237
|
+
{/* #134:组级描述的编辑入口整块删除——描述是这篇参考
|
|
238
|
+
在文档列表里的一篇文档(见「文档列表」入口)。 */}
|
|
243
239
|
<button className="rp-link-chip-x" title="从本组摘除(不影响其它组、也不动仓库级绑定)"
|
|
244
240
|
onClick={() => onUnbind(r, l.board.id)}>×</button>
|
|
245
241
|
</span>
|
|
@@ -100,8 +100,3 @@ export function repoRefRepos(id: string): Promise<RefReposOf> {
|
|
|
100
100
|
export function boardRefRepos(board: string): Promise<RefReposOf> {
|
|
101
101
|
return api('/api/repos/ref/of?board=' + encodeURIComponent(board));
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
/** 写 / 清绑定描述(这个参考在该组 / 该仓库里参考什么)。 */
|
|
105
|
-
export function setRefNote(body: { id: string; board?: string; repo?: string; note?: string }): Promise<any> {
|
|
106
|
-
return api('/api/repos/ref/note', { method: 'POST', body });
|
|
107
|
-
}
|