@jrpool/kilotest 30.0.1 → 30.0.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/index.js +16 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -212,33 +212,44 @@ const requestHandler = async (request, response) => {
|
|
|
212
212
|
setHeaders('text/html', '/index.html', 'medium');
|
|
213
213
|
response.end(homePage);
|
|
214
214
|
}
|
|
215
|
-
// Otherwise, if it is for the
|
|
215
|
+
// Otherwise, if it is for the AI plugin specification:
|
|
216
216
|
else if (pathname === '/.well-known/ai-plugin.json') {
|
|
217
217
|
const aiPlugin = await fs.readFile('.well-known/ai-plugin.json', 'utf8');
|
|
218
|
+
// Serve it.
|
|
218
219
|
setHeaders('application/json', '/.well-known/ai-plugin.json', 'low');
|
|
219
220
|
response.end(aiPlugin);
|
|
220
221
|
}
|
|
221
|
-
// Otherwise, if it is for the
|
|
222
|
+
// Otherwise, if it is for the crawler specification:
|
|
222
223
|
else if (pageName === 'robots.txt') {
|
|
223
224
|
const robots = await fs.readFile('robots.txt', 'utf8');
|
|
225
|
+
// Serve it.
|
|
224
226
|
setHeaders('text/plain', '/robots.txt', 'low');
|
|
225
227
|
response.end(robots);
|
|
226
228
|
}
|
|
227
|
-
// Otherwise, if it is for the
|
|
229
|
+
// Otherwise, if it is for the OpenAPI specification:
|
|
228
230
|
else if (pageName === 'openapi.yaml') {
|
|
229
231
|
const openapi = await fs.readFile('openapi.yaml', 'utf8');
|
|
232
|
+
// Serve it.
|
|
230
233
|
setHeaders('text/yaml', '/openapi.yaml', 'high');
|
|
231
234
|
response.end(openapi);
|
|
232
235
|
}
|
|
233
|
-
// Otherwise, if it is for the
|
|
236
|
+
// Otherwise, if it is for the OpenAPI specification where it is not:
|
|
237
|
+
else if (['openapi.json', 'swagger.yaml', 'swagger.json', 'api-docs'].includes(pageName)) {
|
|
238
|
+
// Redirect the client permanently to where the specification is.
|
|
239
|
+
response.writeHead(301, {Location: '/openapi.yaml'});
|
|
240
|
+
response.end();
|
|
241
|
+
}
|
|
242
|
+
// Otherwise, if it is for the large-language-model summary guide:
|
|
234
243
|
else if (pageName === 'llms.txt') {
|
|
235
244
|
const llms = await fs.readFile('llms.txt', 'utf8');
|
|
245
|
+
// Serve it.
|
|
236
246
|
setHeaders('text/plain', '/llms.txt', 'high');
|
|
237
247
|
response.end(llms);
|
|
238
248
|
}
|
|
239
|
-
// Otherwise, if it is for the
|
|
249
|
+
// Otherwise, if it is for the large-language-model detailed guide:
|
|
240
250
|
else if (pageName === 'llms-full.txt') {
|
|
241
251
|
const llmsfull = await fs.readFile('llms-full.txt', 'utf8');
|
|
252
|
+
// Serve it.
|
|
242
253
|
setHeaders('text/plain', '/llms-full.txt', 'high');
|
|
243
254
|
response.end(llmsfull);
|
|
244
255
|
}
|