dsh-browserpaw 5.0.0 → 5.0.1
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/README.md +5 -5
- package/index.js +6 -3
- package/package.json +2 -2
- package/skills/browserpaw/SKILL.md +4 -4
- package/skills/browserpaw/assets/recipes/bilibili-popular-videos.json +364 -0
- package/skills/browserpaw/assets/recipes/bilibili-video-detail.json +395 -0
- package/skills/browserpaw/assets/recipes/github-issue-thread.json +313 -0
- package/skills/browserpaw/assets/recipes/github-releases.json +86 -45
- package/skills/browserpaw/assets/recipes/github-repo-readme.json +306 -0
- package/skills/browserpaw/assets/recipes/github-repo-search.json +313 -0
- package/skills/browserpaw/assets/recipes/mdn-search.json +93 -48
- package/skills/browserpaw/assets/recipes/npm-compare.json +6 -4
- package/skills/browserpaw/assets/recipes/reddit-post-read.json +289 -0
- package/skills/browserpaw/assets/recipes/reddit-subreddit-posts.json +331 -0
- package/skills/browserpaw/assets/recipes/v2ex-node-topics.json +334 -0
- package/skills/browserpaw/assets/recipes/v2ex-topic-read.json +325 -0
- package/skills/browserpaw/assets/recipes/x-profile-posts.json +332 -0
- package/skills/browserpaw/assets/recipes/x-search-thread.json +13 -41
- package/skills/browserpaw/assets/recipes/x-visible-thread.json +40 -83
- package/skills/browserpaw/assets/recipes/youtube-search-videos.json +279 -0
- package/skills/browserpaw/assets/recipes/youtube-video-read.json +349 -0
- package/skills/browserpaw/references/recipe-contract.md +4 -3
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "github-repo-readme",
|
|
3
|
+
"name": "GitHub repository and README reader",
|
|
4
|
+
"description": "Read a public GitHub repository's metadata and README markdown via the official GitHub REST API.",
|
|
5
|
+
"source": {
|
|
6
|
+
"type": "builtin",
|
|
7
|
+
"urls": [
|
|
8
|
+
"https://github.com/react/react",
|
|
9
|
+
"https://api.github.com/repos/react/react",
|
|
10
|
+
"https://api.github.com/repos/react/react/readme",
|
|
11
|
+
"https://docs.github.com/en/rest/repos/repos#get-a-repository"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"domains": [
|
|
15
|
+
"github.com",
|
|
16
|
+
"api.github.com"
|
|
17
|
+
],
|
|
18
|
+
"keywords": [
|
|
19
|
+
"github",
|
|
20
|
+
"repo",
|
|
21
|
+
"repository",
|
|
22
|
+
"readme",
|
|
23
|
+
"overview",
|
|
24
|
+
"project",
|
|
25
|
+
"仓库",
|
|
26
|
+
"项目说明"
|
|
27
|
+
],
|
|
28
|
+
"startUrl": "https://github.com/{{owner}}/{{repo}}",
|
|
29
|
+
"inputSchema": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"properties": {
|
|
32
|
+
"owner": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$"
|
|
35
|
+
},
|
|
36
|
+
"repo": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"pattern": "^[A-Za-z0-9._-]{1,100}$"
|
|
39
|
+
},
|
|
40
|
+
"maxReadmeChars": {
|
|
41
|
+
"type": "integer",
|
|
42
|
+
"minimum": 500,
|
|
43
|
+
"maximum": 20000,
|
|
44
|
+
"default": 8000
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"required": [
|
|
48
|
+
"owner",
|
|
49
|
+
"repo"
|
|
50
|
+
],
|
|
51
|
+
"additionalProperties": false
|
|
52
|
+
},
|
|
53
|
+
"outputSchema": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"success": {
|
|
57
|
+
"const": true
|
|
58
|
+
},
|
|
59
|
+
"status": {
|
|
60
|
+
"const": "ok"
|
|
61
|
+
},
|
|
62
|
+
"repository": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"owner": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"pattern": "^[A-Za-z0-9._-]+$"
|
|
68
|
+
},
|
|
69
|
+
"repo": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"pattern": "^[A-Za-z0-9._-]+$"
|
|
72
|
+
},
|
|
73
|
+
"url": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"pattern": "^https://github\\.com/[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$"
|
|
76
|
+
},
|
|
77
|
+
"description": {
|
|
78
|
+
"type": "string"
|
|
79
|
+
},
|
|
80
|
+
"defaultBranch": {
|
|
81
|
+
"type": "string"
|
|
82
|
+
},
|
|
83
|
+
"language": {
|
|
84
|
+
"type": "string"
|
|
85
|
+
},
|
|
86
|
+
"stars": {
|
|
87
|
+
"type": "integer",
|
|
88
|
+
"minimum": 0
|
|
89
|
+
},
|
|
90
|
+
"forks": {
|
|
91
|
+
"type": "integer",
|
|
92
|
+
"minimum": 0
|
|
93
|
+
},
|
|
94
|
+
"openIssues": {
|
|
95
|
+
"type": "integer",
|
|
96
|
+
"minimum": 0
|
|
97
|
+
},
|
|
98
|
+
"license": {
|
|
99
|
+
"oneOf": [
|
|
100
|
+
{
|
|
101
|
+
"type": "string"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"type": "null"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"topics": {
|
|
109
|
+
"type": "array",
|
|
110
|
+
"items": {
|
|
111
|
+
"type": "string"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"updatedAt": {
|
|
115
|
+
"type": "string"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"required": [
|
|
119
|
+
"owner",
|
|
120
|
+
"repo",
|
|
121
|
+
"url",
|
|
122
|
+
"description",
|
|
123
|
+
"defaultBranch",
|
|
124
|
+
"language",
|
|
125
|
+
"stars",
|
|
126
|
+
"forks",
|
|
127
|
+
"openIssues",
|
|
128
|
+
"license",
|
|
129
|
+
"topics",
|
|
130
|
+
"updatedAt"
|
|
131
|
+
],
|
|
132
|
+
"additionalProperties": false
|
|
133
|
+
},
|
|
134
|
+
"readme": {
|
|
135
|
+
"type": "string"
|
|
136
|
+
},
|
|
137
|
+
"readmeTruncated": {
|
|
138
|
+
"type": "boolean"
|
|
139
|
+
},
|
|
140
|
+
"sources": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"properties": {
|
|
143
|
+
"api": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"pattern": "^https://api\\.github\\.com/(?:repos|repositories)/"
|
|
146
|
+
},
|
|
147
|
+
"readme": {
|
|
148
|
+
"oneOf": [
|
|
149
|
+
{
|
|
150
|
+
"type": "string",
|
|
151
|
+
"pattern": "^https://api\\.github\\.com/(?:repos|repositories)/"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"type": "null"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
"page": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"pattern": "^https://github\\.com/"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"required": [
|
|
164
|
+
"api",
|
|
165
|
+
"readme",
|
|
166
|
+
"page"
|
|
167
|
+
],
|
|
168
|
+
"additionalProperties": false
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"required": [
|
|
172
|
+
"success",
|
|
173
|
+
"status",
|
|
174
|
+
"repository",
|
|
175
|
+
"readme",
|
|
176
|
+
"readmeTruncated",
|
|
177
|
+
"sources"
|
|
178
|
+
],
|
|
179
|
+
"additionalProperties": false
|
|
180
|
+
},
|
|
181
|
+
"steps": [
|
|
182
|
+
{
|
|
183
|
+
"tool": "chrome_javascript",
|
|
184
|
+
"args": {
|
|
185
|
+
"code": "const owner = String(input.owner || '').trim();\nconst repo = String(input.repo || '').trim();\nconst maxReadmeChars = Math.max(500, Math.min(Number(input.maxReadmeChars) || 8000, 20000));\nconst repoPath = '/repos/' + encodeURIComponent(owner) + '/' + encodeURIComponent(repo);\nconst repoUrl = new URL(repoPath, 'https://api.github.com').href;\nconst readmeUrl = new URL(repoPath + '/readme', 'https://api.github.com').href;\nconst [repoRes, readmeRes] = await Promise.all([\n fetch(repoUrl, { credentials: 'omit', headers: { Accept: 'application/vnd.github+json' } }),\n fetch(readmeUrl, { credentials: 'omit', headers: { Accept: 'application/vnd.github.raw+json' } })\n]);\nconst classifyAccessError = async (res, fallbackUrl) => {\n const remaining = res.headers && typeof res.headers.get === 'function' ? res.headers.get('x-ratelimit-remaining') : null;\n const reset = res.headers && typeof res.headers.get === 'function' ? res.headers.get('x-ratelimit-reset') : null;\n const retryAfter = res.headers && typeof res.headers.get === 'function' ? res.headers.get('retry-after') : null;\n let message = '';\n try {\n const payload = await res.json();\n if (payload && typeof payload.message === 'string') message = payload.message.trim().slice(0, 300);\n } catch {}\n const limited = res.status === 429 || remaining === '0' || Boolean(retryAfter) || /rate limit|secondary rate/i.test(message);\n return Object.assign(\n { success: false, status: limited ? 'rate_limited' : 'forbidden', repository: owner + '/' + repo, httpStatus: res.status, source: res.url || fallbackUrl },\n reset ? { rateLimitReset: reset } : null,\n retryAfter ? { retryAfter } : null,\n message ? { message } : null\n );\n};\nif (repoRes.status === 403 || repoRes.status === 429) {\n return await classifyAccessError(repoRes, repoUrl);\n}\nif (readmeRes.status === 403 || readmeRes.status === 429) {\n return await classifyAccessError(readmeRes, readmeUrl);\n}\nif (repoRes.status === 404) {\n return { success: false, status: 'not_found', repository: owner + '/' + repo, httpStatus: 404, source: repoRes.url || repoUrl };\n}\nif (!repoRes.ok) {\n return { success: false, status: 'http_error', repository: owner + '/' + repo, httpStatus: repoRes.status, source: repoRes.url || repoUrl };\n}\nlet meta;\ntry {\n meta = await repoRes.json();\n} catch {\n return { success: false, status: 'invalid_json', repository: owner + '/' + repo, source: repoRes.url || repoUrl };\n}\nconst fullName = String((meta && meta.full_name) || '').trim();\nconst slash = fullName.indexOf('/');\nconst resolvedOwner = String((meta && meta.owner && meta.owner.login) || (slash > 0 ? fullName.slice(0, slash) : '')).trim();\nconst resolvedRepo = String((meta && meta.name) || (slash > 0 ? fullName.slice(slash + 1) : '')).trim();\nconst page = String((meta && meta.html_url) || (resolvedOwner && resolvedRepo ? 'https://github.com/' + resolvedOwner + '/' + resolvedRepo : '')).trim();\nif (!/^[A-Za-z0-9._-]+$/.test(resolvedOwner) || !/^[A-Za-z0-9._-]+$/.test(resolvedRepo) || !/^https:\\/\\/github\\.com\\/[A-Za-z0-9._-]+\\/[A-Za-z0-9._-]+$/.test(page)) {\n return { success: false, status: 'schema_changed', repository: owner + '/' + repo, source: repoRes.url || repoUrl };\n}\nlet rawReadme = '';\nlet readmeSource = null;\nif (readmeRes.ok) {\n rawReadme = String(await readmeRes.text() || '');\n readmeSource = readmeRes.url || readmeUrl;\n} else if (readmeRes.status !== 404) {\n return { success: false, status: 'http_error', repository: resolvedOwner + '/' + resolvedRepo, httpStatus: readmeRes.status, source: readmeRes.url || readmeUrl };\n}\nconst readmeTruncated = rawReadme.length > maxReadmeChars;\nconst readme = readmeTruncated ? rawReadme.slice(0, maxReadmeChars) : rawReadme;\nconst license = meta && meta.license && typeof meta.license.spdx_id === 'string' && meta.license.spdx_id !== 'NOASSERTION'\n ? meta.license.spdx_id\n : meta && meta.license && typeof meta.license.name === 'string'\n ? meta.license.name\n : null;\nreturn {\n success: true,\n status: 'ok',\n repository: {\n owner: resolvedOwner,\n repo: resolvedRepo,\n url: page,\n description: String((meta && meta.description) || '').trim().slice(0, 1000),\n defaultBranch: String((meta && meta.default_branch) || '').trim(),\n language: String((meta && meta.language) || '').trim(),\n stars: Math.max(0, Math.floor(Number(meta && meta.stargazers_count) || 0)),\n forks: Math.max(0, Math.floor(Number(meta && meta.forks_count) || 0)),\n openIssues: Math.max(0, Math.floor(Number(meta && meta.open_issues_count) || 0)),\n license,\n topics: Array.isArray(meta && meta.topics) ? meta.topics.filter(t => typeof t === 'string').slice(0, 15) : [],\n updatedAt: String((meta && meta.updated_at) || '').trim()\n },\n readme,\n readmeTruncated,\n sources: {\n api: repoRes.url || repoUrl,\n readme: readmeSource,\n page\n }\n};",
|
|
186
|
+
"timeoutMs": 30000
|
|
187
|
+
},
|
|
188
|
+
"resultPath": "/result"
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"verification": {
|
|
192
|
+
"tool": "chrome_read_dom",
|
|
193
|
+
"args": {
|
|
194
|
+
"format": "compact",
|
|
195
|
+
"selector": "main",
|
|
196
|
+
"activeViewportOnly": false,
|
|
197
|
+
"limit": 80,
|
|
198
|
+
"maxTextLength": 220
|
|
199
|
+
},
|
|
200
|
+
"resultPath": "/treeString"
|
|
201
|
+
},
|
|
202
|
+
"tests": [
|
|
203
|
+
{
|
|
204
|
+
"inputs": {
|
|
205
|
+
"owner": "react",
|
|
206
|
+
"repo": "react",
|
|
207
|
+
"maxReadmeChars": 4000
|
|
208
|
+
},
|
|
209
|
+
"expect": {
|
|
210
|
+
"type": "object",
|
|
211
|
+
"properties": {
|
|
212
|
+
"success": {
|
|
213
|
+
"const": true
|
|
214
|
+
},
|
|
215
|
+
"repository": {
|
|
216
|
+
"type": "object",
|
|
217
|
+
"properties": {
|
|
218
|
+
"owner": {
|
|
219
|
+
"const": "react"
|
|
220
|
+
},
|
|
221
|
+
"repo": {
|
|
222
|
+
"const": "react"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"required": [
|
|
226
|
+
"owner",
|
|
227
|
+
"repo"
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
"readme": {
|
|
231
|
+
"type": "string",
|
|
232
|
+
"minLength": 20
|
|
233
|
+
},
|
|
234
|
+
"sources": {
|
|
235
|
+
"type": "object",
|
|
236
|
+
"required": [
|
|
237
|
+
"api",
|
|
238
|
+
"page"
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"required": [
|
|
243
|
+
"success",
|
|
244
|
+
"repository",
|
|
245
|
+
"readme",
|
|
246
|
+
"sources"
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
"observe": {
|
|
250
|
+
"type": "string",
|
|
251
|
+
"pattern": "/react/react"
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"inputs": {
|
|
256
|
+
"owner": "microsoft",
|
|
257
|
+
"repo": "vscode",
|
|
258
|
+
"maxReadmeChars": 4000
|
|
259
|
+
},
|
|
260
|
+
"expect": {
|
|
261
|
+
"type": "object",
|
|
262
|
+
"properties": {
|
|
263
|
+
"success": {
|
|
264
|
+
"const": true
|
|
265
|
+
},
|
|
266
|
+
"repository": {
|
|
267
|
+
"type": "object",
|
|
268
|
+
"properties": {
|
|
269
|
+
"owner": {
|
|
270
|
+
"const": "microsoft"
|
|
271
|
+
},
|
|
272
|
+
"repo": {
|
|
273
|
+
"const": "vscode"
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
"required": [
|
|
277
|
+
"owner",
|
|
278
|
+
"repo"
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
"readme": {
|
|
282
|
+
"type": "string",
|
|
283
|
+
"minLength": 20
|
|
284
|
+
},
|
|
285
|
+
"sources": {
|
|
286
|
+
"type": "object",
|
|
287
|
+
"required": [
|
|
288
|
+
"api",
|
|
289
|
+
"page"
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"required": [
|
|
294
|
+
"success",
|
|
295
|
+
"repository",
|
|
296
|
+
"readme",
|
|
297
|
+
"sources"
|
|
298
|
+
]
|
|
299
|
+
},
|
|
300
|
+
"observe": {
|
|
301
|
+
"type": "string",
|
|
302
|
+
"pattern": "/microsoft/vscode"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "github-repo-search",
|
|
3
|
+
"name": "GitHub repository search",
|
|
4
|
+
"description": "Search public GitHub repositories via the official GitHub Search API and return source-linked repository metadata.",
|
|
5
|
+
"source": {
|
|
6
|
+
"type": "builtin",
|
|
7
|
+
"urls": [
|
|
8
|
+
"https://github.com/search?q=react&type=repositories",
|
|
9
|
+
"https://api.github.com/search/repositories?q=react&per_page=3",
|
|
10
|
+
"https://docs.github.com/en/rest/search/search#search-repositories"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"domains": [
|
|
14
|
+
"github.com",
|
|
15
|
+
"api.github.com"
|
|
16
|
+
],
|
|
17
|
+
"keywords": [
|
|
18
|
+
"github",
|
|
19
|
+
"repo",
|
|
20
|
+
"repository",
|
|
21
|
+
"repositories",
|
|
22
|
+
"search",
|
|
23
|
+
"open source",
|
|
24
|
+
"开源",
|
|
25
|
+
"仓库搜索",
|
|
26
|
+
"github搜索"
|
|
27
|
+
],
|
|
28
|
+
"startUrl": "https://github.com/search?q={{query}}&type=repositories",
|
|
29
|
+
"inputSchema": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"properties": {
|
|
32
|
+
"query": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"minLength": 1,
|
|
35
|
+
"maxLength": 200
|
|
36
|
+
},
|
|
37
|
+
"limit": {
|
|
38
|
+
"type": "integer",
|
|
39
|
+
"minimum": 1,
|
|
40
|
+
"maximum": 10,
|
|
41
|
+
"default": 5
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"required": [
|
|
45
|
+
"query"
|
|
46
|
+
],
|
|
47
|
+
"additionalProperties": false
|
|
48
|
+
},
|
|
49
|
+
"outputSchema": {
|
|
50
|
+
"oneOf": [
|
|
51
|
+
{
|
|
52
|
+
"type": "object",
|
|
53
|
+
"properties": {
|
|
54
|
+
"success": {
|
|
55
|
+
"const": true
|
|
56
|
+
},
|
|
57
|
+
"status": {
|
|
58
|
+
"const": "ok"
|
|
59
|
+
},
|
|
60
|
+
"query": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"minLength": 1
|
|
63
|
+
},
|
|
64
|
+
"repositories": {
|
|
65
|
+
"type": "array",
|
|
66
|
+
"minItems": 1,
|
|
67
|
+
"maxItems": 10,
|
|
68
|
+
"items": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"properties": {
|
|
71
|
+
"owner": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"pattern": "^[A-Za-z0-9._-]+$"
|
|
74
|
+
},
|
|
75
|
+
"repo": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"pattern": "^[A-Za-z0-9._-]+$"
|
|
78
|
+
},
|
|
79
|
+
"url": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"pattern": "^https://github\\.com/[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$"
|
|
82
|
+
},
|
|
83
|
+
"description": {
|
|
84
|
+
"type": "string"
|
|
85
|
+
},
|
|
86
|
+
"language": {
|
|
87
|
+
"type": "string"
|
|
88
|
+
},
|
|
89
|
+
"stars": {
|
|
90
|
+
"type": "integer",
|
|
91
|
+
"minimum": 0
|
|
92
|
+
},
|
|
93
|
+
"forks": {
|
|
94
|
+
"type": "integer",
|
|
95
|
+
"minimum": 0
|
|
96
|
+
},
|
|
97
|
+
"updatedAt": {
|
|
98
|
+
"type": "string"
|
|
99
|
+
},
|
|
100
|
+
"topics": {
|
|
101
|
+
"type": "array",
|
|
102
|
+
"items": {
|
|
103
|
+
"type": "string"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"required": [
|
|
108
|
+
"owner",
|
|
109
|
+
"repo",
|
|
110
|
+
"url",
|
|
111
|
+
"description",
|
|
112
|
+
"language",
|
|
113
|
+
"stars",
|
|
114
|
+
"forks",
|
|
115
|
+
"updatedAt",
|
|
116
|
+
"topics"
|
|
117
|
+
],
|
|
118
|
+
"additionalProperties": false
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"total": {
|
|
122
|
+
"type": "integer",
|
|
123
|
+
"minimum": 0
|
|
124
|
+
},
|
|
125
|
+
"sources": {
|
|
126
|
+
"type": "object",
|
|
127
|
+
"properties": {
|
|
128
|
+
"api": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"pattern": "^https://api\\.github\\.com/search/repositories\\?"
|
|
131
|
+
},
|
|
132
|
+
"page": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"pattern": "^https://github\\.com/search\\?"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"required": [
|
|
138
|
+
"api",
|
|
139
|
+
"page"
|
|
140
|
+
],
|
|
141
|
+
"additionalProperties": false
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"required": [
|
|
145
|
+
"success",
|
|
146
|
+
"status",
|
|
147
|
+
"query",
|
|
148
|
+
"repositories",
|
|
149
|
+
"total",
|
|
150
|
+
"sources"
|
|
151
|
+
],
|
|
152
|
+
"additionalProperties": false
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"type": "object",
|
|
156
|
+
"properties": {
|
|
157
|
+
"success": {
|
|
158
|
+
"const": true
|
|
159
|
+
},
|
|
160
|
+
"status": {
|
|
161
|
+
"const": "empty"
|
|
162
|
+
},
|
|
163
|
+
"query": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"minLength": 1
|
|
166
|
+
},
|
|
167
|
+
"repositories": {
|
|
168
|
+
"type": "array",
|
|
169
|
+
"minItems": 0,
|
|
170
|
+
"maxItems": 0
|
|
171
|
+
},
|
|
172
|
+
"total": {
|
|
173
|
+
"const": 0
|
|
174
|
+
},
|
|
175
|
+
"sources": {
|
|
176
|
+
"type": "object",
|
|
177
|
+
"properties": {
|
|
178
|
+
"api": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"pattern": "^https://api\\.github\\.com/search/repositories\\?"
|
|
181
|
+
},
|
|
182
|
+
"page": {
|
|
183
|
+
"type": "string",
|
|
184
|
+
"pattern": "^https://github\\.com/search\\?"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"required": [
|
|
188
|
+
"api",
|
|
189
|
+
"page"
|
|
190
|
+
],
|
|
191
|
+
"additionalProperties": false
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"required": [
|
|
195
|
+
"success",
|
|
196
|
+
"status",
|
|
197
|
+
"query",
|
|
198
|
+
"repositories",
|
|
199
|
+
"total",
|
|
200
|
+
"sources"
|
|
201
|
+
],
|
|
202
|
+
"additionalProperties": false
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
"steps": [
|
|
207
|
+
{
|
|
208
|
+
"tool": "chrome_javascript",
|
|
209
|
+
"args": {
|
|
210
|
+
"code": "const query = String(input.query || '').trim();\nconst limit = Math.max(1, Math.min(Number(input.limit) || 5, 10));\nconst endpoint = new URL('/search/repositories', 'https://api.github.com');\nendpoint.searchParams.set('q', query);\nendpoint.searchParams.set('per_page', String(limit));\nconst pageUrl = new URL('/search', 'https://github.com');\npageUrl.searchParams.set('q', query);\npageUrl.searchParams.set('type', 'repositories');\nconst response = await fetch(endpoint.href, { credentials: 'omit', headers: { Accept: 'application/vnd.github+json' } });\nif (response.status === 403 || response.status === 429) {\n const remaining = response.headers && typeof response.headers.get === 'function' ? response.headers.get('x-ratelimit-remaining') : null;\n const reset = response.headers && typeof response.headers.get === 'function' ? response.headers.get('x-ratelimit-reset') : null;\n const retryAfter = response.headers && typeof response.headers.get === 'function' ? response.headers.get('retry-after') : null;\n let message = '';\n try {\n const payload = await response.json();\n if (payload && typeof payload.message === 'string') message = payload.message.trim().slice(0, 300);\n } catch {}\n const limited = response.status === 429 || remaining === '0' || Boolean(retryAfter) || /rate limit|secondary rate/i.test(message);\n return Object.assign(\n { success: false, status: limited ? 'rate_limited' : 'forbidden', query, httpStatus: response.status, source: response.url || endpoint.href },\n reset ? { rateLimitReset: reset } : null,\n retryAfter ? { retryAfter } : null,\n message ? { message } : null\n );\n}\nif (!response.ok) {\n return { success: false, status: 'http_error', query, httpStatus: response.status, source: response.url || endpoint.href };\n}\nlet data;\ntry {\n data = await response.json();\n} catch {\n return { success: false, status: 'invalid_json', query, source: response.url || endpoint.href };\n}\nif (!data || typeof data !== 'object' || !Array.isArray(data.items) || typeof data.total_count !== 'number') {\n return { success: false, status: 'schema_changed', query, source: response.url || endpoint.href };\n}\nif (data.items.length === 0) {\n return {\n success: true,\n status: 'empty',\n query,\n repositories: [],\n total: 0,\n sources: { api: response.url || endpoint.href, page: pageUrl.href }\n };\n}\nconst repositories = data.items\n .slice(0, limit)\n .map(item => {\n const fullName = String((item && item.full_name) || '').trim();\n const slash = fullName.indexOf('/');\n const owner = String((item && item.owner && item.owner.login) || (slash > 0 ? fullName.slice(0, slash) : '')).trim();\n const repo = String((item && item.name) || (slash > 0 ? fullName.slice(slash + 1) : '')).trim();\n const url = String((item && item.html_url) || (owner && repo ? 'https://github.com/' + owner + '/' + repo : '')).trim();\n const stars = Number(item && item.stargazers_count);\n const forks = Number(item && item.forks_count);\n return {\n owner,\n repo,\n url,\n description: String((item && item.description) || '').trim().slice(0, 500),\n language: String((item && item.language) || '').trim(),\n stars: Number.isFinite(stars) && stars >= 0 ? Math.floor(stars) : 0,\n forks: Number.isFinite(forks) && forks >= 0 ? Math.floor(forks) : 0,\n updatedAt: String((item && item.updated_at) || '').trim(),\n topics: Array.isArray(item && item.topics) ? item.topics.filter(t => typeof t === 'string').slice(0, 10) : []\n };\n })\n .filter(item => /^[A-Za-z0-9._-]+$/.test(item.owner) && /^[A-Za-z0-9._-]+$/.test(item.repo) && /^https:\\/\\/github\\.com\\/[A-Za-z0-9._-]+\\/[A-Za-z0-9._-]+$/.test(item.url));\nif (!repositories.length) {\n return { success: false, status: 'schema_changed', query, source: response.url || endpoint.href };\n}\nreturn {\n success: true,\n status: 'ok',\n query,\n repositories,\n total: Math.max(repositories.length, Math.floor(data.total_count)),\n sources: { api: response.url || endpoint.href, page: pageUrl.href }\n};",
|
|
211
|
+
"timeoutMs": 30000
|
|
212
|
+
},
|
|
213
|
+
"resultPath": "/result"
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
"verification": {
|
|
217
|
+
"tool": "chrome_read_dom",
|
|
218
|
+
"args": {
|
|
219
|
+
"format": "compact",
|
|
220
|
+
"selector": "main",
|
|
221
|
+
"activeViewportOnly": false,
|
|
222
|
+
"limit": 80,
|
|
223
|
+
"maxTextLength": 220
|
|
224
|
+
},
|
|
225
|
+
"resultPath": "/treeString"
|
|
226
|
+
},
|
|
227
|
+
"tests": [
|
|
228
|
+
{
|
|
229
|
+
"inputs": {
|
|
230
|
+
"query": "react",
|
|
231
|
+
"limit": 3
|
|
232
|
+
},
|
|
233
|
+
"expect": {
|
|
234
|
+
"type": "object",
|
|
235
|
+
"properties": {
|
|
236
|
+
"success": {
|
|
237
|
+
"const": true
|
|
238
|
+
},
|
|
239
|
+
"status": {
|
|
240
|
+
"const": "ok"
|
|
241
|
+
},
|
|
242
|
+
"query": {
|
|
243
|
+
"const": "react"
|
|
244
|
+
},
|
|
245
|
+
"repositories": {
|
|
246
|
+
"type": "array",
|
|
247
|
+
"minItems": 1
|
|
248
|
+
},
|
|
249
|
+
"sources": {
|
|
250
|
+
"type": "object",
|
|
251
|
+
"required": [
|
|
252
|
+
"api",
|
|
253
|
+
"page"
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"required": [
|
|
258
|
+
"success",
|
|
259
|
+
"status",
|
|
260
|
+
"query",
|
|
261
|
+
"repositories",
|
|
262
|
+
"sources"
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
"observe": {
|
|
266
|
+
"type": "string",
|
|
267
|
+
"pattern": "react/react|q=react"
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"inputs": {
|
|
272
|
+
"query": "typescript",
|
|
273
|
+
"limit": 2
|
|
274
|
+
},
|
|
275
|
+
"expect": {
|
|
276
|
+
"type": "object",
|
|
277
|
+
"properties": {
|
|
278
|
+
"success": {
|
|
279
|
+
"const": true
|
|
280
|
+
},
|
|
281
|
+
"status": {
|
|
282
|
+
"const": "ok"
|
|
283
|
+
},
|
|
284
|
+
"query": {
|
|
285
|
+
"const": "typescript"
|
|
286
|
+
},
|
|
287
|
+
"repositories": {
|
|
288
|
+
"type": "array",
|
|
289
|
+
"minItems": 1
|
|
290
|
+
},
|
|
291
|
+
"sources": {
|
|
292
|
+
"type": "object",
|
|
293
|
+
"required": [
|
|
294
|
+
"api",
|
|
295
|
+
"page"
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"required": [
|
|
300
|
+
"success",
|
|
301
|
+
"status",
|
|
302
|
+
"query",
|
|
303
|
+
"repositories",
|
|
304
|
+
"sources"
|
|
305
|
+
]
|
|
306
|
+
},
|
|
307
|
+
"observe": {
|
|
308
|
+
"type": "string",
|
|
309
|
+
"pattern": "TypeScript|typescript"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
}
|