openvibers/openvibe.bench Commits
/llms-full.txt holds the API page in full (SEO-33) (#112)
Changes
@@@ -62,10 +62,11 @@ function createDiscoveryRoutes(ctx) {r.get('/llms-full.txt', (_req, res) => {res.type('text/plain').set('Cache-Control', TEXT).send(seo.llmsFull({site: SITE_NAME,-- summary: 'The Bench home and its API docs.',++ summary: 'The Bench home and its API docs, in full.',base: site,maxBytes: 256 * 1024,-- sections: [{ title: 'Pages', pages: PAGES.map((p) => ({ url: p.path, title: p.title, text: p.text })) }],++ // The API page in full (SEO-33: it was one line), from the same view /docs renders.++ sections: [{ title: 'Pages', pages: PAGES.map((p) => (p.path === '/docs' ? { url: p.path, title: p.title, html: require('../views').docs() } : { url: p.path, title: p.title, text: p.text })) }],}));});nnew file mode 100644@@@ -0,0 +1,20 @@++'use strict';++// SEO-33: /llms-full.txt holds the API page in full (it was one line a page, 314 characters in all), from the same++// view /docs renders, so a language model reading it learns the API without fetching HTML.++const assert = require('assert');++const { boot, check, done } = require('./helpers/boot');++++(async () => {++ const t = await boot();++ await check('llms-full.txt: the home, then the API page in full', async () => {++ const r = await t.get('/llms-full.txt');++ assert.strictEqual(r.status, 200);++ assert.match(r.headers.get('content-type') || '', /^text\/plain/);++ assert.ok(r.text.startsWith('# OpenVibe.Bench'));++ assert.match(r.text, /### The Bench API\n\nURL: [^\n]*\/docs\n/);++ assert.ok(r.text.length > 2000, `${r.text.length} characters`);++ assert.ok(!/<\/?(div|p|span|a|code|pre|section|h[1-6]|li|ul|ol|table|tr|td|th|button|nav)\b[^>]*>/i.test(r.text.split('### The Bench API')[1] || ''), 'the page as text, no markup');++ });++ await check('stop', async () => { await t.close(); });++ done();++})();
@@ -62,10 +62,11 @@ function createDiscoveryRoutes(ctx) {
@@ -62,10 +62,11 @@ function createDiscoveryRoutes(ctx) {
r.get('/llms-full.txt', (_req, res) => {
r.get('/llms-full.txt', (_req, res) => {
res.type('text/plain').set('Cache-Control', TEXT).send(seo.llmsFull({
res.type('text/plain').set('Cache-Control', TEXT).send(seo.llmsFull({
site: SITE_NAME,
site: SITE_NAME,
- summary: 'The Bench home and its API docs.',
+ summary: 'The Bench home and its API docs, in full.',
base: site,
base: site,
maxBytes: 256 * 1024,
maxBytes: 256 * 1024,
- sections: [{ title: 'Pages', pages: PAGES.map((p) => ({ url: p.path, title: p.title, text: p.text })) }],
+ // The API page in full (SEO-33: it was one line), from the same view /docs renders.
+ sections: [{ title: 'Pages', pages: PAGES.map((p) => (p.path === '/docs' ? { url: p.path, title: p.title, html: require('../views').docs() } : { url: p.path, title: p.title, text: p.text })) }],
}));
}));
});
});
new file mode 100644
new file mode 100644
@@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
+'use strict';
+// SEO-33: /llms-full.txt holds the API page in full (it was one line a page, 314 characters in all), from the same
+// view /docs renders, so a language model reading it learns the API without fetching HTML.
+const assert = require('assert');
+const { boot, check, done } = require('./helpers/boot');
+
+(async () => {
+ const t = await boot();
+ await check('llms-full.txt: the home, then the API page in full', async () => {
+ const r = await t.get('/llms-full.txt');
+ assert.strictEqual(r.status, 200);
+ assert.match(r.headers.get('content-type') || '', /^text\/plain/);
+ assert.ok(r.text.startsWith('# OpenVibe.Bench'));
+ assert.match(r.text, /### The Bench API\n\nURL: [^\n]*\/docs\n/);
+ assert.ok(r.text.length > 2000, `${r.text.length} characters`);
+ assert.ok(!/<\/?(div|p|span|a|code|pre|section|h[1-6]|li|ul|ol|table|tr|td|th|button|nav)\b[^>]*>/i.test(r.text.split('### The Bench API')[1] || ''), 'the page as text, no markup');
+ });
+ await check('stop', async () => { await t.close(); });
+ done();
+})();