patchrelay 0.10.0 → 0.10.2
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/dist/build-info.json +3 -3
- package/dist/cli/commands/connect.js +30 -4
- package/dist/cli/index.js +1 -0
- package/dist/linear-oauth.js +9 -3
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
|
@@ -18,11 +18,37 @@ export async function handleConnectCommand(params) {
|
|
|
18
18
|
export async function handleInstallationsCommand(params) {
|
|
19
19
|
const result = await params.data.listInstallations();
|
|
20
20
|
if (params.json) {
|
|
21
|
-
writeOutput(params.stdout, formatJson(
|
|
21
|
+
writeOutput(params.stdout, formatJson({
|
|
22
|
+
...result,
|
|
23
|
+
installations: result.installations.map((item) => ({
|
|
24
|
+
...item,
|
|
25
|
+
projects: item.linkedProjects.map((id) => {
|
|
26
|
+
const p = params.config.projects.find((proj) => proj.id === id);
|
|
27
|
+
return p ? { id: p.id, repoPath: p.repoPath, issueKeyPrefixes: p.issueKeyPrefixes, linearTeamIds: p.linearTeamIds } : { id };
|
|
28
|
+
}),
|
|
29
|
+
})),
|
|
30
|
+
}));
|
|
22
31
|
return 0;
|
|
23
32
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
if (result.installations.length === 0) {
|
|
34
|
+
writeOutput(params.stdout, "No installations found.\n");
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
const lines = [];
|
|
38
|
+
for (const item of result.installations) {
|
|
39
|
+
const label = item.installation.workspaceName ?? item.installation.actorName ?? "-";
|
|
40
|
+
lines.push(`${item.installation.id} ${label} projects=${item.linkedProjects.join(",") || "-"}`);
|
|
41
|
+
for (const projectId of item.linkedProjects) {
|
|
42
|
+
const p = params.config.projects.find((proj) => proj.id === projectId);
|
|
43
|
+
if (!p)
|
|
44
|
+
continue;
|
|
45
|
+
const routing = [
|
|
46
|
+
...(p.issueKeyPrefixes.length > 0 ? [`prefixes=${p.issueKeyPrefixes.join(",")}`] : []),
|
|
47
|
+
...(p.linearTeamIds.length > 0 ? [`teams=${p.linearTeamIds.join(",")}`] : []),
|
|
48
|
+
].join(" ") || "no routing";
|
|
49
|
+
lines.push(` ${projectId} ${p.repoPath} ${routing}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
writeOutput(params.stdout, `${lines.join("\n")}\n`);
|
|
27
53
|
return 0;
|
|
28
54
|
}
|
package/dist/cli/index.js
CHANGED
package/dist/linear-oauth.js
CHANGED
|
@@ -96,6 +96,11 @@ export async function fetchLinearViewerIdentity(graphqlUrl, accessToken, logger)
|
|
|
96
96
|
id
|
|
97
97
|
name
|
|
98
98
|
}
|
|
99
|
+
organization {
|
|
100
|
+
id
|
|
101
|
+
name
|
|
102
|
+
urlKey
|
|
103
|
+
}
|
|
99
104
|
teams {
|
|
100
105
|
nodes {
|
|
101
106
|
id
|
|
@@ -111,12 +116,13 @@ export async function fetchLinearViewerIdentity(graphqlUrl, accessToken, logger)
|
|
|
111
116
|
if (!response.ok || !payload?.data) {
|
|
112
117
|
throw new Error(`Linear viewer lookup failed with HTTP ${response.status}`);
|
|
113
118
|
}
|
|
119
|
+
const org = payload.data.organization;
|
|
114
120
|
const teams = payload.data.teams?.nodes ?? [];
|
|
115
121
|
const firstTeam = teams.find((team) => team?.id || team?.name || team?.key);
|
|
116
122
|
const result = {
|
|
117
|
-
...(firstTeam?.id ? { workspaceId: firstTeam.id } : {}),
|
|
118
|
-
...(
|
|
119
|
-
...(firstTeam?.key ? { workspaceKey: firstTeam.key } : {}),
|
|
123
|
+
...(org?.id ? { workspaceId: org.id } : firstTeam?.id ? { workspaceId: firstTeam.id } : {}),
|
|
124
|
+
...(org?.name ? { workspaceName: org.name } : {}),
|
|
125
|
+
...(org?.urlKey ? { workspaceKey: org.urlKey } : firstTeam?.key ? { workspaceKey: firstTeam.key } : {}),
|
|
120
126
|
...(payload.data.viewer?.id ? { actorId: payload.data.viewer.id } : {}),
|
|
121
127
|
...(payload.data.viewer?.name ? { actorName: payload.data.viewer.name } : {}),
|
|
122
128
|
};
|