patchwork-os 0.2.0-alpha.3 → 0.2.0-alpha.5

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.
Files changed (51) hide show
  1. package/dist/bridge.js +23 -10
  2. package/dist/bridge.js.map +1 -1
  3. package/dist/connectors/github.d.ts +58 -8
  4. package/dist/connectors/github.js +321 -84
  5. package/dist/connectors/github.js.map +1 -1
  6. package/dist/connectors/gmail.js +7 -0
  7. package/dist/connectors/gmail.js.map +1 -1
  8. package/dist/connectors/googleCalendar.d.ts +57 -0
  9. package/dist/connectors/googleCalendar.js +308 -0
  10. package/dist/connectors/googleCalendar.js.map +1 -0
  11. package/dist/connectors/linear.d.ts +52 -19
  12. package/dist/connectors/linear.js +167 -129
  13. package/dist/connectors/linear.js.map +1 -1
  14. package/dist/connectors/mcpClient.d.ts +56 -0
  15. package/dist/connectors/mcpClient.js +189 -0
  16. package/dist/connectors/mcpClient.js.map +1 -0
  17. package/dist/connectors/mcpOAuth.d.ts +73 -0
  18. package/dist/connectors/mcpOAuth.js +338 -0
  19. package/dist/connectors/mcpOAuth.js.map +1 -0
  20. package/dist/connectors/sentry.d.ts +17 -21
  21. package/dist/connectors/sentry.js +124 -131
  22. package/dist/connectors/sentry.js.map +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/recipes/yamlRunner.js +32 -42
  26. package/dist/recipes/yamlRunner.js.map +1 -1
  27. package/dist/recipesHttp.d.ts +13 -1
  28. package/dist/recipesHttp.js +9 -1
  29. package/dist/recipesHttp.js.map +1 -1
  30. package/dist/server.d.ts +3 -1
  31. package/dist/server.js +220 -49
  32. package/dist/server.js.map +1 -1
  33. package/dist/tools/createLinearIssue.d.ts +84 -0
  34. package/dist/tools/createLinearIssue.js +146 -0
  35. package/dist/tools/createLinearIssue.js.map +1 -0
  36. package/dist/tools/fetchCalendarEvents.d.ts +94 -0
  37. package/dist/tools/fetchCalendarEvents.js +97 -0
  38. package/dist/tools/fetchCalendarEvents.js.map +1 -0
  39. package/dist/tools/fetchGithubIssue.d.ts +80 -0
  40. package/dist/tools/fetchGithubIssue.js +84 -0
  41. package/dist/tools/fetchGithubIssue.js.map +1 -0
  42. package/dist/tools/fetchGithubPR.d.ts +89 -0
  43. package/dist/tools/fetchGithubPR.js +96 -0
  44. package/dist/tools/fetchGithubPR.js.map +1 -0
  45. package/dist/tools/index.js +8 -0
  46. package/dist/tools/index.js.map +1 -1
  47. package/package.json +1 -1
  48. package/scripts/start-all.sh +56 -19
  49. package/templates/recipes/ctx-loop-test.yaml +75 -0
  50. package/templates/recipes/morning-brief.yaml +12 -4
  51. package/templates/recipes/sentry-to-linear.yaml +77 -0
