ticketlens 0.1.8 → 0.1.9
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/package.json
CHANGED
|
@@ -8,12 +8,12 @@ const ISSUE_FIELDS = `
|
|
|
8
8
|
description
|
|
9
9
|
state { name }
|
|
10
10
|
priority
|
|
11
|
-
assignee { name
|
|
12
|
-
creator { name
|
|
11
|
+
assignee { name email }
|
|
12
|
+
creator { name email }
|
|
13
13
|
createdAt
|
|
14
14
|
updatedAt
|
|
15
15
|
labels { nodes { name } }
|
|
16
|
-
comments { nodes { body createdAt user { name
|
|
16
|
+
comments { nodes { body createdAt user { name email } } }
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -26,15 +26,15 @@ export function normalizeLinearIssue(raw) {
|
|
|
26
26
|
type: 'Issue',
|
|
27
27
|
status: raw.state?.name ?? null,
|
|
28
28
|
priority: PRIORITY_LABELS[raw.priority] ?? null,
|
|
29
|
-
assignee: raw.assignee?.
|
|
30
|
-
reporter: raw.creator?.
|
|
29
|
+
assignee: raw.assignee?.name ?? null,
|
|
30
|
+
reporter: raw.creator?.name ?? null,
|
|
31
31
|
description: raw.description ?? null,
|
|
32
32
|
created: raw.createdAt ?? null,
|
|
33
33
|
updated: raw.updatedAt ?? null,
|
|
34
34
|
labels: (raw.labels?.nodes ?? []).map(l => l.name),
|
|
35
35
|
components: [],
|
|
36
36
|
comments: (raw.comments?.nodes ?? []).map(c => ({
|
|
37
|
-
author: c.user?.
|
|
37
|
+
author: c.user?.name ?? null,
|
|
38
38
|
authorAccountId: null,
|
|
39
39
|
authorName: c.user?.name ?? null,
|
|
40
40
|
body: c.body ?? '',
|
|
@@ -52,7 +52,7 @@ async function gql(query, variables, { token, fetcher, signal }) {
|
|
|
52
52
|
Authorization: `Bearer ${token}`,
|
|
53
53
|
'Content-Type': 'application/json',
|
|
54
54
|
},
|
|
55
|
-
body: JSON.stringify({ query, variables }),
|
|
55
|
+
body: JSON.stringify(Object.keys(variables).length ? { query, variables } : { query }),
|
|
56
56
|
signal,
|
|
57
57
|
});
|
|
58
58
|
if (!res.ok) {
|
|
@@ -92,12 +92,12 @@ export function createLinearAdapter(conn, { fetcher = globalThis.fetch } = {}) {
|
|
|
92
92
|
async fetchCurrentUser(opts = {}) {
|
|
93
93
|
const signal = AbortSignal.timeout(opts.timeoutMs ?? 10_000);
|
|
94
94
|
const data = await gql(
|
|
95
|
-
`query Me { viewer { name
|
|
95
|
+
`query Me { viewer { name email } }`,
|
|
96
96
|
{},
|
|
97
97
|
{ token, fetcher, signal },
|
|
98
98
|
);
|
|
99
99
|
const v = data.viewer;
|
|
100
|
-
return { displayName: v.
|
|
100
|
+
return { displayName: v.name, email: v.email ?? null };
|
|
101
101
|
},
|
|
102
102
|
|
|
103
103
|
async searchTickets(_query, opts = {}) {
|
|
@@ -40,9 +40,14 @@ export function createSession(conn, { stream = process.stderr } = {}) {
|
|
|
40
40
|
const profileLabel = conn.profileName || 'default';
|
|
41
41
|
const userLabel = conn.email || (conn.pat ? 'token auth' : 'unknown');
|
|
42
42
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
:
|
|
43
|
+
const trackerName = hostname.includes('linear.app') ? 'Linear'
|
|
44
|
+
: hostname.includes('github.com') ? 'GitHub'
|
|
45
|
+
: 'Jira';
|
|
46
|
+
const jiraLabel = (trackerName !== 'Jira')
|
|
47
|
+
? trackerName
|
|
48
|
+
: conn.profileName
|
|
49
|
+
? conn.profileName.charAt(0).toUpperCase() + conn.profileName.slice(1) + ' Jira'
|
|
50
|
+
: hostname;
|
|
46
51
|
|
|
47
52
|
// Pre-build the info lines to calculate box width including status line.
|
|
48
53
|
const infoLines = [
|