@trim21/personal-pi-extensions 0.1.644 → 0.1.646
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 +1 -1
- package/src/gh/tools/list-issues.ts +5 -2
- package/src/gh/tools/list-prs.ts +5 -2
- package/src/lib/github.ts +9 -13
package/package.json
CHANGED
|
@@ -41,9 +41,12 @@ export function addListIssuesTool(gh: GhClient, pi: ExtensionAPI) {
|
|
|
41
41
|
}),
|
|
42
42
|
),
|
|
43
43
|
label: Type.Optional(Type.String({ description: "Filter by label" })),
|
|
44
|
-
|
|
44
|
+
// `@me` 由 GitHub 的搜索 / 过滤 API 解析:不带 keywords 时 gh 自行展开(GraphQL 过滤分支)
|
|
45
|
+
// 或按字面量转发(搜索分支),带 keywords 时我们直接把 `assignee:@me` 交给搜索 API。
|
|
46
|
+
// 两条传输都支持,因此本仓库不要再实现一次展开。
|
|
47
|
+
author: Type.Optional(Type.String({ description: "Filter by author ('@me' for yourself)" })),
|
|
45
48
|
assignee: Type.Optional(
|
|
46
|
-
Type.String({ description: "Filter by assignee (@me for yourself)" }),
|
|
49
|
+
Type.String({ description: "Filter by assignee ('@me' for yourself)" }),
|
|
47
50
|
),
|
|
48
51
|
milestone: Type.Optional(Type.String({ description: "Filter by milestone" })),
|
|
49
52
|
limit: Type.Optional(Type.Number({ description: "Max results (default 30, max 100)" })),
|
package/src/gh/tools/list-prs.ts
CHANGED
|
@@ -41,9 +41,12 @@ export function addListPrsTool(gh: GhClient, pi: ExtensionAPI) {
|
|
|
41
41
|
}),
|
|
42
42
|
),
|
|
43
43
|
label: Type.Optional(Type.String({ description: "Filter by label" })),
|
|
44
|
-
|
|
44
|
+
// `@me` 由 GitHub 的搜索 / 过滤 API 解析:不带 keywords 时 gh 自行展开(GraphQL 过滤分支)
|
|
45
|
+
// 或按字面量转发(搜索分支),带 keywords 时我们直接把 `assignee:@me` 交给搜索 API。
|
|
46
|
+
// 两条传输都支持,因此本仓库不要再实现一次展开。
|
|
47
|
+
author: Type.Optional(Type.String({ description: "Filter by author ('@me' for yourself)" })),
|
|
45
48
|
assignee: Type.Optional(
|
|
46
|
-
Type.String({ description: "Filter by assignee (@me for yourself)" }),
|
|
49
|
+
Type.String({ description: "Filter by assignee ('@me' for yourself)" }),
|
|
47
50
|
),
|
|
48
51
|
milestone: Type.Optional(Type.String({ description: "Filter by milestone" })),
|
|
49
52
|
limit: Type.Optional(Type.Number({ description: "Max results (default 30, max 100)" })),
|
package/src/lib/github.ts
CHANGED
|
@@ -310,22 +310,18 @@ export function createGithubSearch(options: GithubClientOptions = {}): GithubSea
|
|
|
310
310
|
return {
|
|
311
311
|
async search(kind, params) {
|
|
312
312
|
const limit = Math.min(Math.max(params.limit ?? 30, 1), 100);
|
|
313
|
-
const effective = { ...params, limit };
|
|
314
313
|
|
|
315
314
|
try {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
q,
|
|
326
|
-
per_page: limit,
|
|
315
|
+
// `@me` 是 gh CLI 的简写,REST 搜索不认识:这里不展开,带关键词时它按字面量
|
|
316
|
+
// 进入查询串(无关键词的列表走 gh CLI,由 gh 自己展开)。
|
|
317
|
+
const q = buildSearchQuery(kind, { ...params, limit });
|
|
318
|
+
return await api.call(async (client) => {
|
|
319
|
+
const { data } = await client.rest.search.issuesAndPullRequests({
|
|
320
|
+
q,
|
|
321
|
+
per_page: limit,
|
|
322
|
+
});
|
|
323
|
+
return data.items.map((item) => normalize(parseWithSchema(searchItemSchema, item)));
|
|
327
324
|
});
|
|
328
|
-
return data.items.map((item) => normalize(parseWithSchema(searchItemSchema, item)));
|
|
329
325
|
} catch (error) {
|
|
330
326
|
const status = (error as { status?: number }).status;
|
|
331
327
|
const message = (error as { message?: string }).message ?? String(error);
|