@andrioid/paseo-attention-span 0.6.0 → 0.7.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/OVERVIEW.md +3 -1
- package/client/attention-screen.tsx +61 -1174
- package/client/coverage-settings.tsx +5 -4
- package/client/data.ts +4 -2
- package/client/feedback.tsx +21 -25
- package/client/history.tsx +12 -50
- package/client/item-actions.ts +387 -0
- package/client/item-row.tsx +450 -0
- package/client/new-issue.tsx +244 -0
- package/client/next-up.tsx +22 -183
- package/client/pickers.tsx +238 -0
- package/client/session-menu.ts +3 -11
- package/client/sessions.ts +58 -57
- package/client/setup.tsx +2 -1
- package/client/sheet.tsx +92 -15
- package/client/ui.tsx +23 -14
- package/client/wrap-up.tsx +151 -85
- package/docs/architecture.md +24 -13
- 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-wrap-dirty.png +0 -0
- package/docs/screenshots/desktop-dark-doing-wrap-multi.png +0 -0
- package/docs/screenshots/desktop-dark-doing-wrap.png +0 -0
- package/docs/screenshots/desktop-dark-doing.png +0 -0
- package/docs/screenshots/desktop-dark-history-filtered.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-dark-history.png +0 -0
- package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
- package/index.client.tsx +19 -0
- package/index.server.ts +43 -26
- package/package.json +2 -1
- package/requirements.yaml +10 -3
- package/server/actions.ts +2 -1
- package/server/archive.ts +146 -67
- package/server/archived.ts +12 -16
- package/server/changes.ts +34 -54
- package/server/classify.ts +157 -139
- package/server/context.ts +95 -3
- package/server/feedback.ts +2 -6
- package/server/fetch.ts +262 -0
- package/server/fixture.ts +88 -14
- package/server/github-types.ts +5 -2
- package/server/markdown.ts +3 -1
- package/server/port.ts +46 -0
- package/server/queries.ts +34 -24
- package/server/service.ts +155 -272
- package/server/setup.ts +15 -14
- package/server/store.ts +94 -80
- package/server/update.ts +34 -13
- package/server/view.ts +16 -15
- package/shared/archive.ts +116 -13
- package/shared/attention.ts +63 -18
- package/shared/changes.ts +2 -1
- package/shared/config.ts +2 -6
- package/shared/drafting.ts +17 -0
- package/shared/feedback.ts +6 -5
- package/shared/format.ts +2 -1
- package/shared/history-report.ts +2 -1
- package/shared/item-sessions.ts +76 -0
- package/shared/item-view.ts +224 -0
- package/shared/linked-sessions.ts +59 -8
- package/shared/names.ts +17 -0
- package/shared/new-issue.ts +129 -0
- package/shared/next-up-filter.ts +137 -0
- package/shared/paging.ts +16 -0
- package/shared/prompts.ts +39 -22
- package/shared/rpc.ts +23 -10
- package/shared/setup.ts +3 -1
- package/shared/wrap-up.ts +20 -23
package/server/queries.ts
CHANGED
|
@@ -33,7 +33,7 @@ const SEARCHES = {
|
|
|
33
33
|
ended: {
|
|
34
34
|
first: 50,
|
|
35
35
|
nodes: `... on PullRequest {
|
|
36
|
-
id number title url merged mergedAt closedAt repository { nameWithOwner } mergedBy { login }
|
|
36
|
+
id number title url headRefName merged mergedAt closedAt repository { nameWithOwner } mergedBy { login }
|
|
37
37
|
assignees(first: 10) { nodes { login } }
|
|
38
38
|
timelineItems(itemTypes: [CLOSED_EVENT], last: 1) { nodes { ... on ClosedEvent { createdAt actor { login } } } }
|
|
39
39
|
}`,
|
|
@@ -46,10 +46,10 @@ const SEARCHES = {
|
|
|
46
46
|
timelineItems(itemTypes: [CLOSED_EVENT], last: 1) { nodes { ... on ClosedEvent { createdAt actor { login } } } }
|
|
47
47
|
}`,
|
|
48
48
|
},
|
|
49
|
-
// Who merged it, when it wasn't me [HIS-05].
|
|
49
|
+
// Who merged it, when it wasn't me [HIS-05]; its branch, so a session left on it finds its way to Wrap up [ATT-22].
|
|
50
50
|
merged: {
|
|
51
51
|
first: 100,
|
|
52
|
-
nodes: "... on PullRequest { number title url body mergedAt mergedBy { login } repository { nameWithOwner } labels(first: 20) { nodes { name } } closingIssuesReferences(first: 3) { nodes { number repository { nameWithOwner } } } }",
|
|
52
|
+
nodes: "... on PullRequest { number title url headRefName body mergedAt mergedBy { login } repository { nameWithOwner } labels(first: 20) { nodes { name } } closingIssuesReferences(first: 3) { nodes { number repository { nameWithOwner } } } }",
|
|
53
53
|
},
|
|
54
54
|
// Who merged someone else's PR I reviewed, for the week's Changed by others copy and Wrap up [HIS-02, ATT-22].
|
|
55
55
|
reviewed: { first: 100, nodes: "... on PullRequest { number title url mergedAt mergedBy { login } repository { nameWithOwner } author { ...author } labels(first: 20) { nodes { name } } }" },
|
|
@@ -61,8 +61,7 @@ const SEARCHES = {
|
|
|
61
61
|
};
|
|
62
62
|
export type SearchName = keyof typeof SEARCHES;
|
|
63
63
|
|
|
64
|
-
//
|
|
65
|
-
export const LIVE_SEARCHES = ["mine", "reviews", "mentions", "involved", "asked", "assigned", "unclaimed", "ended", "closedIssues"] as const;
|
|
64
|
+
// History's searches, on their own, slower schedule; the live ones are sent by the service, one request each.
|
|
66
65
|
export const HISTORY_SEARCHES = ["merged", "reviewed", "closed"] as const;
|
|
67
66
|
|
|
68
67
|
const FRAGMENTS: Record<string, string> = {
|
|
@@ -102,7 +101,7 @@ const FRAGMENTS: Record<string, string> = {
|
|
|
102
101
|
closingIssuesReferences(first: 5) { nodes { number title url repository { nameWithOwner } } }
|
|
103
102
|
commits(last: 1) { nodes { commit { committedDate statusCheckRollup { state } } } }
|
|
104
103
|
reviewRequests(first: 5) { nodes { requestedReviewer { ... on User { ...author } ... on Bot { ...author } ... on Team { __typename combinedSlug avatarUrl } } } }
|
|
105
|
-
latestReviews(first: 10) { nodes { author { ...author } state submittedAt } }
|
|
104
|
+
latestReviews(first: 10) { nodes { author { ...author } state submittedAt commit { oid } } }
|
|
106
105
|
reviewThreads(last: 30) {
|
|
107
106
|
nodes {
|
|
108
107
|
isResolved
|
|
@@ -141,16 +140,30 @@ function where(orgs: string[], repos: string[]): string {
|
|
|
141
140
|
|
|
142
141
|
const isoDate = (date: Date) => date.toISOString().slice(0, 10);
|
|
143
142
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return
|
|
143
|
+
// How far `timeZone`'s clock is ahead of UTC at `at`, in ms.
|
|
144
|
+
function zoneOffset(at: number, timeZone: string): number {
|
|
145
|
+
const format = new Intl.DateTimeFormat("en-US", { timeZone, hourCycle: "h23", year: "numeric", month: "numeric", day: "numeric", hour: "numeric", minute: "numeric", second: "numeric" });
|
|
146
|
+
const part = Object.fromEntries(format.formatToParts(at).map(({ type, value }) => [type, Number(value)]));
|
|
147
|
+
return Date.UTC(part.year, part.month - 1, part.day, part.hour, part.minute, part.second) - Math.floor(at / 1000) * 1000;
|
|
149
148
|
}
|
|
150
149
|
|
|
151
|
-
// Where History starts:
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
// Where History starts: midnight on the oldest week's Monday in the device's time zone, so the server's weeks are the
|
|
151
|
+
// screen's and the oldest isn't cut short [HIS-01]. UTC until a device has sent its zone.
|
|
152
|
+
export function historySince(now: Date, weeks: number, timeZone = "UTC"): string {
|
|
153
|
+
const local = new Date(now.getTime() + zoneOffset(now.getTime(), timeZone));
|
|
154
|
+
const monday = Date.UTC(local.getUTCFullYear(), local.getUTCMonth(), local.getUTCDate() - ((local.getUTCDay() + 6) % 7) - 7 * (weeks - 1));
|
|
155
|
+
// The offset at that midnight, which a daylight saving change since may have moved.
|
|
156
|
+
return new Date(monday - zoneOffset(monday - zoneOffset(monday, timeZone), timeZone)).toISOString();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// A time zone this server's Intl knows [HIS-01].
|
|
160
|
+
export function isTimeZone(name: string): boolean {
|
|
161
|
+
try {
|
|
162
|
+
new Intl.DateTimeFormat("en-US", { timeZone: name });
|
|
163
|
+
return true;
|
|
164
|
+
} catch {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
154
167
|
}
|
|
155
168
|
|
|
156
169
|
// Where Next up looks for unclaimed issues [NXT-04, NXT-08]: one search per chosen source, so each issue says which
|
|
@@ -195,10 +208,11 @@ export function mergeUnclaimed(results: { source: string | null; nodes: (Pickabl
|
|
|
195
208
|
}
|
|
196
209
|
|
|
197
210
|
// The searches about me. Next up's unclaimed issues have their own [NXT-04].
|
|
198
|
-
export function searchVariables(config: AttentionConfig, now: Date): Record<Exclude<SearchName, "unclaimed">, string> {
|
|
211
|
+
export function searchVariables(config: AttentionConfig, now: Date, timeZone?: string): Record<Exclude<SearchName, "unclaimed">, string> {
|
|
199
212
|
const scope = where(config.orgs, config.repos);
|
|
200
213
|
const since = isoDate(new Date(now.getTime() - config.mentionDays * 86_400_000));
|
|
201
|
-
|
|
214
|
+
// To the second: GitHub reads a bare date as UTC midnight.
|
|
215
|
+
const history = `${historySince(now, config.historyWeeks, timeZone).slice(0, 19)}+00:00`;
|
|
202
216
|
return {
|
|
203
217
|
mine: `is:pr is:open author:@me ${scope}`,
|
|
204
218
|
// By name only, not via a team [REV-01].
|
|
@@ -316,14 +330,10 @@ export function issueFieldsQuery(orgs: string[]): string {
|
|
|
316
330
|
// in search and in a repo's PR list. Seen on 2026-11-04 [PRS-13].
|
|
317
331
|
export const MERGE_STATE_BATCH = 5;
|
|
318
332
|
|
|
319
|
-
// The merge state of up to MERGE_STATE_BATCH PRs, in one request
|
|
320
|
-
export function mergeStateQuery(prs: PullRequestNode[]):
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
keys[`m${index}`] = prKey(pr);
|
|
324
|
-
return `m${index}: ${repository(pr.repository.nameWithOwner)} { pullRequest(number: ${pr.number}) { mergeStateStatus } }`;
|
|
325
|
-
});
|
|
326
|
-
return { query: `query MergeState {\n${fields.join("\n")}\n}`, keys };
|
|
333
|
+
// The merge state of up to MERGE_STATE_BATCH PRs, in one request, as m0, m1, … in the order given.
|
|
334
|
+
export function mergeStateQuery(prs: PullRequestNode[]): string {
|
|
335
|
+
const fields = prs.map((pr, index) => `m${index}: ${repository(pr.repository.nameWithOwner)} { pullRequest(number: ${pr.number}) { mergeStateStatus } }`);
|
|
336
|
+
return `query MergeState {\n${fields.join("\n")}\n}`;
|
|
327
337
|
}
|
|
328
338
|
|
|
329
339
|
export type CheckContext = { status?: string; conclusion?: string | null; state?: string; isRequired?: boolean };
|