@jrpool/kilotest 35.1.0 → 36.1.0
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/SERVICE.md +39 -9
- package/index.js +16 -17
- package/mcp.js +4 -0
- package/package.json +1 -1
- package/robots.txt +12 -0
- package/sitemap.xml +1 -0
- package/testOrder/index.js +1 -1
package/SERVICE.md
CHANGED
|
@@ -196,22 +196,52 @@ The Caddy configuration is maintained and tracked in `/etc/caddy/Caddyfile`. Lea
|
|
|
196
196
|
kilotest.com {
|
|
197
197
|
# Enable Zstandard and Gzip compression of responses.
|
|
198
198
|
encode zstd gzip
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
# Specify the only paths of forwardable requests.
|
|
200
|
+
@allowedGET {
|
|
201
|
+
method GET
|
|
202
|
+
path /mcp / /index.html /robots.txt /openapi.yaml /openapi.json /swagger.yaml /swagger.json /api-docs /llms.txt /llms-full.txt *.html* /fullReport.json/* /api/* /tutorial/images/* /favicon.* /style.css /sitemap.xml
|
|
203
|
+
}
|
|
204
|
+
@allowedPOST {
|
|
205
|
+
method POST
|
|
206
|
+
path /mcp /retestRec.html/* /testRec.html/* /recAction.html /reannotate.html /wcagRenew.html /api/* /tutorialComment.html
|
|
207
|
+
}
|
|
208
|
+
@allowedOPTIONS method OPTIONS
|
|
209
|
+
handle @allowedOPTIONS {
|
|
210
|
+
header {
|
|
211
|
+
Access-Control-Allow-Origin *
|
|
212
|
+
Access-Control-Allow-Methods GET,POST,OPTIONS
|
|
213
|
+
Access-Control-Allow-Headers Content-Type,Authorization
|
|
214
|
+
}
|
|
215
|
+
respond 204
|
|
216
|
+
}
|
|
217
|
+
# Truncate any initial /qai from the forwarded path.
|
|
201
218
|
handle_path /qai* {
|
|
202
|
-
# Forward any
|
|
219
|
+
# Forward any QAI request to port 3001.
|
|
203
220
|
reverse_proxy localhost:3001
|
|
204
221
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
222
|
+
# Forward any other GET, POST, or OPTIONS request, if allowed, to port 3000.
|
|
223
|
+
handle @allowedGET {
|
|
224
|
+
reverse_proxy localhost:3000 {
|
|
225
|
+
# Improve SSE latency.
|
|
226
|
+
flush_interval -1
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
handle @allowedPOST {
|
|
230
|
+
reverse_proxy localhost:3000 {
|
|
231
|
+
# Improve SSE latency.
|
|
232
|
+
flush_interval -1
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
# Return not-found for any other request.
|
|
236
|
+
handle {
|
|
237
|
+
respond 404
|
|
210
238
|
}
|
|
211
239
|
}
|
|
212
240
|
```
|
|
213
241
|
|
|
214
|
-
This configuration
|
|
242
|
+
This configuration can be futher tightened if experience warrants.
|
|
243
|
+
|
|
244
|
+
The `flush_interval` setting prevents granular reporting by Testaro agents from being buffered, so the updates reach the browser without delay.
|
|
215
245
|
|
|
216
246
|
## Version management
|
|
217
247
|
|
package/index.js
CHANGED
|
@@ -28,7 +28,7 @@ const {
|
|
|
28
28
|
reportsPath,
|
|
29
29
|
ruleIDs
|
|
30
30
|
} = require('./util');
|
|
31
|
-
const {handleMCP} = require('./mcp');
|
|
31
|
+
const {handleMCP, mcpPath} = require('./mcp');
|
|
32
32
|
const fs = require('fs/promises');
|
|
33
33
|
const http = require('http');
|
|
34
34
|
const https = require('https');
|
|
@@ -210,19 +210,11 @@ const requestHandler = async (request, response) => {
|
|
|
210
210
|
const {pathname, search} = requestURL;
|
|
211
211
|
const pageName = pathname.split('/')[1];
|
|
212
212
|
const pathTail = pathname.split('/').slice(2).join('/');
|
|
213
|
-
// If the request is
|
|
214
|
-
if (method === '
|
|
215
|
-
// Serve response headers, including one allowing requests from other applications.
|
|
216
|
-
response.setHeader('Access-Control-Allow-Origin', '*');
|
|
217
|
-
response.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
218
|
-
response.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
|
219
|
-
response.statusCode = 204;
|
|
220
|
-
response.end();
|
|
221
|
-
}
|
|
222
|
-
// Otherwise, if the request is a GET request:
|
|
223
|
-
else if (method === 'GET') {
|
|
213
|
+
// If the request is a GET request:
|
|
214
|
+
if (method === 'GET') {
|
|
224
215
|
// If it is for the model context protocol server:
|
|
225
|
-
if (pathname ===
|
|
216
|
+
if (pathname === mcpPath) {
|
|
217
|
+
// Handle the MCP request.
|
|
226
218
|
await handleMCP(request, response);
|
|
227
219
|
}
|
|
228
220
|
// Otherwise, if it is for the home page:
|
|
@@ -267,6 +259,13 @@ const requestHandler = async (request, response) => {
|
|
|
267
259
|
setHeaders('text/plain', '/llms-full.txt', 'medium');
|
|
268
260
|
response.end(llmsfull);
|
|
269
261
|
}
|
|
262
|
+
// Otherwise, if it is for the XML sitemap:
|
|
263
|
+
else if (pageName === 'sitemap.xml') {
|
|
264
|
+
const sitemap = await fs.readFile('sitemap.xml', 'utf8');
|
|
265
|
+
// Serve it.
|
|
266
|
+
setHeaders('application/xml', '/sitemap.xml', 'medium');
|
|
267
|
+
response.end(sitemap);
|
|
268
|
+
}
|
|
270
269
|
// Otherwise, if it is for a full report download:
|
|
271
270
|
else if (pageName === 'fullReport.json') {
|
|
272
271
|
const [timeStamp, jobID] = pathTail.split('/');
|
|
@@ -511,12 +510,12 @@ const requestHandler = async (request, response) => {
|
|
|
511
510
|
if (what) {
|
|
512
511
|
// Set a location header for a response.
|
|
513
512
|
response.setHeader('content-location', `${pathname}${search}`);
|
|
514
|
-
// Get the answer data.
|
|
513
|
+
// Get the answer data about the remaining recommendations.
|
|
515
514
|
const answerData = await require(path.join(__dirname, 'testOrder', 'index'))
|
|
516
515
|
.answer(url, what, authCode);
|
|
517
516
|
// If the answer data are valid:
|
|
518
517
|
if (answerData.status === 'ok') {
|
|
519
|
-
// Serve the
|
|
518
|
+
// Serve the test-order page with the remaining recommendations.
|
|
520
519
|
response.end(answerData.answerPage);
|
|
521
520
|
}
|
|
522
521
|
// Otherwise, i.e. if they are invalid:
|
|
@@ -537,7 +536,7 @@ const requestHandler = async (request, response) => {
|
|
|
537
536
|
response.setHeader('content-location', '/recActionForm.html');
|
|
538
537
|
// Get the answer data.
|
|
539
538
|
const answerData = await require(path.join(__dirname, 'recActionForm', 'index')).answer();
|
|
540
|
-
// Serve the test-order form.
|
|
539
|
+
// Serve the test-order form with the remaining recommendations.
|
|
541
540
|
response.end(answerData.answerPage);
|
|
542
541
|
}
|
|
543
542
|
}
|
|
@@ -781,7 +780,7 @@ const requestHandler = async (request, response) => {
|
|
|
781
780
|
}
|
|
782
781
|
// Otherwise, i.e. if it is neither a GET nor a POST request:
|
|
783
782
|
else {
|
|
784
|
-
// Report its invalidity.
|
|
783
|
+
// Report its invalidity. (Caddy handles OPTIONS requests.)
|
|
785
784
|
await serveError({message: 'ERROR: Invalid request method'}, response, true);
|
|
786
785
|
}
|
|
787
786
|
};
|
package/mcp.js
CHANGED
|
@@ -15,6 +15,10 @@ const reportIssuesAPI = require('./reportIssues/api');
|
|
|
15
15
|
const reportIssueAPI = require('./reportIssue/api');
|
|
16
16
|
const testRecFormAPI = require('./testRecForm/api');
|
|
17
17
|
|
|
18
|
+
// CONSTANTS
|
|
19
|
+
|
|
20
|
+
exports.mcpPath = '/mcp';
|
|
21
|
+
|
|
18
22
|
// FUNCTIONS
|
|
19
23
|
|
|
20
24
|
// Creates and returns an McpServer with Kilotest tools registered.
|
package/package.json
CHANGED
package/robots.txt
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
# robots.txt
|
|
2
2
|
User-agent: *
|
|
3
3
|
Allow: /
|
|
4
|
+
Disallow: /ai0BalanceForm.html
|
|
5
|
+
Disallow: /recActionForm.html
|
|
6
|
+
Disallow: /recAction.html
|
|
7
|
+
Disallow: /reannotateForm.html
|
|
8
|
+
Disallow: /reannotate.html
|
|
9
|
+
Disallow: /reportHideForm.html
|
|
10
|
+
Disallow: /reportUnhideForm.html
|
|
11
|
+
Disallow: /reportsPruneForm.html
|
|
12
|
+
Disallow: /reportsRewindForm.html
|
|
13
|
+
Disallow: /reportsExpungeForm.html
|
|
14
|
+
Disallow: /wcagRenewForm.html
|
|
15
|
+
Disallow: /wcagRenew.html
|
|
4
16
|
Sitemap: https://kilotest.com/sitemap.xml
|
package/sitemap.xml
CHANGED
package/testOrder/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const path = require('path');
|
|
|
11
11
|
|
|
12
12
|
// FUNCTIONS
|
|
13
13
|
|
|
14
|
-
// Implements a test order and returns
|
|
14
|
+
// Implements a test order and returns a revised recommendations page.
|
|
15
15
|
exports.answer = async (url, what, authCode) => {
|
|
16
16
|
// If the arguments are valid:
|
|
17
17
|
if (isURL(url) && what && authCode === process.env.AUTH_CODE) {
|