@jrpool/kilotest 30.0.0 → 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 +21 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -212,27 +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
|
+
else if (pathname === '/.well-known/ai-plugin.json') {
|
|
217
|
+
const aiPlugin = await fs.readFile('.well-known/ai-plugin.json', 'utf8');
|
|
218
|
+
// Serve it.
|
|
219
|
+
setHeaders('application/json', '/.well-known/ai-plugin.json', 'low');
|
|
220
|
+
response.end(aiPlugin);
|
|
221
|
+
}
|
|
222
|
+
// Otherwise, if it is for the crawler specification:
|
|
216
223
|
else if (pageName === 'robots.txt') {
|
|
217
224
|
const robots = await fs.readFile('robots.txt', 'utf8');
|
|
225
|
+
// Serve it.
|
|
218
226
|
setHeaders('text/plain', '/robots.txt', 'low');
|
|
219
227
|
response.end(robots);
|
|
220
228
|
}
|
|
221
|
-
// Otherwise, if it is for the
|
|
229
|
+
// Otherwise, if it is for the OpenAPI specification:
|
|
222
230
|
else if (pageName === 'openapi.yaml') {
|
|
223
231
|
const openapi = await fs.readFile('openapi.yaml', 'utf8');
|
|
232
|
+
// Serve it.
|
|
224
233
|
setHeaders('text/yaml', '/openapi.yaml', 'high');
|
|
225
234
|
response.end(openapi);
|
|
226
235
|
}
|
|
227
|
-
// 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:
|
|
228
243
|
else if (pageName === 'llms.txt') {
|
|
229
244
|
const llms = await fs.readFile('llms.txt', 'utf8');
|
|
245
|
+
// Serve it.
|
|
230
246
|
setHeaders('text/plain', '/llms.txt', 'high');
|
|
231
247
|
response.end(llms);
|
|
232
248
|
}
|
|
233
|
-
// Otherwise, if it is for the
|
|
249
|
+
// Otherwise, if it is for the large-language-model detailed guide:
|
|
234
250
|
else if (pageName === 'llms-full.txt') {
|
|
235
251
|
const llmsfull = await fs.readFile('llms-full.txt', 'utf8');
|
|
252
|
+
// Serve it.
|
|
236
253
|
setHeaders('text/plain', '/llms-full.txt', 'high');
|
|
237
254
|
response.end(llmsfull);
|
|
238
255
|
}
|