@feedmob/github-issues 0.0.3 → 0.0.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.
- package/dist/common/version.js +1 -1
- package/dist/index.js +66 -13
- package/dist/operations/issues.js +11 -5
- package/package.json +1 -1
package/dist/common/version.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ server.addTool({
|
|
|
66
66
|
let params = new URLSearchParams();
|
|
67
67
|
params.set('start_date', args.start_date);
|
|
68
68
|
params.set('end_date', args.end_date);
|
|
69
|
-
|
|
69
|
+
args.fields.forEach(field => params.append('fields[]', field));
|
|
70
70
|
if (args.status !== undefined) {
|
|
71
71
|
params.set('status', args.status);
|
|
72
72
|
}
|
|
@@ -79,14 +79,35 @@ server.addTool({
|
|
|
79
79
|
if (args.team !== undefined) {
|
|
80
80
|
params.set('team', args.team);
|
|
81
81
|
}
|
|
82
|
+
if (args.title !== undefined) {
|
|
83
|
+
params.set('title', args.title);
|
|
84
|
+
}
|
|
85
|
+
if (args.labels !== undefined) {
|
|
86
|
+
args.labels.forEach(label => params.append('labels[]', label));
|
|
87
|
+
}
|
|
88
|
+
if (args.score_status !== undefined) {
|
|
89
|
+
params.set('score_status', args.score_status);
|
|
90
|
+
}
|
|
82
91
|
const response = await fetch(`${AI_API_URL}/issues?${params}`, {
|
|
83
92
|
method: 'GET',
|
|
84
93
|
headers: {
|
|
85
94
|
'Authorization': "Bearer " + AI_API_TOKEN
|
|
86
95
|
}
|
|
87
96
|
});
|
|
97
|
+
const data = await response.text();
|
|
88
98
|
return {
|
|
89
|
-
content: [
|
|
99
|
+
content: [
|
|
100
|
+
{
|
|
101
|
+
type: "text",
|
|
102
|
+
text: `# Github Issue Query Result
|
|
103
|
+
**Raw JSON Data:**
|
|
104
|
+
\`\`\`json
|
|
105
|
+
${JSON.stringify(data, null, 2)}
|
|
106
|
+
\`\`\`
|
|
107
|
+
**Please further analyze and find the data required by the user based on the prompt, and return the data in a human-readable, formatted, and aesthetically pleasing manner.**
|
|
108
|
+
`,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
90
111
|
};
|
|
91
112
|
}
|
|
92
113
|
catch (error) {
|
|
@@ -149,20 +170,52 @@ server.addTool({
|
|
|
149
170
|
},
|
|
150
171
|
});
|
|
151
172
|
server.addTool({
|
|
152
|
-
name: "
|
|
153
|
-
description: "Get
|
|
173
|
+
name: "get_issues",
|
|
174
|
+
description: "Get comments for multiple issues in bulk",
|
|
154
175
|
parameters: issues.GetIssueSchema,
|
|
155
176
|
execute: async (args) => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
177
|
+
try {
|
|
178
|
+
const response = await fetch(`${AI_API_URL}/issues/get_comments`, {
|
|
179
|
+
method: 'POST',
|
|
180
|
+
headers: {
|
|
181
|
+
'Authorization': "Bearer " + AI_API_TOKEN,
|
|
182
|
+
'Content-Type': 'application/json'
|
|
183
|
+
},
|
|
184
|
+
body: JSON.stringify({
|
|
185
|
+
repo_issues: args.repo_issues,
|
|
186
|
+
comment_count: args.comment_count
|
|
187
|
+
})
|
|
188
|
+
});
|
|
189
|
+
if (!response.ok) {
|
|
190
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
191
|
+
}
|
|
192
|
+
const data = await response.text();
|
|
193
|
+
return {
|
|
194
|
+
content: [
|
|
195
|
+
{
|
|
196
|
+
type: "text",
|
|
197
|
+
text: `# Github Issue Comments
|
|
198
|
+
**Raw JSON Data:**
|
|
199
|
+
\`\`\`json
|
|
200
|
+
${JSON.stringify(data, null, 2)}
|
|
201
|
+
\`\`\`
|
|
202
|
+
**Please format the above data beautifully, refer to the following markdown example for the converted format and return the corresponding data.**
|
|
203
|
+
### title
|
|
204
|
+
repo: repo
|
|
205
|
+
issue_number: issue_number
|
|
206
|
+
------- Comment 1: user create_at -------
|
|
207
|
+
comment body(Original text, no need to convert to md)
|
|
208
|
+
`,
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
console.error(`[ERROR] Failed to get issue comments:`, error);
|
|
215
|
+
return {
|
|
216
|
+
content: [{ type: "text", text: `Failed to get issue comments: ${error instanceof Error ? error.message : String(error)}` }],
|
|
217
|
+
};
|
|
161
218
|
}
|
|
162
|
-
const issue = await issues.getIssue(owner, repo, issue_number);
|
|
163
|
-
return {
|
|
164
|
-
content: [{ type: "text", text: JSON.stringify(issue, null, 2) }],
|
|
165
|
-
};
|
|
166
219
|
},
|
|
167
220
|
});
|
|
168
221
|
server.addTool({
|
|
@@ -3,17 +3,23 @@ import { githubRequest, buildUrl } from "../common/utils.js";
|
|
|
3
3
|
import { subDays, format } from 'date-fns';
|
|
4
4
|
export const FeedmobSearchOptions = z.object({
|
|
5
5
|
scheam: z.string().describe("get from system resources issues/search_schema"),
|
|
6
|
-
start_date: z.string().default(format(subDays(new Date(),
|
|
6
|
+
start_date: z.string().default(format(subDays(new Date(), 30), 'yyyy-MM-dd')).describe("The creation start date of the issue"),
|
|
7
7
|
end_date: z.string().default(format(new Date(), 'yyyy-MM-dd')).describe("The creation end date of the issue"),
|
|
8
8
|
status: z.string().optional().describe("The status of the issue, e.g., 'open', 'closed'"),
|
|
9
9
|
repo: z.string().optional().describe("The repository name, e.g., 'feedmob', 'tracking_admin', If the user does not specify otherwise, this parameter can be omitted and all repos will be searched by default."),
|
|
10
|
-
users: z.array(z.string()).optional().
|
|
10
|
+
users: z.array(z.string()).optional().describe("The users to filter issues by, can be assign_users, developers, code_reviewers, publishers, create_user, pm_qa_user"),
|
|
11
11
|
team: z.string().optional().describe("The team name, e.g., 'Star', 'Mighty'"),
|
|
12
|
+
title: z.string().optional().describe("The title of the issue, supports fuzzy matching"),
|
|
13
|
+
labels: z.array(z.string()).optional().describe("Labels to filter issues by"),
|
|
14
|
+
score_status: z.string().optional().describe("The issue score status, e.g., 'not scored', 'scored'"),
|
|
15
|
+
fields: z.array(z.string()).describe("Fields to return for each issue, available fields: 'issue_id', 'repo', 'title', 'created_at', 'closed_at', 'hubspot_ticket_link', 'create_user', 'assign_users', 'status', 'current_labels', 'process_time_seconds', 'developers', 'code_reviewers', 'publishers', 'qa_members', 'pm_qa_user', 'team'"),
|
|
12
16
|
});
|
|
13
17
|
export const GetIssueSchema = z.object({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
comment_count: z.string().default('all').describe("Get all comments, or a specified number of comments, by default starting from the latest submission."),
|
|
19
|
+
repo_issues: z.array(z.object({
|
|
20
|
+
repo: z.string(),
|
|
21
|
+
issue_number: z.number()
|
|
22
|
+
}))
|
|
17
23
|
});
|
|
18
24
|
export const IssueCommentSchema = z.object({
|
|
19
25
|
owner: z.string(),
|