@andrioid/paseo-attention-span 0.4.8 → 0.4.10
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/OVERVIEW.md +11 -7
- package/client/attention-screen.tsx +50 -52
- package/client/card.tsx +34 -11
- package/client/coverage-settings.tsx +36 -1
- package/client/entity.tsx +118 -0
- package/client/feedback.tsx +2 -2
- package/client/icons.ts +5 -0
- package/client/next-up.tsx +145 -74
- package/client/sessions.ts +2 -2
- package/client/sheet.tsx +92 -11
- package/client/ui.tsx +167 -10
- package/docs/architecture.md +16 -9
- package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
- package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
- package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
- package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing.png +0 -0
- package/docs/screenshots/desktop-dark-history-reviewed.png +0 -0
- package/docs/screenshots/desktop-dark-history.png +0 -0
- package/docs/screenshots/desktop-dark-next-up.png +0 -0
- package/docs/screenshots/desktop-dark-settings.png +0 -0
- package/docs/screenshots/desktop-dark-setup.png +0 -0
- package/docs/screenshots/desktop-dark-waiting-too-long.png +0 -0
- package/docs/screenshots/desktop-dark-waiting.png +0 -0
- package/docs/screenshots/phone-dark-doing.png +0 -0
- package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
- package/index.server.ts +2 -0
- package/package.json +2 -2
- package/requirements.yaml +8 -5
- package/server/classify.ts +76 -29
- package/server/details.ts +3 -2
- package/server/fixture.ts +34 -10
- package/server/gh.ts +29 -12
- package/server/github-types.ts +19 -2
- package/server/projects.ts +47 -0
- package/server/queries.ts +41 -6
- package/server/rules.ts +10 -15
- package/server/service.ts +138 -22
- package/server/store.ts +15 -4
- package/server/view.ts +7 -2
- package/shared/attention.ts +72 -6
- package/shared/hint.ts +21 -0
- package/shared/opening.ts +31 -0
- package/shared/rpc.ts +5 -1
- package/docs/screenshots/desktop-dark-doing-too-long.png +0 -0
package/server/rules.ts
CHANGED
|
@@ -7,8 +7,6 @@ export interface Rule<S> {
|
|
|
7
7
|
when: (s: S) => boolean;
|
|
8
8
|
// The first is the card's main action.
|
|
9
9
|
actions?: (s: S) => ActionId[];
|
|
10
|
-
// What it waits for, for Waiting too long's chip.
|
|
11
|
-
label?: (s: S) => string;
|
|
12
10
|
}
|
|
13
11
|
export type Rules<S> = { [K in SectionId]?: Rule<S> };
|
|
14
12
|
|
|
@@ -48,15 +46,15 @@ export interface PrState {
|
|
|
48
46
|
asked: boolean;
|
|
49
47
|
// I replied to the reviewer, or pushed after changes were requested.
|
|
50
48
|
replied: boolean;
|
|
51
|
-
// Waited at least waitingTooLongDays [ATT-11].
|
|
52
|
-
tooLong: boolean;
|
|
53
49
|
}
|
|
54
50
|
|
|
55
51
|
// Approved and nothing I know of in the way, yet GitHub's rules still block it: signed commits, a required check that never
|
|
56
52
|
// reported, a resolved-conversations rule, and the like. Nothing for me to do here, so it waits [PRS-13].
|
|
57
53
|
export const rulesBlock = (s: PrState) => !s.draft && s.mergeBlocked && s.approved && !s.ciPending && !s.ciFailing && !s.changes && !s.conflicts;
|
|
58
54
|
|
|
59
|
-
|
|
55
|
+
// Fair to nudge whoever it waits on once it has waited too long: not while the next step is mine (failing CI, conflicts or a
|
|
56
|
+
// stack out of sync, changes to make, a reply I owe), nor while CI runs, which a reviewer may fairly wait out [ATT-11].
|
|
57
|
+
export const nudgeable = (s: PrState) => !s.draft && !s.waiting && !s.answer && !s.ciFailing && !s.ciPending && !s.changes && !s.blocked;
|
|
60
58
|
|
|
61
59
|
// Merge only once CI passed against the current base [PRS-04, UPS-07]. Until then, auto-merge if the repo allows it [PRS-10].
|
|
62
60
|
function readyActions(s: PrState): ActionId[] {
|
|
@@ -83,8 +81,6 @@ export const PR_RULES: Rules<PrState> = {
|
|
|
83
81
|
// Blocked while CI runs counts as waiting on CI, which auto-merge covers [PRS-10, PRS-13].
|
|
84
82
|
ready: { when: (s) => !s.draft && s.approved && !s.conflicts && !s.ciFailing && !s.changes && !(s.autoMerge && s.ciPending) && !rulesBlock(s), actions: readyActions },
|
|
85
83
|
upstream: { when: (s) => !s.draft && s.blocked, actions: () => ["rebase"] },
|
|
86
|
-
// After too long it's mine to nudge [ATT-11]; a rule has no one to nudge [PRS-13].
|
|
87
|
-
too_long: { when: (s) => !s.draft && s.asked && s.tooLong && !rulesBlock(s), label: waitingFor },
|
|
88
84
|
// Mine until I ask someone, even while CI runs. Merge, for repos where nobody reviews, once CI passed on the current base
|
|
89
85
|
// and GitHub's rules allow it [PRS-12, PRS-04, PRS-13].
|
|
90
86
|
needs_reviewer: {
|
|
@@ -92,10 +88,11 @@ export const PR_RULES: Rules<PrState> = {
|
|
|
92
88
|
actions: (s) => (!s.ciFailing && !s.ciPending && s.behindBy === 0 && !s.mergeBlocked ? ["request_review", "merge"] : ["request_review"]),
|
|
93
89
|
},
|
|
94
90
|
drafts: { when: (s) => s.draft, actions: draftActions },
|
|
95
|
-
// Otherwise it waits on others: CI, the reviewer after my reply, or a review
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
91
|
+
// Otherwise it waits on others: CI, the reviewer after my reply, or a review, however long; Waiting says when that's too
|
|
92
|
+
// long [WAI-01, ATT-11]. Blocked by rules waits with reviews [PRS-13].
|
|
93
|
+
wait_review: { when: (s) => !s.draft && s.asked && !s.ciPending && (!s.replied || rulesBlock(s)) },
|
|
94
|
+
wait_reviewer: { when: (s) => !s.draft && s.asked && !s.ciPending && s.replied && !rulesBlock(s) },
|
|
95
|
+
wait_ci: { when: (s) => !s.draft && s.asked && s.ciPending },
|
|
99
96
|
};
|
|
100
97
|
|
|
101
98
|
// ---- Issues and others' PRs I'm in [WAI-01, ATT-16] ----
|
|
@@ -113,8 +110,6 @@ export interface IssueState {
|
|
|
113
110
|
answered: boolean;
|
|
114
111
|
// My last comment is within mentionDays.
|
|
115
112
|
fresh: boolean;
|
|
116
|
-
// My last comment is at least waitingTooLongDays old.
|
|
117
|
-
tooLong: boolean;
|
|
118
113
|
}
|
|
119
114
|
|
|
120
115
|
// An issue may match none, and then isn't listed: an answer I 👍'd needs nothing more, nor an old thread of someone else's.
|
|
@@ -123,7 +118,7 @@ export const ISSUE_RULES: Rules<IssueState> = {
|
|
|
123
118
|
// A recent comment after mine, without mentioning me: mine until I reply, 👍 it or dismiss it [ATT-16].
|
|
124
119
|
// On someone else's thread only when I've allowed replies without a tag [ATT-17].
|
|
125
120
|
answered: { when: (s) => s.answered && (s.authored || s.follow) },
|
|
126
|
-
//
|
|
127
|
-
|
|
121
|
+
// My question waits on an answer: on my own issues however long ago, on others' only while fresh. Waiting says when it's
|
|
122
|
+
// waited too long [WAI-01, ATT-11].
|
|
128
123
|
wait_answer: { when: (s) => s.mineLast && s.question && (s.authored || s.fresh) },
|
|
129
124
|
};
|
package/server/service.ts
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
|
-
import type { Attention, AttentionView, FeedId, FeedStatus, Item, Reviewer } from "../shared/attention";
|
|
1
|
+
import type { Attention, AttentionView, FeedId, FeedStatus, GithubColor, Item, ProjectsAccess, Reviewer } from "../shared/attention";
|
|
2
2
|
import type { PluginHandlerContext } from "@getpaseo/plugin/server";
|
|
3
3
|
import { AttentionConfig, type FieldRole, githubRepoOf, nextUpField } from "../shared/config";
|
|
4
4
|
import type { IssueField } from "../shared/setup";
|
|
5
|
-
import { classify, classifyHistory } from "./classify";
|
|
6
|
-
import {
|
|
5
|
+
import { classify, classifyHistory, issueBoardIds } from "./classify";
|
|
6
|
+
import { probeAnswer, projectsFailure, projectsWarning, searchWithProjects } from "./projects";
|
|
7
|
+
import { FIXTURE, graphql, graphqlResult } from "./gh";
|
|
7
8
|
import { fixture, FIXTURE_AGENTS, FIXTURE_ISSUE_FIELDS } from "./fixture";
|
|
8
9
|
import type { Details, HistoryResult, LinkedIssue, LiveResult, MergeStateStatus, PullRequestNode } from "./github-types";
|
|
9
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
type CheckContext,
|
|
12
|
+
detailsQuery,
|
|
13
|
+
HISTORY_SEARCHES,
|
|
14
|
+
issueFieldsQuery,
|
|
15
|
+
type OrgFields,
|
|
16
|
+
MERGE_STATE_BATCH,
|
|
17
|
+
mergeStateQuery,
|
|
18
|
+
mergeUnclaimed,
|
|
19
|
+
prKey,
|
|
20
|
+
PROJECTS_PROBE,
|
|
21
|
+
projectStatusesQuery,
|
|
22
|
+
type ProjectStatusesResult,
|
|
23
|
+
requiredChecks,
|
|
24
|
+
type SearchName,
|
|
25
|
+
searchQuery,
|
|
26
|
+
searchVariables,
|
|
27
|
+
type UnclaimedSearch,
|
|
28
|
+
unclaimedSearches,
|
|
29
|
+
} from "./queries";
|
|
10
30
|
import { toLookUp } from "./references";
|
|
11
31
|
import { loadConfig, loadState, moveOldFiles, saveCodeRepo, saveCoverage, saveFollowThreads, saveNextUpFields, saveNextUpSources, saveState, State } from "./store";
|
|
12
32
|
import { applyPending, buildView, doneItem, type Effect, isPending, SETTLE_MS } from "./view";
|
|
@@ -15,6 +35,18 @@ import { applyPending, buildView, doneItem, type Effect, isPending, SETTLE_MS }
|
|
|
15
35
|
const HISTORY_MAX_AGE_SECONDS = 24 * 60 * 60;
|
|
16
36
|
// A failed refresh is retried at most this often, except on ⟳.
|
|
17
37
|
const RETRY_MS = 5 * 60_000;
|
|
38
|
+
// Whether projects can be read is asked again at most this often, unless Settings asks [NXT-12].
|
|
39
|
+
const PROJECTS_CHECK_MS = 60 * 60_000;
|
|
40
|
+
// The check waits this long at most, as the refresh waits on it.
|
|
41
|
+
const PROBE_TIMEOUT_MS = 10_000;
|
|
42
|
+
// A search with projects, or a batch of boards' statuses, waits this long at most before the refresh goes on without them.
|
|
43
|
+
const PROJECTS_SEARCH_TIMEOUT_MS = 20_000;
|
|
44
|
+
const BOARDS_PER_REQUEST = 50;
|
|
45
|
+
// Batches of boards asked at once, so many boards don't burst requests [GH-01].
|
|
46
|
+
const BOARD_BATCHES_AT_ONCE = 2;
|
|
47
|
+
|
|
48
|
+
// Where gh's token comes from: an environment variable, which gh reads before its own login, or that login [NXT-12].
|
|
49
|
+
const tokenSource = (): ProjectsAccess["token"] => (process.env.GH_TOKEN ? "GH_TOKEN" : process.env.GITHUB_TOKEN ? "GITHUB_TOKEN" : "gh");
|
|
18
50
|
|
|
19
51
|
// What a change does to the lists: an effect, Finished (merged or closed, so off the lists and maybe into History), or nothing.
|
|
20
52
|
export type Change = Effect | { kind: "finished"; notPlanned?: boolean } | null;
|
|
@@ -40,6 +72,9 @@ export class AttentionService {
|
|
|
40
72
|
private timer: ReturnType<typeof setInterval> | null = null;
|
|
41
73
|
private followUps: Partial<Record<FeedId, ReturnType<typeof setTimeout>>> = {};
|
|
42
74
|
private intervalMinutes = 0;
|
|
75
|
+
private projects: { access: ProjectsAccess; checkedAt: number } = { access: { state: "unknown", token: tokenSource() }, checkedAt: 0 };
|
|
76
|
+
private projectsProbe: Promise<ProjectsAccess> | null = null;
|
|
77
|
+
private projectsWarning: string | undefined;
|
|
43
78
|
// The app's connection to Paseo, from its last request; background refreshes have none of their own.
|
|
44
79
|
private paseo: PluginHandlerContext["paseo"] | null = null;
|
|
45
80
|
|
|
@@ -154,6 +189,11 @@ export class AttentionService {
|
|
|
154
189
|
await this.save();
|
|
155
190
|
}
|
|
156
191
|
|
|
192
|
+
async setProjectFilter(projects: string[]): Promise<void> {
|
|
193
|
+
this.state.projectFilter = projects;
|
|
194
|
+
await this.save();
|
|
195
|
+
}
|
|
196
|
+
|
|
157
197
|
// "Not now" on an update notice holds until a newer one [UPD-01].
|
|
158
198
|
get skippedUpdate(): string | null {
|
|
159
199
|
return this.state.skippedUpdate;
|
|
@@ -269,23 +309,70 @@ export class AttentionService {
|
|
|
269
309
|
return classifyHistory(await graphql<HistoryResult>(searchQuery(HISTORY_SEARCHES), this.variables(HISTORY_SEARCHES, now)));
|
|
270
310
|
}
|
|
271
311
|
|
|
312
|
+
// Whether the gh login may read projects, asked at most hourly, or now when Settings asks [NXT-12]. On only when GitHub
|
|
313
|
+
// actually returns the viewer's projects, as a partial answer with errors isn't a yes. Any attempt counts toward the
|
|
314
|
+
// hour, so an outage doesn't add a probe to every refresh, and it's given PROBE_TIMEOUT_MS, so a stuck gh can't hold up
|
|
315
|
+
// the refresh waiting on it. Settings and a refresh asking at once share one probe [GH-01].
|
|
316
|
+
// What went wrong reading projects on the last refresh, while they're on, like boards an org's SSO hides, rides along for
|
|
317
|
+
// Settings; a later probe that works doesn't clear it, only a refresh that reads them cleanly.
|
|
318
|
+
async projectsAccess(force = false): Promise<ProjectsAccess> {
|
|
319
|
+
if (FIXTURE) return { state: "on", token: "gh" };
|
|
320
|
+
const access = await this.probeProjects(force);
|
|
321
|
+
return this.projectsWarning ? { ...access, warning: this.projectsWarning } : access;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
private async probeProjects(force: boolean): Promise<ProjectsAccess> {
|
|
325
|
+
if (this.projectsProbe) return this.projectsProbe;
|
|
326
|
+
if (!force && Date.now() - this.projects.checkedAt < PROJECTS_CHECK_MS) return this.projects.access;
|
|
327
|
+
this.projectsProbe = (async () => {
|
|
328
|
+
const result = await graphqlResult<{ viewer: { projectsV2: unknown } | null }>(PROJECTS_PROBE, {}, { timeoutMs: PROBE_TIMEOUT_MS }).catch((error: Error) => error);
|
|
329
|
+
const answer = probeAnswer(result, this.projects.access.state);
|
|
330
|
+
if (answer.error) console.error("Couldn't read projects:", answer.error);
|
|
331
|
+
this.projects = { access: { ...answer, token: tokenSource() }, checkedAt: Date.now() };
|
|
332
|
+
return this.projects.access;
|
|
333
|
+
})().finally(() => (this.projectsProbe = null));
|
|
334
|
+
return this.projectsProbe;
|
|
335
|
+
}
|
|
336
|
+
|
|
272
337
|
// One request per search, in parallel. The details request starts once the searches it needs are back [GH-01].
|
|
273
338
|
private async searchLive(now: Date, unclaimed: UnclaimedSearch[]): Promise<{ data: LiveResult; details: Details }> {
|
|
274
339
|
const all = searchVariables(this.config, now);
|
|
275
|
-
|
|
340
|
+
// Next up's searches read projects too, when they can [NXT-12]. Projects are extra, so they can never cost the search:
|
|
341
|
+
// whatever goes wrong with them (the scope gone since the check, an org's SSO, no results at all), the search runs again
|
|
342
|
+
// without them and Settings says why. Boards the token can't see come back empty and are left out.
|
|
343
|
+
const projects = (await this.probeProjects(false)).state === "on";
|
|
344
|
+
// What goes wrong reading projects this refresh, for Settings.
|
|
345
|
+
const problems: string[] = [];
|
|
346
|
+
const pickable = async <K extends "assigned" | "unclaimed">(name: K, query: string): Promise<Pick<LiveResult, K>> => {
|
|
347
|
+
const plain = () => graphql<Pick<LiveResult, K>>(searchQuery([name]), { [name]: query });
|
|
348
|
+
if (!projects) return plain();
|
|
349
|
+
// Bounded, so a stuck request falls back rather than hold up the refresh.
|
|
350
|
+
const withProjects = () => graphqlResult<Pick<LiveResult, K>>(searchQuery([name], false, { projects }), { [name]: query }, { timeoutMs: PROJECTS_SEARCH_TIMEOUT_MS });
|
|
351
|
+
const { data, failure, partly } = await searchWithProjects(withProjects, plain, (result) => !!result[name]);
|
|
352
|
+
for (const problem of [partly, failure]) if (problem) (problems.push(problem), console.error(`Next up's ${name} search with projects:`, problem));
|
|
353
|
+
if (failure) this.projects = { access: { ...projectsFailure(failure), token: tokenSource() }, checkedAt: Date.now() };
|
|
354
|
+
return data;
|
|
355
|
+
};
|
|
356
|
+
const search = (name: keyof typeof all): Promise<Partial<LiveResult>> =>
|
|
357
|
+
name === "assigned" ? pickable(name, all[name]) : graphql<Partial<LiveResult>>(searchQuery([name], name === "mine"), { [name]: all[name] });
|
|
276
358
|
// One per Next up source [NXT-09].
|
|
277
359
|
const searchUnclaimed = async (): Promise<Partial<LiveResult>> => {
|
|
278
|
-
const results = await Promise.all(
|
|
279
|
-
unclaimed.map(async ({ source, query }) => ({ source, nodes: (await graphql<Pick<LiveResult, "unclaimed">>(searchQuery(["unclaimed"]), { unclaimed: query })).unclaimed.nodes })),
|
|
280
|
-
);
|
|
360
|
+
const results = await Promise.all(unclaimed.map(async ({ source, query }) => ({ source, nodes: (await pickable("unclaimed", query)).unclaimed.nodes })));
|
|
281
361
|
return { unclaimed: { nodes: mergeUnclaimed(results) } };
|
|
282
362
|
};
|
|
283
363
|
const merge = (parts: Partial<LiveResult>[]) => Object.assign({}, ...parts) as LiveResult;
|
|
284
364
|
const forDetails = Promise.all([search("mine"), search("assigned"), searchUnclaimed()]);
|
|
285
365
|
const others = Promise.all([search("reviews"), search("mentions"), search("involved"), search("asked")]);
|
|
286
|
-
const afterThem = forDetails.then((parts) => this.details(merge(parts)));
|
|
287
|
-
|
|
288
|
-
|
|
366
|
+
const afterThem = forDetails.then((parts) => this.details(merge(parts), projects, problems));
|
|
367
|
+
try {
|
|
368
|
+
const [first, rest, details] = await Promise.all([forDetails, others, afterThem]);
|
|
369
|
+
if (projects) this.projectsWarning = projectsWarning(problems);
|
|
370
|
+
return { data: merge([...first, ...rest]), details };
|
|
371
|
+
} catch (error) {
|
|
372
|
+
// Another search failing doesn't lose what went wrong with projects so far; it can't say they went well either.
|
|
373
|
+
if (projects && problems.length) this.projectsWarning = projectsWarning(problems);
|
|
374
|
+
throw error;
|
|
375
|
+
}
|
|
289
376
|
}
|
|
290
377
|
|
|
291
378
|
private variables(names: readonly Exclude<SearchName, "unclaimed">[], now: Date): Record<string, string> {
|
|
@@ -293,38 +380,66 @@ export class AttentionService {
|
|
|
293
380
|
return Object.fromEntries(names.map((name) => [name, all[name]]));
|
|
294
381
|
}
|
|
295
382
|
|
|
296
|
-
// Behind counts [UPS-07], required checks [PRS-14]
|
|
297
|
-
|
|
383
|
+
// Behind counts [UPS-07], required checks [PRS-14], issue field option order [NXT-02] and colors [NXT-10], and the Status
|
|
384
|
+
// options of the boards Next up's issues are on [NXT-03].
|
|
385
|
+
private async details(data: Pick<LiveResult, "mine" | "assigned" | "unclaimed">, projects: boolean, problems: string[]): Promise<Details> {
|
|
298
386
|
const prs = data.mine.nodes.filter((pr) => pr?.headRefName && !pr.isCrossRepository);
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
});
|
|
387
|
+
// Priority's colors tint its pill, so its options are asked for even when the config orders it.
|
|
388
|
+
const effort = nextUpField(this.config, "effort");
|
|
389
|
+
const needsOptions = !!nextUpField(this.config, "priority") || (!!effort && !effort.order);
|
|
303
390
|
const issues = [...data.unclaimed.nodes, ...data.assigned.nodes];
|
|
304
391
|
const orgs = needsOptions ? [...new Set(issues.map((issue) => issue?.repository?.nameWithOwner.split("/")[0]).filter(Boolean))] : [];
|
|
305
392
|
const refs = toLookUp(data.mine.nodes.filter((pr) => pr?.repository));
|
|
306
393
|
const mergeStates = this.mergeStates(data.mine.nodes.filter((pr) => pr?.repository));
|
|
307
|
-
const
|
|
308
|
-
|
|
394
|
+
const statuses = projects ? this.projectStatuses(issueBoardIds(issues), problems) : Promise.resolve({});
|
|
395
|
+
const details: Details = { behind: {}, fieldOptions: {}, fieldColors: {}, projectStatuses: {}, issues: {}, checks: {}, mergeState: {} };
|
|
396
|
+
if (prs.length === 0 && orgs.length === 0 && refs.length === 0) return { ...details, mergeState: await mergeStates, projectStatuses: await statuses };
|
|
309
397
|
const { query, compares } = detailsQuery(prs, orgs as string[], refs);
|
|
310
398
|
type Result = {
|
|
311
399
|
ref?: { compare: { behindBy: number } | null } | null;
|
|
312
|
-
issueFields?: { nodes: { name?: string; options?: { name: string }[] }[] };
|
|
400
|
+
issueFields?: { nodes: { name?: string; options?: { name: string; color?: GithubColor }[] }[] };
|
|
313
401
|
issueOrPullRequest?: (LinkedIssue & { state?: string }) | null;
|
|
314
402
|
pullRequest?: { commits: { nodes: { commit: { statusCheckRollup: { contexts: { nodes: CheckContext[] } } | null } }[] } } | null;
|
|
315
403
|
} | null;
|
|
316
404
|
// A reference to a repo I can't see fails only its own field.
|
|
317
405
|
const result = await graphql<Record<string, Result>>(query);
|
|
318
406
|
for (const [alias, value] of Object.entries(result)) {
|
|
407
|
+
// Org fields come back as o0, o1, … in the order the orgs were asked for.
|
|
408
|
+
const org = /^o\d+$/.test(alias) ? (orgs[Number(alias.slice(1))] as string).toLowerCase() : null;
|
|
319
409
|
const behindBy = value?.ref?.compare?.behindBy;
|
|
320
410
|
if (typeof behindBy === "number") details.behind[compares[alias]] = behindBy;
|
|
321
411
|
const contexts = value?.pullRequest?.commits.nodes[0]?.commit.statusCheckRollup?.contexts.nodes;
|
|
322
412
|
if (contexts) details.checks[compares[alias]] = requiredChecks(contexts);
|
|
323
|
-
for (const field of value?.issueFields?.nodes ?? [])
|
|
413
|
+
for (const field of value?.issueFields?.nodes ?? []) {
|
|
414
|
+
if (!org || !field.name || !field.options) continue;
|
|
415
|
+
(details.fieldOptions[org] ??= {})[field.name] = field.options.map((o) => o.name);
|
|
416
|
+
(details.fieldColors[org] ??= {})[field.name] = Object.fromEntries(field.options.flatMap((o) => (o.color ? [[o.name, o.color]] : [])));
|
|
417
|
+
}
|
|
324
418
|
const issue = value?.issueOrPullRequest; // empty for a PR
|
|
325
419
|
if (issue?.state === "OPEN") details.issues[prKey(issue)] = { number: issue.number, title: issue.title, url: issue.url, repository: issue.repository };
|
|
326
420
|
}
|
|
327
|
-
return { ...details, mergeState: await mergeStates };
|
|
421
|
+
return { ...details, mergeState: await mergeStates, projectStatuses: await statuses };
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// Each board's Status options, once per board [NXT-03, GH-01]. A board that can't be read lists no statuses; the whole
|
|
425
|
+
// request failing costs only the filter's statuses, never the refresh.
|
|
426
|
+
// Bounded in time, so it can't hold up the refresh, in size, a batch of boards per request, and in how many go at once.
|
|
427
|
+
private async projectStatuses(ids: string[], problems: string[]): Promise<Details["projectStatuses"]> {
|
|
428
|
+
const batches = Array.from({ length: Math.ceil(ids.length / BOARDS_PER_REQUEST) }, (_, i) => ids.slice(i * BOARDS_PER_REQUEST, (i + 1) * BOARDS_PER_REQUEST));
|
|
429
|
+
const read = async (batch: string[]) => {
|
|
430
|
+
try {
|
|
431
|
+
const { data, errors } = await graphqlResult<ProjectStatusesResult>(projectStatusesQuery(batch), {}, { timeoutMs: PROJECTS_SEARCH_TIMEOUT_MS });
|
|
432
|
+
if (errors.length) problems.push(errors.join("; "));
|
|
433
|
+
return batch.flatMap((id, index) => (data?.[`b${index}`]?.field?.options ? [[id, data[`b${index}`]!.field!.options!] as const] : []));
|
|
434
|
+
} catch (error) {
|
|
435
|
+
problems.push((error as Error).message);
|
|
436
|
+
return [];
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
const results: Awaited<ReturnType<typeof read>>[] = [];
|
|
440
|
+
for (let at = 0; at < batches.length; at += BOARD_BATCHES_AT_ONCE) results.push(...(await Promise.all(batches.slice(at, at + BOARD_BATCHES_AT_ONCE).map(read))));
|
|
441
|
+
if (problems.length) console.error("Reading projects:", problems.join("; "));
|
|
442
|
+
return Object.fromEntries(results.flat());
|
|
328
443
|
}
|
|
329
444
|
|
|
330
445
|
// My PRs' merge state, a few per request in parallel, as GitHub only works it out for a few at a time; search's answer
|
|
@@ -396,6 +511,7 @@ export class AttentionService {
|
|
|
396
511
|
feeds: { live: status("live"), history: status("history") },
|
|
397
512
|
scopes: this.state.scopes,
|
|
398
513
|
sources: this.state.sources,
|
|
514
|
+
projectFilter: this.state.projectFilter,
|
|
399
515
|
config: this.config,
|
|
400
516
|
pending: Object.keys(pending).length,
|
|
401
517
|
...(FIXTURE ? { fixtureAgents: FIXTURE_AGENTS } : {}),
|
package/server/store.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { mkdir, readFile, rename, stat, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import type
|
|
5
|
+
import { type Attention, type Item, type SectionId, SECTIONS } from "../shared/attention";
|
|
6
6
|
import { AttentionConfig, FIELD_ROLES, type FieldRole, sameField } from "../shared/config";
|
|
7
7
|
import type { Pending } from "./view";
|
|
8
8
|
|
|
@@ -14,6 +14,8 @@ const OLD_DIR = join(homedir(), ".config", "paseo-github-attention");
|
|
|
14
14
|
const CONFIG = join(DIR, "config.json");
|
|
15
15
|
const STATE = join(DIR, "state.json");
|
|
16
16
|
|
|
17
|
+
const knownSections = (items: unknown): boolean => Array.isArray(items) && items.every((item) => Object.hasOwn(SECTIONS, (item as Item)?.section));
|
|
18
|
+
|
|
17
19
|
export const State = z.object({
|
|
18
20
|
// Item key -> others' activity and section when dismissed [ATT-08].
|
|
19
21
|
dismissed: z.record(z.string(), z.object({ at: z.string(), section: z.custom<SectionId>() })).default({}),
|
|
@@ -23,16 +25,25 @@ export const State = z.object({
|
|
|
23
25
|
scopes: z.array(z.string()).default([]),
|
|
24
26
|
// Sources ticked in Next up's filter; none means all [NXT-09].
|
|
25
27
|
sources: z.array(z.string()).default([]),
|
|
28
|
+
// Project statuses ticked in Next up's filter; none means all [NXT-03].
|
|
29
|
+
projectFilter: z.array(z.string()).default([]),
|
|
26
30
|
// The update notice put off with Not now, by the version it offered [UPD-01].
|
|
27
31
|
skippedUpdate: z.string().nullable().default(null).catch(null),
|
|
28
32
|
// My Paseo projects' GitHub repos when last listed, for refreshes before the app has connected [NXT-08].
|
|
29
33
|
projectRepos: z.array(z.string()).default([]),
|
|
30
|
-
// The last fetch of each feed. A cache from an older version is dropped rather than shown wrong
|
|
34
|
+
// The last fetch of each feed. A cache from an older version is dropped rather than shown wrong, like one with an item in a
|
|
35
|
+
// section that's gone (Waiting too long was one) [ATT-11].
|
|
31
36
|
live: z
|
|
32
|
-
.object({
|
|
37
|
+
.object({
|
|
38
|
+
fetchedAt: z.string(),
|
|
39
|
+
attention: z.custom<Attention>(
|
|
40
|
+
(value) =>
|
|
41
|
+
knownSections((value as Attention)?.items) && (value as Attention).unclaimed?.every?.((issue) => Array.isArray(issue.sources) && Array.isArray(issue.openPrs)),
|
|
42
|
+
),
|
|
43
|
+
})
|
|
33
44
|
.nullable()
|
|
34
45
|
.catch(null),
|
|
35
|
-
history: z.object({ fetchedAt: z.string(), items: z.custom<Item[]>(
|
|
46
|
+
history: z.object({ fetchedAt: z.string(), items: z.custom<Item[]>(knownSections) }).nullable().catch(null),
|
|
36
47
|
});
|
|
37
48
|
export type State = z.infer<typeof State>;
|
|
38
49
|
|
package/server/view.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface ViewMeta {
|
|
|
7
7
|
feeds: Record<FeedId, FeedStatus>;
|
|
8
8
|
scopes: string[];
|
|
9
9
|
sources: string[];
|
|
10
|
+
projectFilter: string[];
|
|
10
11
|
config: AttentionConfig;
|
|
11
12
|
pending: number;
|
|
12
13
|
}
|
|
@@ -94,7 +95,7 @@ export function isDismissed(item: Item, dismissed: State["dismissed"]): boolean
|
|
|
94
95
|
|
|
95
96
|
// Waiting by who it waits on, so I know whom to nudge: whoever blocks the most first, ties by the longest wait, then bots, who
|
|
96
97
|
// can't be nudged, and last the work no person holds up. Each one's work oldest first; the screen lifts work with an active
|
|
97
|
-
// session.
|
|
98
|
+
// session. My PRs in Doing that wait on whom I asked are here too, so nudging them is one list [WAI-01, WAI-03, PRS-15].
|
|
98
99
|
export function waitingGroups(items: Item[]): WaitingGroup[] {
|
|
99
100
|
const oldest = (list: Item[]) => list.map((item) => item.wait?.since ?? "").sort()[0] ?? "";
|
|
100
101
|
const people = new Map<string, WaitingGroup>();
|
|
@@ -122,6 +123,9 @@ export function waitingGroups(items: Item[]): WaitingGroup[] {
|
|
|
122
123
|
return nobody.length ? [...groups, { items: nobody.sort(byWait) }] : groups;
|
|
123
124
|
}
|
|
124
125
|
|
|
126
|
+
// Waiting's work: its own sections, and my PRs in Doing while they wait on someone I asked [WAI-01, PRS-15].
|
|
127
|
+
const inWaiting = (item: Item) => SECTIONS[item.section].tab === "waiting" || (SECTIONS[item.section].tab === "doing" && !!item.wait && !!item.waitingOn?.length);
|
|
128
|
+
|
|
125
129
|
export function buildView(attention: Attention | null, history: Item[], dismissed: State["dismissed"], meta: ViewMeta): AttentionView {
|
|
126
130
|
const items = [...(attention?.items ?? []), ...history];
|
|
127
131
|
const visible = items.filter((item) => !isDismissed(item, dismissed));
|
|
@@ -135,11 +139,12 @@ export function buildView(attention: Attention | null, history: Item[], dismisse
|
|
|
135
139
|
login: attention?.login ?? null,
|
|
136
140
|
count: doing.reduce((sum, section) => sum + section.items.length, 0),
|
|
137
141
|
doing,
|
|
138
|
-
waiting: waitingGroups(visible.filter(
|
|
142
|
+
waiting: waitingGroups(visible.filter(inWaiting)),
|
|
139
143
|
history: visible.filter((item) => SECTIONS[item.section].tab === "history"),
|
|
140
144
|
assigned: attention?.assigned ?? [],
|
|
141
145
|
unclaimed: attention?.unclaimed ?? [],
|
|
142
146
|
unclaimedFrom: attention?.unclaimedFrom ?? "config",
|
|
147
|
+
projects: attention?.projects ?? [],
|
|
143
148
|
dismissedCount: items.length - visible.length,
|
|
144
149
|
};
|
|
145
150
|
}
|
package/shared/attention.ts
CHANGED
|
@@ -19,7 +19,6 @@ export const SECTIONS = {
|
|
|
19
19
|
changes: { tab: "doing", title: "Changes requested" },
|
|
20
20
|
ready: { tab: "doing", title: "Ready to merge" },
|
|
21
21
|
upstream: { tab: "doing", title: "Needs upstream" },
|
|
22
|
-
too_long: { tab: "doing", title: "Waiting too long" },
|
|
23
22
|
// Nobody has the next move until I ask someone [PRS-12].
|
|
24
23
|
needs_reviewer: { tab: "doing", title: "Needs a reviewer" },
|
|
25
24
|
drafts: { tab: "doing", title: "My drafts" },
|
|
@@ -58,7 +57,9 @@ export interface Chip {
|
|
|
58
57
|
text: string;
|
|
59
58
|
tone: "good" | "bad" | "warn" | "neutral";
|
|
60
59
|
// In place of the dot, where a picture says it better.
|
|
61
|
-
icon?: "thumbUp";
|
|
60
|
+
icon?: "thumbUp" | "hourglass";
|
|
61
|
+
// What it means in words, on hover and to screen readers [ATT-11, ATT-19].
|
|
62
|
+
hint?: string;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
export type PersonRole = "author" | "changes";
|
|
@@ -88,14 +89,16 @@ export interface WaitingOn {
|
|
|
88
89
|
since: string;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
// What my
|
|
92
|
+
// What my work waits for: on items in Waiting, and on my PRs in Doing that wait on reviewers too, which Waiting lists as
|
|
93
|
+
// well [WAI-01, PRS-15].
|
|
92
94
|
export interface Wait {
|
|
93
95
|
// In a word or two: "review", "re-review", "question". None where the chips already say, like blocked by repo rules.
|
|
94
96
|
reason?: string;
|
|
95
97
|
// Since I asked, tagged, pushed or replied.
|
|
96
98
|
since: string;
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
+
// Waited at least waitingTooLongDays, where nudging is fair: not while the next step is mine, like failing CI, conflicts,
|
|
100
|
+
// changes to make or a reply I owe, nor while CI runs [ATT-11].
|
|
101
|
+
tooLong?: boolean;
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
// Waiting's work under someone it waits on, longest wait first; the last group, without anyone, is work no person holds up.
|
|
@@ -172,6 +175,12 @@ export function checkoutPr(kind: SessionKind, target: Pick<Target, "number" | "h
|
|
|
172
175
|
return kind === "review" && top && target.stack!.length > 1 ? { number: top.number, head: top.head } : { number: target.number, head: target.headRefName };
|
|
173
176
|
}
|
|
174
177
|
|
|
178
|
+
// The name of a session and its new workspace; a review says so, apart from work on my own PRs [SES-09].
|
|
179
|
+
export function sessionTitle(kind: SessionKind, target: Pick<Target, "kind" | "number" | "title">): string {
|
|
180
|
+
const item = `${target.kind === "pr" ? "PR" : "Issue"} ${target.number}: ${target.title}`;
|
|
181
|
+
return (kind === "review" ? `Review ${item}` : item).slice(0, 120);
|
|
182
|
+
}
|
|
183
|
+
|
|
175
184
|
export interface SubRow {
|
|
176
185
|
key: string;
|
|
177
186
|
number: number;
|
|
@@ -194,7 +203,7 @@ export interface Item {
|
|
|
194
203
|
url: string;
|
|
195
204
|
chips: Chip[];
|
|
196
205
|
person?: Person;
|
|
197
|
-
// Waiting and
|
|
206
|
+
// Whom it waits on: in Waiting, and on my PRs in Doing whom I asked that hasn't reviewed yet [WAI-02, PRS-15].
|
|
198
207
|
waitingOn?: WaitingOn[];
|
|
199
208
|
wait?: Wait;
|
|
200
209
|
actions: ActionId[];
|
|
@@ -211,6 +220,38 @@ export interface Item {
|
|
|
211
220
|
notPlanned?: true;
|
|
212
221
|
}
|
|
213
222
|
|
|
223
|
+
// The colors GitHub lets an org give issue field options and a project its Status options. GRAY is what nothing chosen looks
|
|
224
|
+
// like, so it's shown untinted [NXT-10].
|
|
225
|
+
export type GithubColor = "GRAY" | "BLUE" | "GREEN" | "YELLOW" | "ORANGE" | "RED" | "PINK" | "PURPLE";
|
|
226
|
+
|
|
227
|
+
// An open project an issue is on, with its place on the board's built-in Status field [NXT-12].
|
|
228
|
+
export interface IssueProject {
|
|
229
|
+
id: string;
|
|
230
|
+
title: string;
|
|
231
|
+
status?: string;
|
|
232
|
+
color?: GithubColor;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// An open project Next up's issues are on, with every option of its Status field in the board's order, for the filter [NXT-03].
|
|
236
|
+
export interface ProjectInfo {
|
|
237
|
+
id: string;
|
|
238
|
+
title: string;
|
|
239
|
+
statuses: { name: string; color: GithubColor }[];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Whether Next up can read projects, and if not, why and how to fix it, for Settings [NXT-12]. Without them Next up just
|
|
243
|
+
// leaves projects out.
|
|
244
|
+
export interface ProjectsAccess {
|
|
245
|
+
// missing: the token lacks read:project; failed: GitHub refused or didn't answer for another reason; unknown: not asked yet.
|
|
246
|
+
state: "on" | "missing" | "failed" | "unknown";
|
|
247
|
+
// GitHub's own words when it failed for another reason, like an org's SSO.
|
|
248
|
+
error?: string;
|
|
249
|
+
// What went wrong reading them on the last refresh while they're on, like boards an org's SSO hides, in GitHub's words.
|
|
250
|
+
warning?: string;
|
|
251
|
+
// Where gh's token comes from: its own login, which `gh auth refresh` can widen, or an environment variable it reads first.
|
|
252
|
+
token: "gh" | "GH_TOKEN" | "GITHUB_TOKEN";
|
|
253
|
+
}
|
|
254
|
+
|
|
214
255
|
// An issue to pick up: assigned to me [NXT-06] or nobody [NXT-01].
|
|
215
256
|
export interface NextUpIssue {
|
|
216
257
|
key: string;
|
|
@@ -228,6 +269,11 @@ export interface NextUpIssue {
|
|
|
228
269
|
sources: string[];
|
|
229
270
|
// Its priority's place in the field's order, 0 first; missing when unknown [NXT-02].
|
|
230
271
|
priorityRank?: number;
|
|
272
|
+
// The color the org gave its priority option; missing when the org colored none, so the card falls back on rank [NXT-10].
|
|
273
|
+
priorityColor?: GithubColor;
|
|
274
|
+
// The open projects it's on [NXT-12]. Missing when projects can't be read, or when GitHub cut its list short with none open
|
|
275
|
+
// in what came: then which boards it's on is unknown, so it's neither on one nor on none.
|
|
276
|
+
projects?: IssueProject[];
|
|
231
277
|
// Open PRs that close it: someone may already be on it [NXT-10].
|
|
232
278
|
openPrs: { number: number; url: string; author: string | null }[];
|
|
233
279
|
}
|
|
@@ -258,6 +304,8 @@ export interface Attention {
|
|
|
258
304
|
assigned: NextUpIssue[];
|
|
259
305
|
unclaimed: NextUpIssue[];
|
|
260
306
|
unclaimedFrom?: UnclaimedSource;
|
|
307
|
+
// The projects Next up's issues are on, for its filter [NXT-03, NXT-12].
|
|
308
|
+
projects?: ProjectInfo[];
|
|
261
309
|
// Repo -> who reviewed or was asked on my PRs there, latest first, for the reviewer picker [PRS-12].
|
|
262
310
|
reviewers?: Record<string, Reviewer[]>;
|
|
263
311
|
}
|
|
@@ -331,14 +379,32 @@ export interface AttentionView {
|
|
|
331
379
|
assigned: NextUpIssue[];
|
|
332
380
|
unclaimed: NextUpIssue[];
|
|
333
381
|
unclaimedFrom: UnclaimedSource;
|
|
382
|
+
// The projects Next up's issues are on [NXT-03, NXT-12].
|
|
383
|
+
projects: ProjectInfo[];
|
|
334
384
|
dismissedCount: number;
|
|
335
385
|
// Scopes ticked in Next up's filter; none means all [NXT-03].
|
|
336
386
|
scopes: string[];
|
|
337
387
|
// Sources ticked in Next up's filter; none means all [NXT-09].
|
|
338
388
|
sources: string[];
|
|
389
|
+
// Project statuses ticked in Next up's filter, as projectFilterId makes them; none means all [NXT-03].
|
|
390
|
+
projectFilter: string[];
|
|
339
391
|
config: AttentionConfig;
|
|
340
392
|
// Changes I just made that GitHub's search hasn't caught up with; the app checks back sooner while there are any [FRESH-02].
|
|
341
393
|
pending: number;
|
|
342
394
|
// Fixture mode only: made-up sessions, since the preview daemon has no agents.
|
|
343
395
|
fixtureAgents?: AgentSummary[];
|
|
344
396
|
}
|
|
397
|
+
|
|
398
|
+
// What a tick in Next up's project filter stands for: one status of one project, a project's issues without a status, or
|
|
399
|
+
// issues on no project [NXT-03].
|
|
400
|
+
export function projectFilterId(project: { id: string } | null, status?: string | null): string {
|
|
401
|
+
if (!project) return "noproject";
|
|
402
|
+
return status ? `status:${project.id}:${status}` : `nostatus:${project.id}`;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// The ticks an issue answers to: one per project it's on, or "noproject". None when its projects are unknown, so a project
|
|
406
|
+
// filter hides it rather than call it on no project.
|
|
407
|
+
export function projectFilterIds(issue: Pick<NextUpIssue, "projects">): string[] {
|
|
408
|
+
if (!issue.projects) return [];
|
|
409
|
+
return issue.projects.length ? issue.projects.map((project) => projectFilterId(project, project.status)) : [projectFilterId(null)];
|
|
410
|
+
}
|
package/shared/hint.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Where a hint goes, from window coordinates: its content spans [x, x + width], and the area it may spread in [left, right]
|
|
2
|
+
// (a card's text column, which clips what runs past). Beside the content where there's room, else above it, never past the
|
|
3
|
+
// area's edges [ATT-19].
|
|
4
|
+
|
|
5
|
+
export const HINT_GAP = 8;
|
|
6
|
+
// Less room than this beside the content, and the hint goes above it instead.
|
|
7
|
+
export const HINT_MIN_WIDTH = 160;
|
|
8
|
+
|
|
9
|
+
export type HintPlacement =
|
|
10
|
+
| { side: "beside"; width: number }
|
|
11
|
+
// offset: from the content's left edge; negative where it shifts left to make room.
|
|
12
|
+
| { side: "above"; width: number; offset: number };
|
|
13
|
+
|
|
14
|
+
export function hintPlacement(x: number, width: number, left: number, right: number): HintPlacement {
|
|
15
|
+
const beside = right - (x + width) - HINT_GAP;
|
|
16
|
+
if (beside >= HINT_MIN_WIDTH) return { side: "beside", width: beside };
|
|
17
|
+
// From the content's left edge to the area's right; where that's too narrow, as wide as needed by shifting left, but never
|
|
18
|
+
// wider than the area.
|
|
19
|
+
const span = Math.min(Math.max(HINT_MIN_WIDTH, right - x), right - left);
|
|
20
|
+
return { side: "above", width: span, offset: Math.min(0, right - span - x) };
|
|
21
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Only the newest of several pending opens may go through: tapping another card while one waits for its details supersedes
|
|
2
|
+
// it, so two sheets never open on top of each other whichever request finishes first [ATT-06].
|
|
3
|
+
export class LatestOnly {
|
|
4
|
+
private current: { id: number; cancel: () => void } | null = null;
|
|
5
|
+
private next = 0;
|
|
6
|
+
|
|
7
|
+
// Something else took over, like an action that opens its own sheet: whatever was waiting to open won't.
|
|
8
|
+
cancel(): void {
|
|
9
|
+
this.current?.cancel();
|
|
10
|
+
this.current = null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// A new pending open; the one before it, if still waiting, is cancelled.
|
|
14
|
+
start(cancel: () => void): PendingOpen {
|
|
15
|
+
this.current?.cancel();
|
|
16
|
+
const id = ++this.next;
|
|
17
|
+
this.current = { id, cancel };
|
|
18
|
+
return {
|
|
19
|
+
isCurrent: () => this.current?.id === id,
|
|
20
|
+
// It opened, or its card went away: nothing is pending any more.
|
|
21
|
+
done: () => {
|
|
22
|
+
if (this.current?.id === id) this.current = null;
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PendingOpen {
|
|
29
|
+
isCurrent: () => boolean;
|
|
30
|
+
done: () => void;
|
|
31
|
+
}
|
package/shared/rpc.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineRpc } from "@getpaseo/plugin";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import type { AttentionView, ItemDetails, ReviewerChoices, Target } from "./attention";
|
|
3
|
+
import type { AttentionView, ItemDetails, ProjectsAccess, ReviewerChoices, Target } from "./attention";
|
|
4
4
|
import { SessionKind } from "./config";
|
|
5
5
|
import type { ConfigStatus, CoverageCheck, IssueField, SetupStatus } from "./setup";
|
|
6
6
|
import type { FeedbackInfo } from "./feedback";
|
|
@@ -39,6 +39,10 @@ export const myOrgs = defineRpc({ name: "config.my-orgs", input: z.object({}), o
|
|
|
39
39
|
// Remember the scopes and sources ticked in Next up's filter [NXT-03, NXT-09].
|
|
40
40
|
export const setScopes = defineRpc({ name: "next-up.scopes", input: z.object({ scopes: z.array(z.string()) }), output: done });
|
|
41
41
|
export const setSources = defineRpc({ name: "next-up.sources", input: z.object({ sources: z.array(z.string()) }), output: done });
|
|
42
|
+
// And the project statuses [NXT-03].
|
|
43
|
+
export const setProjectFilter = defineRpc({ name: "next-up.projects", input: z.object({ projects: z.array(z.string()) }), output: done });
|
|
44
|
+
// Whether the gh login may read projects, asked again now, for Settings [NXT-12].
|
|
45
|
+
export const projectsAccess = defineRpc({ name: "config.projects-access", input: z.object({}), output: z.custom<ProjectsAccess>() });
|
|
42
46
|
|
|
43
47
|
// GitHub changes, each from an explicit tap [SAFE-01], answered with the list after it.
|
|
44
48
|
// `key` is the card it was done from, which shows the change until GitHub's search does [FRESH-02].
|
|
Binary file
|