openvibers/openvibe.finance Commits

llms-full.txt: the welcome page as words (#34)

OP OpenVibers committed 3 days ago · aa9abd925b · 2 files, +47 −1

/llms-full.txt was a 404 to agents (11-28, tools/llms-check.js). It is the llms.txt header and the welcome page in
Markdown from its own render (signed out, as a crawler sees it), open to every crawler, and llms.txt links it under
Optional. Test: llms-full.

Changes

ddiff --git a/server/app.js b/server/app.js
iindex 2bb5707..d51453b 100644
---- a/server/app.js
++++ b/server/app.js
@@@ -40,7 +40,7 @@ function createApp({ db, vault, auth, mcpAuth = null, baseUrl = 'https://openvib
// Out of the index: everything but the public welcome (GET /) and the crawl files. This header used to go on every
// response, the welcome too, and it outweighs the page's own "index, follow": the 11-23 crawl found the home
// noindex while its sitemap listed it. A signed-in person's pages (their money) get it again below.
-- const INDEXABLE = new Set(['/', '/robots.txt', '/sitemap.xml', '/llms.txt']);
++ const INDEXABLE = new Set(['/', '/robots.txt', '/sitemap.xml', '/llms.txt', '/llms-full.txt']);
app.use((req, res, next) => {
res.set({ 'X-Content-Type-Options': 'nosniff', 'Referrer-Policy': 'same-origin', 'X-Frame-Options': 'DENY' });
if (!((req.method === 'GET' || req.method === 'HEAD') && INDEXABLE.has(req.path))) res.set('X-Robots-Tag', 'noindex, nofollow');
@@@ -61,7 +61,19 @@ function createApp({ db, vault, auth, mcpAuth = null, baseUrl = 'https://openvib
'A personal finance desk on your OpenVibe account: accounts and balances, CSV imports, the month at a glance, bills, what is ahead, goals and rules. Your data is private to you and exports in full.', '',
'## Pages', '',
'- [OpenVibe.Finance](https://openvibe.finance/): what it does, and the way in with your OpenVibe account', '',
++ '## Optional', '',
++ '- [Full text (llms-full.txt)](https://openvibe.finance/llms-full.txt): the page above as words', '',
].join('\n')));
++ // The full text for language models (SEO-33): the welcome page llms.txt lists, as Markdown from its own render
++ // (11-28: /llms-full.txt was a 404, tools/llms-check.js). Signed out, as a crawler sees it: never anyone's money.
++ app.get('/llms-full.txt', (_req, res) => {
++ const words = require('openvibe-shared/agent-layer').markdownTwin({ html: v.welcome(), canonical: 'https://openvibe.finance/' }).replace(/^---[\s\S]*?\n---\n/, '').trim();
++ res.type('text').set('Cache-Control', 'public, max-age=3600').send(seo.llmsFull({
++ site: { name: 'OpenVibe.Finance', url: 'https://openvibe.finance' },
++ summary: 'Your money, your rules, your data: accounts, imports and a monthly picture, private to you.',
++ sections: [{ title: 'OpenVibe.Finance', url: '/', body: words }],
++ }));
++ });
app.use(express.static(path.join(__dirname, '..', 'public'), { maxAge: '1h' }));
app.use('/shared', require('openvibe-shared/serve').handler());
if (auth) app.use('/auth', auth.router(express));
ddiff --git a/test/llms-full.test.js b/test/llms-full.test.js
nnew file mode 100644
iindex 0000000..93fd263
---- /dev/null
++++ b/test/llms-full.test.js
@@@ -0,0 +1,34 @@
++'use strict';
++// /llms-full.txt (SEO-33): the welcome page llms.txt lists, as words, open to every crawler (11-28: it was a 404 to
++// agents, tools/llms-check.js). Signed out, as a crawler sees it: never anyone's money.
++const assert = require('assert');
++const path = require('node:path');
++const crypto = require('node:crypto');
++const { createTestDb } = require('openvibe-sdk/testing');
++const { createVault } = require('../server/crypto');
++const { createApp } = require('../server/app');
++
++(async () => {
++ const { db, close } = await createTestDb({ migrations: path.join(__dirname, '..', 'migrations'), store: process.env.FINANCE_TEST_STORE || 'pglite', service: 'finance' });
++ const vault = createVault(crypto.randomBytes(32).toString('base64'));
++ const auth = { router: (express) => express.Router(), optionalAuth: () => (req, _res, next) => next() };
++ const server = createApp({ db, vault, auth }).listen(0, '127.0.0.1');
++ await new Promise((r) => server.once('listening', r));
++ const base = `http://127.0.0.1:${server.address().port}`;
++ try {
++ const r = await fetch(`${base}/llms-full.txt`);
++ assert.strictEqual(r.status, 200);
++ assert.match(r.headers.get('content-type'), /^text\/plain/);
++ assert.ok(!/noindex/.test(r.headers.get('x-robots-tag') || ''), 'open to crawlers');
++ const text = await r.text();
++ assert.ok(text.startsWith('# OpenVibe.Finance'), 'the same header as llms.txt');
++ assert.ok(text.includes('Your money, your rules, your data'), 'the welcome page\'s words');
++ assert.ok(text.length > 500 && !/<(?:script|style|section)\b/i.test(text), 'words, not markup');
++ const llms = await (await fetch(`${base}/llms.txt`)).text();
++ assert.ok(llms.includes('(https://openvibe.finance/llms-full.txt)'), 'llms.txt points at it');
++ } finally {
++ server.close();
++ await close();
++ }
++ console.log('llms-full: the welcome page as words, linked from llms.txt, open to crawlers');
++})().catch((e) => { console.error(e); process.exit(1); });