@gperezmz/bb-plugin-thread-glance 0.2.3 → 0.3.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/README.md +1 -1
- package/app.tsx +2 -1
- package/dist/app.css +1 -1
- package/dist/app.js +31 -31
- package/dist/app.meta.json +1 -1
- package/dist/server.js +10 -10
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/features/thread-list/components/FoldRows.tsx +21 -30
- package/features/thread-list/components/GroupSection.tsx +8 -50
- package/features/thread-list/components/ListHeader.tsx +79 -0
- package/features/thread-list/components/ProviderBadge.tsx +0 -1
- package/features/thread-list/components/PullRequestProbes.tsx +27 -0
- package/features/thread-list/components/{Toolbar.tsx → SettingsPanel.tsx} +26 -57
- package/features/thread-list/components/ThreadDetails.tsx +3 -3
- package/features/thread-list/components/ThreadList.tsx +116 -84
- package/features/thread-list/components/ThreadRowView.tsx +70 -78
- package/features/thread-list/components/controller.ts +5 -10
- package/features/thread-list/components/glyphs.tsx +39 -14
- package/features/thread-list/data/same-window.ts +34 -0
- package/features/thread-list/data/useAutoExpand.ts +1 -1
- package/features/thread-list/data/useClientPreferences.ts +15 -7
- package/features/thread-list/data/useDefaultBranches.ts +35 -0
- package/features/thread-list/data/usePreferences.ts +16 -7
- package/features/thread-list/data/usePullRequestAnswers.ts +36 -0
- package/features/thread-list/data/useSystemFacts.ts +52 -0
- package/features/thread-list/icons.ts +1 -1
- package/features/thread-list/model/attention.ts +2 -66
- package/features/thread-list/model/branches.ts +27 -0
- package/features/thread-list/model/counters.ts +5 -5
- package/features/thread-list/model/details.ts +6 -6
- package/features/thread-list/model/expansion.ts +5 -5
- package/features/thread-list/model/groups.ts +2 -2
- package/features/thread-list/model/labels.ts +28 -17
- package/features/thread-list/model/layout.ts +5 -2
- package/features/thread-list/model/menu.ts +1 -0
- package/features/thread-list/model/move.ts +1 -1
- package/features/thread-list/model/notes.ts +2 -28
- package/features/thread-list/model/settings.ts +2 -18
- package/features/thread-list/model/settled.ts +122 -0
- package/features/thread-list/model/share.ts +1 -7
- package/features/thread-list/model/sort.ts +5 -16
- package/features/thread-list/model/state.ts +25 -9
- package/features/thread-list/model/toggles.ts +35 -24
- package/features/thread-list/model/{families.ts → trees.ts} +40 -28
- package/features/thread-list/model/view.ts +200 -274
- package/features/thread-list/testing/fixtures.ts +41 -12
- package/package.json +1 -1
- package/server/cli.ts +1 -1
- package/server/import.ts +36 -6
- package/server/preference-store.ts +2 -1
- package/server.ts +1 -1
- package/shared/preferences.ts +38 -27
- package/skills/thread-glance/SKILL.md +11 -12
- package/features/thread-list/data/useAttentionHold.ts +0 -19
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Thread trees: who attaches to whom, and what each tree
|
|
2
2
|
// carries. Pure.
|
|
3
3
|
import type { PluginSidebarThread } from "@get-bb/plugin-sdk/app";
|
|
4
4
|
import {
|
|
5
5
|
computeState,
|
|
6
|
+
dotFlagsOf,
|
|
6
7
|
hiddenThreadFlags,
|
|
7
8
|
isQuietThread,
|
|
8
9
|
isUnread,
|
|
@@ -14,11 +15,11 @@ import {
|
|
|
14
15
|
} from "./state";
|
|
15
16
|
import { attentionFlagsOf, isOrphanedFailure } from "./attention";
|
|
16
17
|
import { compareCreationAscending } from "./sort";
|
|
17
|
-
import {
|
|
18
|
+
import { needsKindOf, rowNote, type RowNote } from "./notes";
|
|
18
19
|
import type { ThreadNotes } from "@/shared/contract";
|
|
19
20
|
import type { ChildAttention } from "@/shared/preferences";
|
|
20
21
|
|
|
21
|
-
/** States that keep a child out of
|
|
22
|
+
/** States that keep a child out of an open tree's "N more child threads" fold with `childAttention` `blocked`: working, setting up, background work. */
|
|
22
23
|
const RUNNING: ReadonlySet<StateKind> = new Set<StateKind>(["working", "background"]);
|
|
23
24
|
|
|
24
25
|
/** Everything the list knows about one thread. */
|
|
@@ -28,16 +29,19 @@ export interface ThreadInfo {
|
|
|
28
29
|
unread: boolean;
|
|
29
30
|
/** Own flags; for hidden threads only waits-on-you and unread-failed. */
|
|
30
31
|
flags: ReadonlySet<Flag>;
|
|
32
|
+
/** What it adds to the child dot of the threads above it (see `dotFlagsOf`). */
|
|
33
|
+
dotFlags: ReadonlySet<Flag>;
|
|
31
34
|
/**
|
|
32
|
-
* The flags of this thread that make it need attention, for
|
|
33
|
-
* counters and auto-reveal: a child counts
|
|
35
|
+
* The flags of this thread that make it need attention, for collapsed
|
|
36
|
+
* groups, the counters, the need-you filter and auto-reveal: a child counts
|
|
37
|
+
* less than a root.
|
|
34
38
|
*/
|
|
35
39
|
attentionFlags: Set<Flag>;
|
|
36
40
|
/** Quiet test for the thread alone. */
|
|
37
41
|
quiet: boolean;
|
|
38
42
|
/**
|
|
39
43
|
* A quiet thread, as if no thread were open: nothing to see behind a
|
|
40
|
-
*
|
|
44
|
+
* tree's fold. A root, or any child when `childAttention` is
|
|
41
45
|
* `everything`, takes the quiet test without the open thread's exemption.
|
|
42
46
|
* Otherwise a child is quiet unless it runs or needs attention, so finishing
|
|
43
47
|
* unread folds it; an archived child is always quiet. The fold reads this,
|
|
@@ -49,23 +53,25 @@ export interface ThreadInfo {
|
|
|
49
53
|
parentId: string | null;
|
|
50
54
|
/** Why it waits on you or failed, for the line under the row. */
|
|
51
55
|
note: RowNote | null;
|
|
52
|
-
/** Why it needs attention, for the line under its row in Needs attention. */
|
|
53
|
-
attentionNote: RowNote | null;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
/** What a thread's descendants add up to, for its chip and
|
|
58
|
+
/** What a thread's descendants add up to, for its chip, its child dot and folding. */
|
|
57
59
|
export interface Subtree {
|
|
58
60
|
/** Descendants, depth-first in creation order, hidden ones included. */
|
|
59
61
|
descendants: ThreadInfo[];
|
|
60
62
|
/** Union of the descendants' Needs attention flags and working, archived ones left out. */
|
|
61
63
|
flags: ReadonlySet<Flag>;
|
|
62
|
-
/**
|
|
64
|
+
/** Union of the descendants' `dotFlags`, archived ones left out: the child dot. */
|
|
65
|
+
dotFlags: ReadonlySet<Flag>;
|
|
66
|
+
/** Visible descendants at any depth. */
|
|
63
67
|
visibleCount: number;
|
|
68
|
+
/** Visible direct children: the chip's number. */
|
|
69
|
+
childCount: number;
|
|
64
70
|
/** Every visible descendant is quiet, as if no thread were open, so the subtree adds nothing to see when folded. */
|
|
65
71
|
quietIgnoringOpen: boolean;
|
|
66
72
|
}
|
|
67
73
|
|
|
68
|
-
export interface
|
|
74
|
+
export interface ThreadTree {
|
|
69
75
|
root: ThreadInfo;
|
|
70
76
|
/** Descendants, depth-first in creation order, hidden ones included. */
|
|
71
77
|
descendants: ThreadInfo[];
|
|
@@ -73,11 +79,11 @@ export interface Family {
|
|
|
73
79
|
descendantFlags: ReadonlySet<Flag>;
|
|
74
80
|
/** The same over root and descendants (rollup, folder rows). */
|
|
75
81
|
flags: ReadonlySet<Flag>;
|
|
76
|
-
/** Needs attention flags over root and descendants:
|
|
82
|
+
/** Needs attention flags over root and descendants: the tree needs attention when any is set. */
|
|
77
83
|
attentionFlags: ReadonlySet<Flag>;
|
|
78
84
|
/** Visible descendants: the chip's number. */
|
|
79
85
|
visibleDescendantCount: number;
|
|
80
|
-
/** Largest latestAttentionAt over the
|
|
86
|
+
/** Largest latestAttentionAt over the tree. */
|
|
81
87
|
latestAttentionAt: number;
|
|
82
88
|
/** Every thread quiet and the active thread not in it. */
|
|
83
89
|
quiet: boolean;
|
|
@@ -93,8 +99,8 @@ export interface Forest {
|
|
|
93
99
|
infos: ReadonlyMap<string, ThreadInfo>;
|
|
94
100
|
/** Visible child ids per parent id, creation order; hidden children included. */
|
|
95
101
|
children: ReadonlyMap<string, readonly string[]>;
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
trees: readonly ThreadTree[];
|
|
103
|
+
treeOf: ReadonlyMap<string, ThreadTree>;
|
|
98
104
|
/** The rollup under every thread with a row, by thread id. */
|
|
99
105
|
subtrees: ReadonlyMap<string, Subtree>;
|
|
100
106
|
}
|
|
@@ -161,13 +167,13 @@ export function buildForest(inputs: ForestInputs): Forest {
|
|
|
161
167
|
state,
|
|
162
168
|
unread,
|
|
163
169
|
flags: thread.isHidden ? hiddenThreadFlags(flags) : flags,
|
|
170
|
+
dotFlags: dotFlagsOf(flags, thread.isHidden),
|
|
164
171
|
attentionFlags: new Set<Flag>(),
|
|
165
172
|
quiet: isQuietThread(state, unread, isActive),
|
|
166
173
|
quietIgnoringOpen: false,
|
|
167
174
|
isActive,
|
|
168
175
|
parentId: attachParent(thread, byId),
|
|
169
176
|
note: rowNote(thread, inputs.notes?.[thread.id]),
|
|
170
|
-
attentionNote: null,
|
|
171
177
|
});
|
|
172
178
|
}
|
|
173
179
|
|
|
@@ -181,7 +187,6 @@ export function buildForest(inputs: ForestInputs): Forest {
|
|
|
181
187
|
parent !== undefined &&
|
|
182
188
|
isOrphanedFailure(info.thread, info.flags, { ...parent, finishedAt: inputs.finishedAt[parent.thread.id] }),
|
|
183
189
|
});
|
|
184
|
-
info.attentionNote = attentionNote(info.thread, inputs.notes?.[info.thread.id], info.attentionFlags);
|
|
185
190
|
info.quietIgnoringOpen =
|
|
186
191
|
parent === undefined || mode === "everything"
|
|
187
192
|
? isQuietThread(info.state, info.unread, false)
|
|
@@ -192,7 +197,7 @@ export function buildForest(inputs: ForestInputs): Forest {
|
|
|
192
197
|
const roots: ThreadInfo[] = [];
|
|
193
198
|
for (const info of infos.values()) {
|
|
194
199
|
if (info.parentId === null) {
|
|
195
|
-
// A hidden thread with no visible ancestor has no row and no
|
|
200
|
+
// A hidden thread with no visible ancestor has no row and no tree.
|
|
196
201
|
if (!info.thread.isHidden) roots.push(info);
|
|
197
202
|
continue;
|
|
198
203
|
}
|
|
@@ -211,7 +216,9 @@ export function buildForest(inputs: ForestInputs): Forest {
|
|
|
211
216
|
if (cached !== undefined) return cached;
|
|
212
217
|
const descendants: ThreadInfo[] = [];
|
|
213
218
|
const flags = new Set<Flag>();
|
|
219
|
+
const dotFlags = new Set<Flag>();
|
|
214
220
|
let visibleCount = 0;
|
|
221
|
+
let childCount = 0;
|
|
215
222
|
let quietIgnoringOpen = true;
|
|
216
223
|
path.add(id);
|
|
217
224
|
for (const childId of children.get(id) ?? []) {
|
|
@@ -222,22 +229,27 @@ export function buildForest(inputs: ForestInputs): Forest {
|
|
|
222
229
|
if (!child.thread.isArchived) {
|
|
223
230
|
for (const flag of child.attentionFlags) flags.add(flag);
|
|
224
231
|
if (child.flags.has("working")) flags.add("working");
|
|
232
|
+
for (const flag of child.dotFlags) dotFlags.add(flag);
|
|
225
233
|
}
|
|
226
234
|
for (const flag of below.flags) flags.add(flag);
|
|
235
|
+
for (const flag of below.dotFlags) dotFlags.add(flag);
|
|
227
236
|
if (child.thread.isHidden ? child.attentionFlags.size > 0 : !child.quietIgnoringOpen) quietIgnoringOpen = false;
|
|
228
|
-
if (!child.thread.isHidden)
|
|
237
|
+
if (!child.thread.isHidden) {
|
|
238
|
+
visibleCount += 1;
|
|
239
|
+
childCount += 1;
|
|
240
|
+
}
|
|
229
241
|
visibleCount += below.visibleCount;
|
|
230
242
|
if (!below.quietIgnoringOpen) quietIgnoringOpen = false;
|
|
231
243
|
}
|
|
232
244
|
path.delete(id);
|
|
233
|
-
const subtree: Subtree = { descendants, flags, visibleCount, quietIgnoringOpen };
|
|
245
|
+
const subtree: Subtree = { descendants, flags, dotFlags, visibleCount, childCount, quietIgnoringOpen };
|
|
234
246
|
subtrees.set(id, subtree);
|
|
235
247
|
return subtree;
|
|
236
248
|
};
|
|
237
249
|
for (const id of infos.keys()) subtreeOf(id, new Set());
|
|
238
250
|
|
|
239
|
-
const
|
|
240
|
-
const
|
|
251
|
+
const trees: ThreadTree[] = [];
|
|
252
|
+
const treeOf = new Map<string, ThreadTree>();
|
|
241
253
|
for (const root of roots) {
|
|
242
254
|
const { descendants, flags: descendantFlags, visibleCount: visibleDescendantCount } = subtrees.get(root.thread.id)!;
|
|
243
255
|
let latestAttentionAt = root.thread.latestAttentionAt;
|
|
@@ -254,7 +266,7 @@ export function buildForest(inputs: ForestInputs): Forest {
|
|
|
254
266
|
} else {
|
|
255
267
|
if (!info.quiet) quiet = false;
|
|
256
268
|
// A child reads as its own fold does, so with `blocked` an unread child
|
|
257
|
-
// does not keep an old
|
|
269
|
+
// does not keep an old tree out of the group's fold.
|
|
258
270
|
if (!info.quietIgnoringOpen) quietIgnoringOpen = false;
|
|
259
271
|
}
|
|
260
272
|
}
|
|
@@ -266,7 +278,7 @@ export function buildForest(inputs: ForestInputs): Forest {
|
|
|
266
278
|
}
|
|
267
279
|
if (root.flags.has("working")) flags.add("working");
|
|
268
280
|
}
|
|
269
|
-
const
|
|
281
|
+
const tree: ThreadTree = {
|
|
270
282
|
root,
|
|
271
283
|
descendants,
|
|
272
284
|
descendantFlags,
|
|
@@ -278,11 +290,11 @@ export function buildForest(inputs: ForestInputs): Forest {
|
|
|
278
290
|
quietIgnoringOpen,
|
|
279
291
|
containsActive,
|
|
280
292
|
};
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
for (const info of descendants)
|
|
293
|
+
trees.push(tree);
|
|
294
|
+
treeOf.set(root.thread.id, tree);
|
|
295
|
+
for (const info of descendants) treeOf.set(info.thread.id, tree);
|
|
284
296
|
}
|
|
285
|
-
return { infos, children,
|
|
297
|
+
return { infos, children, trees, treeOf, subtrees };
|
|
286
298
|
}
|
|
287
299
|
|
|
288
300
|
/** Ids from `id` up to (not including) `stopAt`, nearest first. */
|