@@ -0,0 +1,84 @@
1
+ export declare function createLinearIssueTool(): {
2
+ schema: {
3
+ name: string;
4
+ description: string;
5
+ annotations: {
6
+ readOnlyHint: boolean;
7
+ };
8
+ inputSchema: {
9
+ type: "object";
10
+ required: string[];
11
+ properties: {
12
+ title: {
13
+ type: string;
14
+ description: string;
15
+ maxLength: number;
16
+ };
17
+ description: {
18
+ type: string;
19
+ description: string;
20
+ maxLength: number;
21
+ };
22
+ teamKey: {
23
+ type: string;
24
+ description: string;
25
+ maxLength: number;
26
+ };
27
+ priority: {
28
+ type: string;
29
+ description: string;
30
+ minimum: number;
31
+ maximum: number;
32
+ };
33
+ labelNames: {
34
+ type: string;
35
+ description: string;
36
+ items: {
37
+ type: string;
38
+ maxLength: number;
39
+ };
40
+ maxItems: number;
41
+ };
42
+ };
43
+ additionalProperties: false;
44
+ };
45
+ outputSchema: {
46
+ type: "object";
47
+ properties: {
48
+ id: {
49
+ type: string;
50
+ };
51
+ identifier: {
52
+ type: string;
53
+ };
54
+ title: {
55
+ type: string;
56
+ };
57
+ url: {
58
+ type: string;
59
+ };
60
+ state: {
61
+ type: string;
62
+ };
63
+ team: {
64
+ type: string;
65
+ };
66
+ linearConnected: {
67
+ type: string;
68
+ };
69
+ error: {
70
+ type: string;
71
+ };
72
+ };
73
+ required: string[];
74
+ };
75
+ };
76
+ timeoutMs: number;
77
+ handler(args: Record<string, unknown>, signal?: AbortSignal): Promise<{
78
+ content: Array<{
79
+ type: string;
80
+ text: string;
81
+ }>;
82
+ structuredContent: unknown;
83
+ }>;
84
+ };
@@ -0,0 +1,146 @@
1
+ import { createIssue, listTeams, loadTokens } from "../connectors/linear.js";
2
+ import { requireString, successStructured } from "./utils.js";
3
+ export function createLinearIssueTool() {
4
+ return {
5
+ schema: {
6
+ name: "createLinearIssue",
7
+ description: "Create a new Linear issue. Requires Linear connector connected. Returns the created issue identifier and URL.",
8
+ annotations: { readOnlyHint: false },
9
+ inputSchema: {
10
+ type: "object",
11
+ required: ["title"],
12
+ properties: {
13
+ title: {
14
+ type: "string",
15
+ description: "Issue title.",
16
+ maxLength: 500,
17
+ },
18
+ description: {
19
+ type: "string",
20
+ description: "Issue description (Markdown).",
21
+ maxLength: 10000,
22
+ },
23
+ teamKey: {
24
+ type: "string",
25
+ description: "Team key (e.g. 'ENG'). If omitted, uses the first team in your workspace.",
26
+ maxLength: 50,
27
+ },
28
+ priority: {
29
+ type: "integer",
30
+ description: "Priority: 0=no priority, 1=urgent, 2=high, 3=medium, 4=low.",
31
+ minimum: 0,
32
+ maximum: 4,
33
+ },
34
+ labelNames: {
35
+ type: "array",
36
+ description: "Label names to attach (must already exist in Linear).",
37
+ items: { type: "string", maxLength: 100 },
38
+ maxItems: 10,
39
+ },
40
+ },
41
+ additionalProperties: false,
42
+ },
43
+ outputSchema: {
44
+ type: "object",
45
+ properties: {
46
+ id: { type: "string" },
47
+ identifier: { type: "string" },
48
+ title: { type: "string" },
49
+ url: { type: "string" },
50
+ state: { type: "string" },
51
+ team: { type: "string" },
52
+ linearConnected: { type: "boolean" },
53
+ error: { type: "string" },
54
+ },
55
+ required: [
56
+ "id",
57
+ "identifier",
58
+ "title",
59
+ "url",
60
+ "state",
61
+ "team",
62
+ "linearConnected",
63
+ ],
64
+ },
65
+ },
66
+ timeoutMs: 20_000,
67
+ async handler(args, signal) {
68
+ const tokens = loadTokens();
69
+ if (!tokens) {
70
+ return successStructured({
71
+ id: "",
72
+ identifier: "",
73
+ title: "",
74
+ url: "",
75
+ state: "",
76
+ team: "",
77
+ linearConnected: false,
78
+ error: "Linear not connected. GET /connections/linear/authorize first.",
79
+ });
80
+ }
81
+ const title = requireString(args, "title", 500);
82
+ const description = typeof args.description === "string" ? args.description : undefined;
83
+ const teamKeyArg = typeof args.teamKey === "string" ? args.teamKey : undefined;
84
+ const priority = typeof args.priority === "number" ? args.priority : undefined;
85
+ const labelNames = Array.isArray(args.labelNames)
86
+ ? args.labelNames
87
+ .filter((l) => typeof l === "string")
88
+ .map(String)
89
+ : [];
90
+ try {
91
+ // Resolve team ID
92
+ const teams = await listTeams(signal);
93
+ if (teams.length === 0) {
94
+ throw new Error("No teams found in Linear workspace.");
95
+ }
96
+ let teamName;
97
+ let teamLabel;
98
+ if (teamKeyArg) {
99
+ const match = teams.find((t) => t.key.toLowerCase() === teamKeyArg.toLowerCase());
100
+ if (!match) {
101
+ throw new Error(`Team '${teamKeyArg}' not found. Available teams: ${teams.map((t) => t.key).join(", ")}`);
102
+ }
103
+ teamName = match.name;
104
+ teamLabel = match.key ? `${match.name} (${match.key})` : match.name;
105
+ }
106
+ else {
107
+ const first = teams[0];
108
+ if (!first)
109
+ throw new Error("No teams found in Linear workspace.");
110
+ teamName = first.name;
111
+ teamLabel = first.key ? `${first.name} (${first.key})` : first.name;
112
+ }
113
+ const issue = await createIssue({
114
+ team: teamName,
115
+ title,
116
+ description,
117
+ priority,
118
+ labels: labelNames.length > 0 ? labelNames : undefined,
119
+ }, signal);
120
+ return successStructured({
121
+ id: issue.id,
122
+ identifier: issue.identifier,
123
+ title: issue.title,
124
+ url: issue.url,
125
+ state: issue.state?.name ?? "",
126
+ team: teamLabel,
127
+ linearConnected: true,
128
+ });
129
+ }
130
+ catch (err) {
131
+ const notConnected = err instanceof Error && err.message.includes("not connected");
132
+ return successStructured({
133
+ id: "",
134
+ identifier: "",
135
+ title: "",
136
+ url: "",
137
+ state: "",
138
+ team: "",
139
+ linearConnected: !notConnected,
140
+ error: err instanceof Error ? err.message : String(err),
141
+ });
142
+ }
143
+ },
144
+ };
145
+ }
146
+ //# sourceMappingURL=createLinearIssue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createLinearIssue.js","sourceRoot":"","sources":["../../src/tools/createLinearIssue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,MAAM,EAAE;YACN,IAAI,EAAE,mBAAmB;YACzB,WAAW,EACT,+GAA+G;YACjH,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE;YACpC,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,QAAQ,EAAE,CAAC,OAAO,CAAC;gBACnB,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,cAAc;wBAC3B,SAAS,EAAE,GAAG;qBACf;oBACD,WAAW,EAAE;wBACX,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,+BAA+B;wBAC5C,SAAS,EAAE,KAAK;qBACjB;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,WAAW,EACT,2EAA2E;wBAC7E,SAAS,EAAE,EAAE;qBACd;oBACD,QAAQ,EAAE;wBACR,IAAI,EAAE,SAAS;wBACf,WAAW,EACT,6DAA6D;wBAC/D,OAAO,EAAE,CAAC;wBACV,OAAO,EAAE,CAAC;qBACX;oBACD,UAAU,EAAE;wBACV,IAAI,EAAE,OAAO;wBACb,WAAW,EACT,uDAAuD;wBACzD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,S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AC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;gBAChE,OAAO,iBAAiB,CAAC;oBACvB,EAAE,EAAE,EAAE;oBACN,UAAU,EAAE,EAAE;oBACd,KAAK,EAAE,EAAE;oBACT,GAAG,EAAE,EAAE;oBACP,KAAK,EAAE,EAAE;oBACT,IAAI,EAAE,EAAE;oBACR,eAAe,EAAE,CAAC,YAAY;oBAC9B,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;iBACxD,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,94 @@
1
+ export declare function createFetchCalendarEventsTool(): {
2
+ schema: {
3
+ name: string;
4
+ description: string;
5
+ annotations: {
6
+ readOnlyHint: boolean;
7
+ };
8
+ inputSchema: {
9
+ type: "object";
10
+ properties: {
11
+ daysAhead: {
12
+ type: string;
13
+ description: string;
14
+ minimum: number;
15
+ maximum: number;
16
+ };
17
+ maxResults: {
18
+ type: string;
19
+ description: string;
20
+ minimum: number;
21
+ maximum: number;
22
+ };
23
+ calendarId: {
24
+ type: string;
25
+ description: string;
26
+ maxLength: number;
27
+ };
28
+ };
29
+ additionalProperties: false;
30
+ };
31
+ outputSchema: {
32
+ type: "object";
33
+ properties: {
34
+ events: {
35
+ type: string;
36
+ items: {
37
+ type: string;
38
+ properties: {
39
+ id: {
40
+ type: string;
41
+ };
42
+ summary: {
43
+ type: string;
44
+ };
45
+ description: {
46
+ type: string[];
47
+ };
48
+ start: {
49
+ type: string;
50
+ };
51
+ end: {
52
+ type: string;
53
+ };
54
+ allDay: {
55
+ type: string;
56
+ };
57
+ location: {
58
+ type: string[];
59
+ };
60
+ htmlLink: {
61
+ type: string;
62
+ };
63
+ attendees: {
64
+ type: string;
65
+ items: {
66
+ type: string;
67
+ };
68
+ };
69
+ };
70
+ required: string[];
71
+ };
72
+ };
73
+ count: {
74
+ type: string;
75
+ };
76
+ daysAhead: {
77
+ type: string;
78
+ };
79
+ calendarConnected: {
80
+ type: string;
81
+ };
82
+ };
83
+ required: string[];
84
+ };
85
+ };
86
+ timeoutMs: number;
87
+ handler(args: Record<string, unknown>, signal?: AbortSignal): Promise<{
88
+ content: Array<{
89
+ type: string;
90
+ text: string;
91
+ }>;
92
+ structuredContent: unknown;
93
+ }>;
94
+ };
@@ -0,0 +1,97 @@
1
+ import { listEvents } from "../connectors/googleCalendar.js";
2
+ import { successStructured } from "./utils.js";
3
+ export function createFetchCalendarEventsTool() {
4
+ return {
5
+ schema: {
6
+ name: "fetchCalendarEvents",
7
+ description: "Fetch upcoming Google Calendar events. Returns events for the next N days. Requires Google Calendar connector connected.",
8
+ annotations: { readOnlyHint: true },
9
+ inputSchema: {
10
+ type: "object",
11
+ properties: {
12
+ daysAhead: {
13
+ type: "integer",
14
+ description: "Number of days ahead to fetch (default: 7, max: 30).",
15
+ minimum: 1,
16
+ maximum: 30,
17
+ },
18
+ maxResults: {
19
+ type: "integer",
20
+ description: "Maximum events to return (default: 20, max: 50).",
21
+ minimum: 1,
22
+ maximum: 50,
23
+ },
24
+ calendarId: {
25
+ type: "string",
26
+ description: "Calendar ID to query (e.g. 'primary' or an email address). Defaults to the connected calendar.",
27
+ maxLength: 200,
28
+ },
29
+ },
30
+ additionalProperties: false,
31
+ },
32
+ outputSchema: {
33
+ type: "object",
34
+ properties: {
35
+ events: {
36
+ type: "array",
37
+ items: {
38
+ type: "object",
39
+ properties: {
40
+ id: { type: "string" },
41
+ summary: { type: "string" },
42
+ description: { type: ["string", "null"] },
43
+ start: { type: "string" },
44
+ end: { type: "string" },
45
+ allDay: { type: "boolean" },
46
+ location: { type: ["string", "null"] },
47
+ htmlLink: { type: "string" },
48
+ attendees: { type: "array", items: { type: "string" } },
49
+ },
50
+ required: ["id", "summary", "start", "end", "allDay", "htmlLink"],
51
+ },
52
+ },
53
+ count: { type: "integer" },
54
+ daysAhead: { type: "integer" },
55
+ calendarConnected: { type: "boolean" },
56
+ },
57
+ required: ["events", "count", "daysAhead", "calendarConnected"],
58
+ },
59
+ },
60
+ timeoutMs: 15_000,
61
+ async handler(args, signal) {
62
+ const daysAhead = typeof args.daysAhead === "number" ? args.daysAhead : 7;
63
+ const maxResults = typeof args.maxResults === "number" ? args.maxResults : 20;
64
+ const calendarId = typeof args.calendarId === "string" ? args.calendarId : undefined;
65
+ try {
66
+ const events = await listEvents({ daysAhead, maxResults, calendarId }, signal);
67
+ return successStructured({
68
+ events: events.map((e) => ({
69
+ id: e.id,
70
+ summary: e.summary,
71
+ description: e.description ?? null,
72
+ start: e.start,
73
+ end: e.end,
74
+ allDay: e.allDay,
75
+ location: e.location ?? null,
76
+ htmlLink: e.htmlLink,
77
+ attendees: e.attendees ?? [],
78
+ })),
79
+ count: events.length,
80
+ daysAhead,
81
+ calendarConnected: true,
82
+ });
83
+ }
84
+ catch (err) {
85
+ const notConnected = err instanceof Error && err.message.includes("not connected");
86
+ return successStructured({
87
+ events: [],
88
+ count: 0,
89
+ daysAhead,
90
+ calendarConnected: !notConnected,
91
+ error: err instanceof Error ? err.message : String(err),
92
+ });
93
+ }
94
+ },
95
+ };
96
+ }
97
+ //# sourceMappingURL=fetchCalendarEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchCalendarEvents.js","sourceRoot":"","sources":["../../src/tools/fetchCalendarEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,UAAU,6BAA6B;IAC3C,OAAO;QACL,MAAM,EAAE;YACN,IAAI,EAAE,qBAAqB;YAC3B,WAAW,EACT,0HAA0H;YAC5H,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;YACnC,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,SAAS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AC,CAAC,QAAQ;wBACpB,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,EAAE;qBAC7B,CAAC,CAAC;oBACH,KAAK,EAAE,MAAM,CAAC,MAAM;oBACpB,SAAS;oBACT,iBAAiB,EAAE,IAAI;iBACxB,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,YAAY,GAChB,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;gBAChE,OAAO,iBAAiB,CAAC;oBACvB,MAAM,EAAE,EAAE;oBACV,KAAK,EAAE,CAAC;oBACR,SAAS;oBACT,iBAAiB,EAAE,CAAC,YAAY;oBAChC,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;iBACxD,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,80 @@
1
+ export declare function createFetchGithubIssueTool(): {
2
+ schema: {
3
+ name: string;
4
+ description: string;
5
+ annotations: {
6
+ readOnlyHint: boolean;
7
+ };
8
+ inputSchema: {
9
+ type: "object";
10
+ required: string[];
11
+ properties: {
12
+ issueRef: {
13
+ type: string;
14
+ description: string;
15
+ maxLength: number;
16
+ };
17
+ };
18
+ additionalProperties: false;
19
+ };
20
+ outputSchema: {
21
+ type: "object";
22
+ properties: {
23
+ number: {
24
+ type: string;
25
+ };
26
+ title: {
27
+ type: string;
28
+ };
29
+ body: {
30
+ type: string;
31
+ };
32
+ state: {
33
+ type: string;
34
+ };
35
+ url: {
36
+ type: string;
37
+ };
38
+ repo: {
39
+ type: string;
40
+ };
41
+ author: {
42
+ type: string;
43
+ };
44
+ labels: {
45
+ type: string;
46
+ items: {
47
+ type: string;
48
+ };
49
+ };
50
+ assignees: {
51
+ type: string;
52
+ items: {
53
+ type: string;
54
+ };
55
+ };
56
+ createdAt: {
57
+ type: string;
58
+ };
59
+ updatedAt: {
60
+ type: string;
61
+ };
62
+ comments: {
63
+ type: string;
64
+ };
65
+ githubConnected: {
66
+ type: string;
67
+ };
68
+ };
69
+ required: string[];
70
+ };
71
+ };
72
+ timeoutMs: number;
73
+ handler(args: Record<string, unknown>, signal?: AbortSignal): Promise<{
74
+ content: Array<{
75
+ type: string;
76
+ text: string;
77
+ }>;
78
+ structuredContent: unknown;
79
+ }>;
80
+ };
@@ -0,0 +1,84 @@
1
+ import { fetchGitHubIssue } from "../connectors/github.js";
2
+ import { requireString, successStructured } from "./utils.js";
3
+ export function createFetchGithubIssueTool() {
4
+ return {
5
+ schema: {
6
+ name: "fetchGithubIssue",
7
+ description: "Fetch a GitHub issue by URL or owner/repo#number ref. Returns title, body, state, labels, assignees, and author. Requires GitHub connector connected.",
8
+ annotations: { readOnlyHint: true },
9
+ inputSchema: {
10
+ type: "object",
11
+ required: ["issueRef"],
12
+ properties: {
13
+ issueRef: {
14
+ type: "string",
15
+ description: "GitHub issue URL (https://github.com/owner/repo/issues/42) or short ref (owner/repo#42).",
16
+ maxLength: 500,
17
+ },
18
+ },
19
+ additionalProperties: false,
20
+ },
21
+ outputSchema: {
22
+ type: "object",
23
+ properties: {
24
+ number: { type: "integer" },
25
+ title: { type: "string" },
26
+ body: { type: "string" },
27
+ state: { type: "string" },
28
+ url: { type: "string" },
29
+ repo: { type: "string" },
30
+ author: { type: "string" },
31
+ labels: { type: "array", items: { type: "string" } },
32
+ assignees: { type: "array", items: { type: "string" } },
33
+ createdAt: { type: "string" },
34
+ updatedAt: { type: "string" },
35
+ comments: { type: "integer" },
36
+ githubConnected: { type: "boolean" },
37
+ },
38
+ required: [
39
+ "number",
40
+ "title",
41
+ "body",
42
+ "state",
43
+ "url",
44
+ "repo",
45
+ "author",
46
+ "labels",
47
+ "assignees",
48
+ "createdAt",
49
+ "updatedAt",
50
+ "comments",
51
+ "githubConnected",
52
+ ],
53
+ },
54
+ },
55
+ timeoutMs: 15_000,
56
+ async handler(args, signal) {
57
+ const issueRef = requireString(args, "issueRef", 500);
58
+ try {
59
+ const issue = await fetchGitHubIssue(issueRef, signal);
60
+ return successStructured({ ...issue, githubConnected: true });
61
+ }
62
+ catch (err) {
63
+ const notConnected = err instanceof Error && err.message.includes("not connected");
64
+ return successStructured({
65
+ number: 0,
66
+ title: "",
67
+ body: "",
68
+ state: "",
69
+ url: "",
70
+ repo: "",
71
+ author: "",
72
+ labels: [],
73
+ assignees: [],
74
+ createdAt: "",
75
+ updatedAt: "",
76
+ comments: 0,
77
+ githubConnected: !notConnected,
78
+ error: err instanceof Error ? err.message : String(err),
79
+ });
80
+ }
81
+ },
82
+ };
83
+ }
84
+ //# sourceMappingURL=fetchGithubIssue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchGithubIssue.js","sourceRoot":"","sources":["../../src/tools/fetchGithubIssue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,UAAU,0BAA0B;IACxC,OAAO;QACL,MAAM,EAAE;YACN,IAAI,EAAE,kBAAkB;YACxB,WAAW,EACT,uJAAuJ;YACzJ,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;YACnC,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,UAAU,EAAE;oBACV,QAAQ,EAAE;wBACR,IAAI,EAAE,QAAQ;wBACd,WAAW,EACT,0FAA0F;wBAC5F,SAAS,EAAE,GAAG;qBACf;iBACF;gBACD,oBAAoB,EAAE,KAAc;aACrC;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;oBAC3B,KAAK,EAAE,EAAE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