### Create Basic Web Server Source: https://llms-full-txt.ru/llms-full.txt A quick example demonstrating how to initialize an application, define a root route, and start the server. ```javascript const app = createApp() app.get('/', (req, res) => { res.send('Hello World!') }) app.listen(3000) ``` -------------------------------- ### Install Framework Core Source: https://llms-full-txt.ru/llms-full.txt Installs the core framework package via npm. ```bash npm install @framework/core ``` -------------------------------- ### Install llmstxt-architect using uvx Source: https://llms-full-txt.ru/llms-full.txt Installs and runs the llmstxt-architect tool quickly using uvx, a command-line tool for managing Python environments and executing scripts. ```bash # Быстрый запуск через uvx curl -LsSf https://astral.sh/uv/install.sh | sh uvx --from llmstxt-architect llmstxt-architect --help ``` -------------------------------- ### VitePress Integration with vitepress-plugin-llms Source: https://llms-full-txt.ru/guides/getting-started This command demonstrates how to install the 'vitepress-plugin-llms' package for integrating llms.txt functionality with VitePress projects. Further configuration steps would typically follow in the VitePress setup. ```bash npm install vitepress-plugin-llms ``` -------------------------------- ### Install and Run llmstxt CLI Source: https://llms-full-txt.ru/llms-full.txt Instructions for globally installing the llmstxt CLI using npm or running it directly with npx. This enables the generation of llms.txt files from sitemaps. ```bash # Global installation npm install -g llmstxt # Or run via npx (without installation) npx llmstxt gen https://example.com/sitemap.xml ``` -------------------------------- ### Structure llms.txt content Source: https://llms-full-txt.ru/specification/sections An example of a well-structured llms.txt file following the recommended hierarchy, including project metadata, documentation links, guides, examples, and optional community resources. ```markdown # FastHTML > Modern Python web framework for building fast, interactive web applications. Key features:- No JavaScript required- HTMX integration- Server-side rendering ## Documentation - [Getting Started](https://fastht.ml/docs/): Quick start guide- [Tutorial](https://fastht.ml/docs/tutorial): Step-by-step tutorial- [API Reference](https://fastht.ml/docs/api): Complete API docs ## Guides - [Forms](https://fastht.ml/docs/guides/forms): Working with forms- [Database](https://fastht.ml/docs/guides/db): Database integration- [Deployment](https://fastht.ml/docs/guides/deploy): Production deployment ## Examples - [Todo App](https://github.com/fasthtml/examples/todo): Basic todo application- [Blog](https://github.com/fasthtml/examples/blog): Blog with comments- [E-commerce](https://github.com/fasthtml/examples/shop): Shopping cart demo ## Optional - [Changelog](https://fastht.ml/changelog): Version history- [Contributing](https://github.com/fasthtml/fasthtml/CONTRIBUTING.md): Contribution guide- [Discord](https://discord.gg/fasthtml): Community chat ``` -------------------------------- ### Quick start template for llms.txt Source: https://llms-full-txt.ru/llms-full.txt A boilerplate template for creating a new llms.txt file, including sections for documentation, API references, and optional resources. ```markdown # Название проекта > Краткое описание проекта в одну-две строки ## Документация - [Быстрый старт](https://example.com/quickstart): Начните здесь - [API Reference](https://example.com/api): Полное описание API - [Примеры](https://example.com/examples): Готовые решения ## Optional - [Changelog](https://example.com/changelog): История изменений - [Contributing](https://example.com/contributing): Как внести вклад ``` -------------------------------- ### Full llmstxt Generation Example with Exclusions and Replacements Source: https://llms-full-txt.ru/llms-full.txt A comprehensive example demonstrating the generation of llms.txt, including excluding specific paths, performing regex replacements on titles, setting custom metadata, and controlling concurrency. The output is redirected to 'llms.txt'. ```bash npx llmstxt@latest gen https://docs.example.com/sitemap.xml \ -ep "**/blog/**" \ -ep "**/changelog/**" \ -ep "**/privacy" \ -ep "**/terms" \ -rt 's/\| Docs//' \ -t 'Example Docs' \ -d 'Official documentation for Example' \ -c 5 \ > llms.txt ``` -------------------------------- ### Install and Configure MkDocs LLMs.txt Source: https://llms-full-txt.ru/tools/generators Instructions for integrating llms.txt generation into MkDocs. This requires installing the plugin via pip and enabling it in the mkdocs.yml configuration file. ```bash pip install mkdocs-llmstxt ``` ```yaml plugins: - llmstxt ``` -------------------------------- ### Install Docusaurus Plugin Source: https://llms-full-txt.ru/guides/getting-started Installs the docusaurus-plugin-llms-txt package using npm. This plugin is likely used to integrate llms.txt functionality within a Docusaurus documentation site. ```bash npm install docusaurus-plugin-llms-txt ``` -------------------------------- ### Example llms.txt Content Structure Source: https://llms-full-txt.ru/llms-full.txt A standard Markdown structure for an llms.txt file, providing a summary, documentation links, and example references for AI crawlers. ```markdown # FastHTML > Python library for building fast, interactive web applications with HTMX. ## Documentation - [Getting Started](https://fastht.ml/docs/): Quick start guide for new users - [Tutorial](https://fastht.ml/docs/tutorial): Step-by-step walkthrough - [API Reference](https://fastht.ml/docs/api): Complete API documentation ## Examples - [Todo App](https://github.com/fasthtml/examples/todo): Basic todo application - [Blog](https://github.com/fasthtml/examples/blog): Blog with comments ``` -------------------------------- ### Configure Framework Plugins for llms.txt Source: https://llms-full-txt.ru/llms-full.txt Configuration examples for integrating llms.txt generation into various static site generators and frameworks. ```javascript // astro.config.mjs export default defineConfig({ integrations: [ starlight({ plugins: [starlightLlmsTxt()], }), ], }) ``` ```javascript // .vitepress/config.js export default { vite: { plugins: [llmsPlugin()], }, } ``` ```javascript // docusaurus.config.js module.exports = { plugins: ['docusaurus-plugin-llms-txt'], } ``` ```yaml # mkdocs.yml plugins: - llmstxt ``` -------------------------------- ### Configure mcpdoc MCP Server Source: https://llms-full-txt.ru/reference/mcp-relationship Configuration for an mcpdoc MCP server, specifying the command, arguments, and URLs to fetch documentation from. This setup allows the MCP server to act as a data source for AI tools. ```json { "mcpServers": { "docs": { "command": "uvx", "args": [ "--from", "mcpdoc", "mcpdoc", "--urls", "Astro:https://docs.astro.build/llms.txt", "Stripe:https://docs.stripe.com/llms.txt", "--transport", "stdio" ] } } } ``` -------------------------------- ### Install and Configure llms.txt for Astro/Starlight Source: https://llms-full-txt.ru/llms-full.txt Instructions for adding the starlight-llms-txt plugin to an Astro project. Requires installing the package via pnpm and registering the plugin in the astro.config.mjs file. ```bash pnpm add starlight-llms-txt ``` ```javascript // astro.config.mjs export default defineConfig({ integrations: [ starlight({ plugins: [starlightLlmsTxt()], }), ], }) ``` -------------------------------- ### Install and Configure llms.txt for MkDocs Source: https://llms-full-txt.ru/llms-full.txt Steps to integrate llms.txt generation into a MkDocs project. Involves installing the Python package and enabling the plugin in the mkdocs.yml configuration file. ```bash pip install mkdocs-llmstxt ``` ```yaml # mkdocs.yml plugins: - llmstxt ``` -------------------------------- ### Self-Host llm.codes Source: https://llms-full-txt.ru/llms-full.txt Instructions for cloning the repository, installing dependencies, and running the development server. Requires environment variables for Firecrawl API and optional Redis caching. ```bash git clone https://github.com/amantus-ai/llm-codes cd llm-codes npm install npm run dev ``` ```bash FIRECRAWL_API_KEY=fc-... # Обязательно UPSTASH_REDIS_URL=... # Опционально (для кэша) ``` -------------------------------- ### Install and Configure Starlight LLMs.txt Source: https://llms-full-txt.ru/tools/generators Instructions for adding the starlight-llms-txt plugin to an Astro/Starlight project. This involves installing the package via pnpm and registering the integration within the astro.config.mjs file. ```bash pnpm add starlight-llms-txt ``` ```javascript import starlightLlmsTxt from 'starlight-llms-txt' export default defineConfig({ integrations: [ starlight({ plugins: [starlightLlmsTxt()], }), ], }) ``` -------------------------------- ### Group links by content type and platform Source: https://llms-full-txt.ru/specification/sections Examples showing how to organize links within an llms.txt file by logical categories such as content type (Tutorials, API) or technical platform (JavaScript, Python). ```markdown ## Tutorials - [Beginner Tutorial](url): For new users (30 min)- [Advanced Tutorial](url): Deep dive (2 hours)- [Video Course](url): Video walkthrough ## API Reference - [REST API](url): HTTP endpoints- [GraphQL API](url): GraphQL schema- [SDK Reference](url): Client libraries ## JavaScript - [npm Package](url): Installation and usage- [Browser Guide](url): Browser integration ## Python - [PyPI Package](url): pip installation- [Django Integration](url): Django setup ``` -------------------------------- ### Structure Content for AI Optimization Source: https://llms-full-txt.ru/llms-full.txt Examples of structuring content using Markdown headers, tables, and FAQ formats to ensure high-quality extraction and citation by AI models. ```markdown ## Часто задаваемые вопросы ### Нужен ли llms.txt моему сайту? Если у вас документация, блог или продуктовый сайт — да. | Файл | Назначение | |------|------------| | llms.txt | Индекс со ссылками | ``` -------------------------------- ### Install llms.txt for Nuxt Source: https://llms-full-txt.ru/llms-full.txt Command to add the official nuxt-llms module to a Nuxt project using the nuxi CLI. ```bash npx nuxi module add nuxt-llms ``` -------------------------------- ### Define llms.txt Markdown Structure Source: https://llms-full-txt.ru/specification/format Example of the required and recommended structure for an llms.txt file, including H1 headers and blockquotes for AI context optimization. ```markdown # FastHTML > FastHTML — это Python-библиотека для создания быстрых веб-приложений с использованием HTMX и современных веб-стандартов. ## Секция H2 - [Название ссылки](URL): Описание ресурса ``` -------------------------------- ### Configure custom summary prompts Source: https://llms-full-txt.ru/llms-full.txt Example of how to override the default summary prompt via the CLI to focus on specific documentation aspects like API endpoints. ```bash llmstxt-architect \ --urls https://example.com \ --summary-prompt "Summarize this API documentation. Focus on endpoints and use cases." \ --project-dir output ``` -------------------------------- ### Автоматизация генерации llms.txt в GitHub Actions Source: https://llms-full-txt.ru/guides/best-practices Пример конфигурации GitHub Actions для автоматической генерации llms.txt на основе sitemap.xml при каждом обновлении документации. ```yaml name: Update llms.txt on: push: paths: ['docs/**'] jobs: update: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npx llmstxt gen https://example.com/sitemap.xml > public/llms.txt - run: | git add public/llms.txt git diff --staged --quiet || git commit -m "Update llms.txt" git push ``` -------------------------------- ### Run mcpdoc to Serve llms.txt Source: https://llms-full-txt.ru/reference/mcp-relationship Command to run mcpdoc, transforming a specified llms.txt file into an MCP server. It includes arguments for specifying the source, the target MCP server, and the URLs to fetch documentation from. ```bash uvx --from mcpdoc mcpdoc \ --urls "Astro:https://docs.astro.build/llms.txt" \ --transport stdio ``` -------------------------------- ### Implement Theme Toggling with StarlightThemeProvider Source: https://llms-full-txt.ru/reference/mcp-relationship Handles theme switching between light, dark, and auto modes. It uses localStorage for persistence and updates the document dataset and UI pickers accordingly. ```javascript const n="starlight-theme"; function c(e){return e==="auto"||e==="dark"||e==="light"?e:"auto"} function l(){return c(typeof localStorage<"u"&&localStorage.getItem(n))} function i(e){typeof localStorage<"u"&&localStorage.setItem(n,e==="light"||e==="dark"?e:"")} function s(){return matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"} function t(e){StarlightThemeProvider.updatePickers(e),document.documentElement.dataset.theme=e==="auto"?s():e,i(e)} matchMedia("(prefers-color-scheme: light)").addEventListener("change",()=>{l()==="auto"&&t("auto")}); customElements.define("starlight-theme-black-select",class extends HTMLElement{constructor(){super(),t(l());const a=this.querySelector("button");a?.addEventListener("click",()=>{const o=c(document.documentElement.dataset.theme),r=o==="dark"?"light":o==="light"?"dark":"auto";t(r),a?.setAttribute("aria-label",`${r} theme`)})}}); ``` -------------------------------- ### Install llmstxt-architect using pip Source: https://llms-full-txt.ru/llms-full.txt Installs the llmstxt-architect Python package using pip, allowing it to be used in your Python projects or from the command line. ```bash # Или установка через pip pip install llmstxt-architect ``` -------------------------------- ### GET /api/scrape (with query parameters) Source: https://llms-full-txt.ru/llms-full.txt An alternative way to use the scraping API via GET requests, passing parameters as query arguments. ```APIDOC ## GET /api/scrape ### Description Scrapes a given URL and converts its documentation into Markdown format using GET request parameters. This is a convenient alternative for simple scraping tasks. ### Method GET ### Endpoint /api/scrape ### Parameters #### Query Parameters - **url** (string) - Required - The URL of the documentation to scrape. - **depth** (integer) - Optional - The crawling depth. 0 means only the specified page, 1 means the page plus direct links, 2 is recommended for most cases, and 5 for a full documentation section. Defaults to 2. ### Request Example ```bash curl -s "https://llm.codes/api/scrape?url=https://docs.example.com&depth=1" ``` ### Response #### Success Response (200) - **markdown** (string) - The generated Markdown content of the documentation. #### Response Example ```json { "markdown": "# Example Documentation\n\nThis is an example documentation page..." } ``` ``` -------------------------------- ### Initialize Analytics and Tracking Services Source: https://llms-full-txt.ru/tools/generators Asynchronously loads multiple tracking scripts including Google Tag Manager, Yandex Metrika, Google Analytics, and Microsoft Clarity. This ensures performance is not blocked while enabling comprehensive user behavior analytics. ```javascript setTimeout(function(){(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f)})(window,document,'script','dataLayer','GTM-WQGDHGGQ');(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};m[i].l=1*new Date();for(var j=0;j ' "$FILE"; then echo "✓ Blockquote found" else echo "⚠ No blockquote (recommended)" fi # Link count LINKS=$(grep -c '^\- \[' "$FILE") echo " Links: $LINKS" # Links without descriptions NO_DESC=$(grep '^\- \[' "$FILE" | grep -cv ':') if [ "$NO_DESC" -gt 0 ]; then echo "⚠ $NO_DESC links without descriptions" else echo "✓ All links have descriptions" fi # Check for broken URLs echo "Checking URLs..." grep -oP 'https?://[^\)]+' "$FILE" | while read -r url; do STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 "$url") if [ "$STATUS" != "200" ]; then echo " ✗ $STATUS $url" fi done echo "---" echo "Done." ``` -------------------------------- ### YAML для CI/CD автогенерации llms.txt Source: https://llms-full-txt.ru/llms-full.txt Пример конфигурации GitHub Actions для автоматической генерации и обновления файла llms.txt при изменениях в директории 'docs'. Скрипт использует 'npx llmstxt gen' для генерации файла и затем добавляет его в коммит, если есть изменения. ```yaml # .github/workflows/update-llms-txt.yml name: Update llms.txt on: push: paths: ['docs/**'] jobs: update: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npx llmstxt gen https://example.com/sitemap.xml > public/llms.txt - run: | git add public/llms.txt git diff --staged --quiet || git commit -m "Update llms.txt" git push ``` -------------------------------- ### Microsoft Clarity Initialization Source: https://llms-full-txt.ru/specification/sections Этот JavaScript-код инициализирует Microsoft Clarity для анализа поведения пользователей. Он асинхронно загружает скрипт Clarity и вставляет его в DOM, используя предоставленный идентификатор 'vv4m3ol48w'. ```javascript setTimeout(function(){ (function(c,l,a,r,i,t,y){ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; t=l.createElement(r); t.async=1; t.src="https://www.clarity.ms/tag/"+i; y=l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t,y) })(window,document,"clarity","script","vv4m3ol48w") }, 100); ``` -------------------------------- ### Clean Titles During Generation Source: https://llms-full-txt.ru/llms-full.txt Demonstrates the use of the --replace-title option to clean up page titles by removing repetitive text. This example removes '| Example' from all titles. ```bash # Remove '| Example' from all titles npx llmstxt gen https://example.com/sitemap.xml \ --replace-title 's/| Example//' ``` -------------------------------- ### GET /v1/customers/{id} Source: https://llms-full-txt.ru/llms-full.txt Retrieves the details of an existing customer. ```APIDOC ## GET /v1/customers/{id} ### Description Retrieves the details of an existing customer object. ### Method GET ### Endpoint /v1/customers/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the customer. ### Request Example GET /v1/customers/cus_12345 ### Response #### Success Response (200) - **id** (string) - The customer ID. - **email** (string) - The customer's email address. #### Response Example { "id": "cus_12345", "email": "test@example.com" } ``` -------------------------------- ### Parsing llms.txt with PHP Source: https://llms-full-txt.ru/llms-full.txt Installing the PHP library for parsing and generating llms.txt files. ```bash composer require nicholasgasior/llms-txt-php ``` -------------------------------- ### Create llms.txt File Content Source: https://llms-full-txt.ru/guides/getting-started This snippet shows the expected content for the llms.txt file, including project title, description, and documentation/guide links. It serves as a template for summarizing website content. ```markdown # Мой проект > Краткое описание проекта — что он делает и для кого предназначен. Дополнительная информация о проекте, которая поможет LLM понять контекст. ## Документация - [Быстрый старт](https://example.com/docs/quickstart): Пошаговое руководство для новых пользователей- [Установка](https://example.com/docs/installation): Требования и инструкции по установке- [API Reference](https://example.com/docs/api): Полное описание всех эндпоинтов ## Руководства - [Аутентификация](https://example.com/guides/auth): Как настроить авторизацию- [Деплой](https://example.com/guides/deploy): Развёртывание в production ## Optional - [Changelog](https://example.com/changelog): История изменений- [Contributing](https://example.com/contributing): Как внести вклад в проект ``` -------------------------------- ### Toggle Theme with StarlightThemeProvider Source: https://llms-full-txt.ru/guides/best-practices Handles theme toggling functionality using StarlightThemeProvider. It manages theme persistence in localStorage and updates the theme based on user selection or system preference. Dependencies include StarlightThemeProvider and matchMedia API. ```javascript const n = "starlight-theme"; function c(e) { return e === "auto" || e === "dark" || e === "light" ? e : "auto"; } function l() { return c(typeof localStorage < "u" && localStorage.getItem(n)); } function i(e) { typeof localStorage < "u" && localStorage.setItem(n, e === "light" || e === "dark" ? e : ""); } function s() { return matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark"; } function t(e) { StarlightThemeProvider.updatePickers(e), document.documentElement.dataset.theme = e === "auto" ? s() : e, i(e); } matchMedia("(prefers-color-scheme: light)").addEventListener("change", () => { l() === "auto" && t("auto"); }); customElements.define("starlight-theme-black-select", class extends HTMLElement { constructor() { super(); t(l()); const a = this.querySelector("button"); a?.addEventListener("click", () => { const o = c(document.documentElement.dataset.theme), r = o === "dark" ? "light" : o === "light" ? "dark" : "auto"; t(r), a?.setAttribute("aria-label", `${r} theme`); }); } }); ``` -------------------------------- ### Парсинг llms.txt с использованием Python Source: https://llms-full-txt.ru/specification/format Функция на Python для парсинга содержимого файла llms.txt. Она извлекает заголовок H1, блок-цитату (описание) и секции со ссылками. Требует стандартную библиотеку `re`. ```python import re def parse_llms_txt(content: str) -> dict: result = {'title': '', 'description': '', 'sections': {}} # Извлечь H1 h1_match = re.search(r'^# (.+)$', content, re.MULTILINE) if h1_match: result['title'] = h1_match.group(1) # Извлечь blockquote bq_match = re.search(r'^> (.+)$', content, re.MULTILINE) if bq_match: result['description'] = bq_match.group(1) # Извлечь секции и ссылки current_section = 'default' for line in content.split('\n'): if line.startswith('## '): current_section = line[3:].strip() result['sections'][current_section] = [] elif line.startswith('- ['): match = re.match(r'- [(.+?)]\((.+?)\)(?:: (.+))?', line) if match: result['sections'].setdefault(current_section, []).append({ 'title': match.group(1), 'url': match.group(2), 'description': match.group(3) or '' }) return result ``` -------------------------------- ### Parsing llms.txt with Python Source: https://llms-full-txt.ru/llms-full.txt Installation and usage of the llms-txt Python library to parse and convert llms.txt content into context objects. ```bash pip install llms-txt ``` ```python from llms_txt import parse_llms_txt, to_context # Парсинг with open('llms.txt') as f: data = parse_llms_txt(f.read()) # Конвертация в контекст context = to_context(data, include_optional=False) ``` -------------------------------- ### Basic llmstxt-architect Usage with Local Ollama Model Source: https://llms-full-txt.ru/llms-full.txt Illustrates how to connect llmstxt-architect to a locally running Ollama instance for description generation. Ensure Ollama is running and the desired model is available. ```bash # Запустите Ollama ollama serve llmstxt-architect \ --urls https://docs.example.com \ --max-depth 1 \ --llm-name llama3.2:latest \ --llm-provider ollama \ --project-dir output ```