11#!/usr/bin/env node
22// Repository documentation for AI clients. No runtime or website output.
3- import { existsSync , readdirSync , readFileSync , writeFileSync } from 'node:fs' ;
3+ import { existsSync , readdirSync , readFileSync , realpathSync , writeFileSync } from 'node:fs' ;
44import { dirname , posix , resolve } from 'node:path' ;
55import { fileURLToPath } from 'node:url' ;
66
77const ROOT = resolve ( dirname ( fileURLToPath ( import . meta. url ) ) , '..' ) ;
88const RAW = 'https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/' ;
99const GITHUB = 'https://github.com/HelpCode-ai/anythingmcp/blob/main/' ;
10+ // Contributor credits and Cloud operator internals are not product guides.
11+ export const EXCLUDED_DOCS = [
12+ 'docs/AUTHORS.md' ,
13+ 'docs/operations/card-trial-offer.md' ,
14+ 'docs/operations/signup-attribution.md' ,
15+ ] ;
1016const SECTIONS = [
1117 [ 'Getting started' , [ 'README.md' , 'docs/deployment.md' , 'docs/guides.md' ] ] ,
1218 [ 'Connectors' , [ 'docs/connectors/*.md' , 'docs/tool-definition.md' ] ] ,
1319 [ 'AI clients' , [ 'docs/integrations/*.md' ] ] ,
1420 [ 'Operations and security' , [ 'docs/operations/*.md' , 'docs/sso.md' , 'docs/scim-entra-setup.md' , 'docs/license-faq.md' ] ] ,
15- [ 'Reference' , [ 'docs/api-reference.md' , 'docs/mcp-resources.md' , 'docs/knowledge-graph.md' ] ] ,
21+ [ 'Reference' , [ 'docs/api-reference.md' , 'docs/mcp-resources.md' , 'docs/knowledge-graph.md' , 'docs/memory.md' ] ] ,
1622 [ 'Contributing' , [ '.github/CONTRIBUTING.md' , 'AGENTS.md' ] ] ,
1723 [ 'Optional' , [ 'docs/guides/*.md' , 'docs/ROADMAP.md' , 'docs/ADOPTERS.md' ] ] ,
1824] ;
@@ -21,6 +27,9 @@ const DESCRIPTIONS = {
2127 'docs/deployment.md' : 'Deploy AnythingMCP with Docker and configure authentication, networking, and production settings.' ,
2228 'docs/connectors/login-token-auth.md' : 'Build connectors that exchange credentials for cached bearer tokens with automatic refresh and re-login.' ,
2329 'docs/api-reference.md' : 'REST API reference for authentication, connectors, tools, MCP servers, and administration.' ,
30+ 'docs/tool-definition.md' : 'Define MCP tool parameters, endpoint mappings, response transforms, and adapter metadata.' ,
31+ 'docs/operations/observability.md' : 'Configure structured logging, Sentry error reporting, and Prometheus metrics for your deployment.' ,
32+ 'docs/ROADMAP.md' : 'Review current development priorities, planned features, and contribution opportunities.' ,
2433 'docs/guides/connect-sorare-to-chatgpt.md' : 'Connect Sorare fantasy football tools to ChatGPT through AnythingMCP.' ,
2534 'docs/guides/connect-sorare-to-claude.md' : 'Connect Sorare fantasy football tools to Claude Desktop and Claude Code.' ,
2635 'docs/guides/connect-sorare-to-cloud.md' : 'Use AnythingMCP Cloud to connect the Sorare GraphQL API without a local server.' ,
@@ -122,9 +131,9 @@ function renderHtml(text, inline = false) {
122131}
123132
124133function plain ( text ) {
125- const entities = { '&' : '&' , '<' : '<' , '>' : '>' } ;
134+ const entities = { '&' : '&' , '<' : '<' , '>' : '>' , ' ' : ' ' } ;
126135 return renderHtml ( text . replace ( / \[ ( [ ^ \] ] + ) \] \( [ ^ ) ] * \) / g, '$1' ) , true )
127- . replace ( / [ * ` ] / g, '' ) . replace ( / & (?: a m p | l t | g t ) ; / g, entity => entities [ entity ] )
136+ . replace ( / [ * ` ] / g, '' ) . replace ( / & (?: a m p | l t | g t | n b s p ) ; / g, entity => entities [ entity ] )
128137 . replace ( / \s + / g, ' ' ) . trim ( ) ;
129138}
130139
@@ -137,7 +146,7 @@ export function collectDocuments(root = ROOT) {
137146 return readdirSync ( resolve ( root , dir ) , { withFileTypes : true } )
138147 . filter ( entry => entry . isFile ( ) && entry . name . endsWith ( '.md' ) )
139148 . map ( entry => `${ dir } /${ entry . name } ` ) . sort ( ) ;
140- } ) ,
149+ } ) . filter ( path => ! EXCLUDED_DOCS . includes ( path ) ) ,
141150 } ) ) ;
142151}
143152
@@ -214,8 +223,8 @@ export function cleanMarkdown(markdown, source) {
214223 . replace ( / < p \b [ ^ > ] * > \s * < s t r o n g > ( A n y t h i n g M C P [ \s \S ] * ?) < \/ s t r o n g > [ \s \S ] * ?< \/ p > / i,
215224 ( _ , summary ) => `${ plain ( summary ) } \n` ) ;
216225 }
217- text = renderHtml ( text ) ;
218- return code . restore ( rewriteProseLinks ( text , source ) . replace ( / \n { 3 , } / g, '\n\n' ) . trim ( ) ) ;
226+ text = renderHtml ( text ) . replace ( / & n b s p ; / g , ' ' ) ;
227+ return code . restore ( rewriteProseLinks ( text , source ) . replace ( / ^ [ \t ] + $ / gm , '' ) . replace ( / \n { 3 , } / g, '\n\n' ) . trim ( ) ) ;
219228}
220229
221230function metadata ( content , path ) {
@@ -247,7 +256,7 @@ export function generate(root = ROOT) {
247256 return { 'llms.txt' : index , 'llms-full.txt' : full } ;
248257}
249258
250- if ( process . argv [ 1 ] && resolve ( process . argv [ 1 ] ) === fileURLToPath ( import . meta. url ) ) {
259+ if ( process . argv [ 1 ] && realpathSync ( process . argv [ 1 ] ) === fileURLToPath ( import . meta. url ) ) {
251260 try {
252261 if ( process . argv . slice ( 2 ) . some ( arg => arg !== '--check' ) ) throw new Error ( 'Usage: node scripts/generate-llms-txt.mjs [--check]' ) ;
253262 const check = process . argv . includes ( '--check' ) ;
0 commit comments