Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { SUPPORTED_LANGUAGES, SITE_TITLES } from "./src/config/i18n";
import { firebaseIntegration } from "./src/integrations/firebase";
import { remarkClientOnly } from "./src/plugins";
import { devServerFileWatcher } from "./src/integrations/dev-server-file-watcher";
import { llmsTxtIndex } from "./src/integrations/llms-txt-index";
import onDemandDirective from "./src/integrations/client-on-demand/register.js";
import { cspConfig } from "./src/config/csp";
import { monacoEditorIntegration } from "./src/integrations/monacoEditor";
Expand Down Expand Up @@ -152,6 +153,20 @@ export default defineConfig({
}),
starlightLlmsTxt({
rawContent: true,
description:
"Developer documentation for the Aptos blockchain — Move smart contracts, SDKs, APIs, indexer, node operations, and AI tools.",
optionalLinks: [
{
label: "Aptos MCP Server",
url: "https://www.npmjs.com/package/@anthropic-ai/aptos-mcp",
description: "MCP server for AI coding tools",
},
{
label: "Aptos GitHub",
url: "https://github.com/aptos-labs",
description: "Official source code repositories",
},
],
promote: [
"index*",
"get-started",
Expand Down Expand Up @@ -197,6 +212,10 @@ export default defineConfig({
sidebar,
customCss: ["./src/styles/global.css", "katex/dist/katex.min.css"],
}),
// Override the starlight-llms-txt plugin's /llms.txt index with a structured
// version that lists page titles, descriptions, and per-page .md URLs.
// Must be after Starlight so our injected route takes priority.
llmsTxtIndex(),
sitemap({
serialize(item) {
item.lastmod = new Date().toISOString();
Expand Down
14 changes: 9 additions & 5 deletions src/content/docs/build/ai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Aptos provides first-class support for AI-powered development workflows. Whether
assistant or an AI chat tool, you can give it deep knowledge of the Aptos blockchain, Move language, SDKs,
and APIs.

## AskAptos Chatbot

The AskAptos chatbot is built into the documentation site — look for it in the top-right corner of the navigation bar. It can answer questions about Aptos concepts, help you plan implementations, and point you to the right documentation pages.

## Aptos MCP Server

The [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) lets AI coding tools directly call
Expand All @@ -27,10 +31,10 @@ Aptos APIs, query on-chain data, and generate correct Aptos code — without nee
The [LLMs.txt standard](https://llmstxt.org/) provides machine-readable documentation feeds that AI tools
can ingest to understand the full Aptos documentation. We publish three feeds to suit different context window sizes:

| Feed | URL | Best for |
| ------------------ | ------------------------------------ | ------------------------------------------- |
| **llms.txt** | [`/llms.txt`](/llms.txt) | Structured index of all doc sections |
| **llms-small.txt** | [`/llms-small.txt`](/llms-small.txt) | Condensed docs for smaller context windows |
| **llms-full.txt** | [`/llms-full.txt`](/llms-full.txt) | Full documentation — all pages concatenated |
| Feed | URL | Best for |
| ------------------ | ------------------------------------ | ------------------------------------------------------------------------- |
| **llms.txt** | [`/llms.txt`](/llms.txt) | Structured index with page titles, descriptions, and per-page `.md` links |
| **llms-small.txt** | [`/llms-small.txt`](/llms-small.txt) | Condensed docs for smaller context windows |
| **llms-full.txt** | [`/llms-full.txt`](/llms-full.txt) | Full documentation — all pages concatenated |

<LinkCard href="/llms-txt" title="How to use LLMs.txt with AI tools" description="Instructions for Cursor, GitHub Copilot, Claude.ai, ChatGPT, Windsurf, and more" />
14 changes: 9 additions & 5 deletions src/content/docs/es/build/ai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Aptos ofrece soporte de primera clase para flujos de trabajo de desarrollo poten
un asistente de codificación con IA o una herramienta de chat con IA, puedes darle un conocimiento profundo
de la blockchain Aptos, el lenguaje Move, SDKs y APIs.

## Chatbot AskAptos

El chatbot AskAptos está integrado en el sitio de documentación — búscalo en la esquina superior derecha de la barra de navegación. Puede responder preguntas sobre conceptos de Aptos, ayudarte a planificar implementaciones y dirigirte a las páginas de documentación correctas.

## Servidor MCP de Aptos

El [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) permite que las herramientas de codificación
Expand All @@ -29,10 +33,10 @@ El [estándar LLMs.txt](https://llmstxt.org/) proporciona feeds de documentació
herramientas de IA pueden ingerir para comprender la documentación completa de Aptos. Publicamos tres feeds
para adaptarse a diferentes tamaños de ventana de contexto:

| Feed | URL | Ideal para |
| ------------------ | ------------------------------------ | --------------------------------------------------------------- |
| **llms.txt** | [`/llms.txt`](/llms.txt) | Índice estructurado de todas las secciones de documentación |
| **llms-small.txt** | [`/llms-small.txt`](/llms-small.txt) | Documentación condensada para ventanas de contexto más pequeñas |
| **llms-full.txt** | [`/llms-full.txt`](/llms-full.txt) | Documentación completa — todas las páginas concatenadas |
| Feed | URL | Ideal para |
| ------------------ | ------------------------------------ | ------------------------------------------------------------------------- |
| **llms.txt** | [`/llms.txt`](/llms.txt) | Índice estructurado con títulos, descripciones y enlaces `.md` por página |
| **llms-small.txt** | [`/llms-small.txt`](/llms-small.txt) | Documentación condensada para ventanas de contexto más pequeñas |
| **llms-full.txt** | [`/llms-full.txt`](/llms-full.txt) | Documentación completa — todas las páginas concatenadas |

<LinkCard href="/es/llms-txt" title="Cómo usar LLMs.txt con herramientas de IA" description="Instrucciones para Cursor, GitHub Copilot, Claude.ai, ChatGPT, Windsurf y más" />
2 changes: 1 addition & 1 deletion src/content/docs/es/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import ListCard from '~/components/ListCard.astro';
</ListCard>

<ListCard title="Herramientas" iconName="terminal">
- [¡Nuevo! Chatbot de IA AskAptos](#) Consulta documentación, planifica o refina requisitos con IA (¡arriba a la derecha!).
- [¡Nuevo! Chatbot de IA AskAptos](/es/build/ai) Consulta documentación, planifica o refina requisitos con IA (¡arriba a la derecha!).
- [Testnet Faucet](/es/network/faucet) Financia tu cuenta de testnet con APT para comenzar a construir.
- [SDKs Oficiales](/es/build/sdks) TypeScript, Go, Java, Python, Rust, C++, Unity y más.
- [Aptos CLI](/es/build/cli) Compila, prueba, publica contratos; cuentas y claves; localnet.
Expand Down
19 changes: 19 additions & 0 deletions src/content/docs/es/llms-txt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,27 @@ Proporcionamos las siguientes rutas de LLMs.txt para ayudar a las herramientas d
- [llms-small.txt](/llms-small.txt) - Proporciona una versión condensada de la documentación, optimizada para ventanas de contexto más pequeñas
- [llms-full.txt](/llms-full.txt) - Proporciona la documentación completa y exhaustiva para todos los conceptos de Aptos

## Acceso Markdown por Página

Cada página de documentación también está disponible como Markdown sin procesar agregando `.md` a la URL:

| URL de la Página | URL Markdown |
| -------------------------------------------------- | ----------------------------------------------------- |
| `https://aptos.dev/build/guides/first-transaction` | `https://aptos.dev/build/guides/first-transaction.md` |
| `https://aptos.dev/build/sdks/ts-sdk` | `https://aptos.dev/build/sdks/ts-sdk.md` |

Esto es útil para herramientas de IA que necesitan obtener páginas individuales con el mínimo de tokens, en lugar de ingerir la documentación completa. El índice [llms.txt](/llms.txt) lista todas las páginas con sus URLs `.md` y descripciones para que tu herramienta de IA pueda elegir exactamente qué páginas leer.

## Uso con Herramientas de IA

### Claude Code

Agrega el contexto de la documentación de Aptos a proyectos de [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview):

1. Agrega `https://aptos.dev/llms.txt` al archivo `CLAUDE.md` de tu proyecto como referencia
2. Claude Code leerá el índice y obtendrá las páginas relevantes a través de URLs `.md` según sea necesario
3. Para una integración más profunda con herramientas on-chain, consulta [Aptos MCP para Claude Code](/es/build/ai/aptos-mcp/claude)

### Cursor

Usa la función `@Docs` en Cursor para incluir los archivos LLMs.txt en tu proyecto. Esto ayuda a Cursor a proporcionar sugerencias de código y documentación más precisas para el desarrollo en Aptos.
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import ListCard from '~/components/ListCard.astro';
</ListCard>

<ListCard title="Tools" iconName="terminal">
- [NEW! AskAptos AI Chatbot](#) Query docs, plan or refine requirements with AI (top right!).
- [NEW! AskAptos AI Chatbot](/build/ai) Query docs, plan or refine requirements with AI (top right!).
- [Testnet Faucet](/network/faucet) Fund your testnet account with APT to start building.
- [Official SDKs](/build/sdks) TypeScript, Go, Java, Python, Rust, C++, Unity, and more.
- [Aptos CLI](/build/cli) Compile, test, publish contracts; accounts & keys; localnet.
Expand Down
19 changes: 19 additions & 0 deletions src/content/docs/llms-txt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,27 @@ We provide the following LLMs.txt routes to help AI tools access our documentati
- [llms-small.txt](/llms-small.txt) - Provides a condensed version of the documentation, optimized for smaller context windows
- [llms-full.txt](/llms-full.txt) - Provides the full comprehensive documentation for all Aptos concepts

## Per-Page Markdown Access

Every documentation page is also available as raw Markdown by appending `.md` to the URL:

| Page URL | Markdown URL |
| -------------------------------------------------- | ----------------------------------------------------- |
| `https://aptos.dev/build/guides/first-transaction` | `https://aptos.dev/build/guides/first-transaction.md` |
| `https://aptos.dev/build/sdks/ts-sdk` | `https://aptos.dev/build/sdks/ts-sdk.md` |

This is useful for AI tools that need to fetch individual pages with minimal tokens, rather than ingesting the full documentation. The [llms.txt](/llms.txt) index lists all pages with their `.md` URLs and descriptions so your AI tool can pick exactly which pages to read.

## Usage with AI Tools

### Claude Code

Add Aptos documentation context to [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview) projects:

1. Add `https://aptos.dev/llms.txt` to your project's `CLAUDE.md` file as a reference
2. Claude Code will read the index and fetch relevant pages via `.md` URLs as needed
3. For deeper integration with on-chain tools, see [Aptos MCP for Claude Code](/build/ai/aptos-mcp/claude)

### Cursor

Use the `@Docs` feature in Cursor to include the LLMs.txt files in your project. This helps Cursor provide more accurate
Expand Down
14 changes: 9 additions & 5 deletions src/content/docs/zh/build/ai.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import { CardGrid, LinkCard } from '@astrojs/starlight/components';
Aptos 为 AI 驱动的开发工作流提供一流支持。无论您使用的是 AI 编程助手还是 AI 聊天工具,
都可以让它深入了解 Aptos 区块链、Move 语言、SDK 和 API。

## AskAptos 聊天机器人

AskAptos 聊天机器人已内置于文档站点中——在导航栏右上角查找即可。它可以回答关于 Aptos 概念的问题,帮助您规划实现方案,并指引您到正确的文档页面。

## Aptos MCP 服务器

[模型上下文协议 (MCP)](https://modelcontextprotocol.io/) 让 AI 编程工具能够直接调用 Aptos API、
Expand All @@ -26,10 +30,10 @@ Aptos 为 AI 驱动的开发工作流提供一流支持。无论您使用的是
[LLMs.txt 标准](https://llmstxt.org/)提供机器可读的文档源,AI 工具可以摄取这些内容以理解完整的 Aptos
文档。我们发布三种文档源以适应不同的上下文窗口大小:

| 文档源 | URL | 最适合 |
| ------------------ | ------------------------------------ | --------------- |
| **llms.txt** | [`/llms.txt`](/llms.txt) | 所有文档章节的结构化索引 |
| **llms-small.txt** | [`/llms-small.txt`](/llms-small.txt) | 适合较小上下文窗口的压缩文档 |
| **llms-full.txt** | [`/llms-full.txt`](/llms-full.txt) | 完整文档——所有页面串联在一起 |
| 文档源 | URL | 最适合 |
| ------------------ | ------------------------------------ | --------------------------- |
| **llms.txt** | [`/llms.txt`](/llms.txt) | 包含页面标题、描述和逐页 `.md` 链接的结构化索引 |
| **llms-small.txt** | [`/llms-small.txt`](/llms-small.txt) | 适合较小上下文窗口的压缩文档 |
| **llms-full.txt** | [`/llms-full.txt`](/llms-full.txt) | 完整文档——所有页面串联在一起 |

<LinkCard href="/zh/llms-txt" title="如何在 AI 工具中使用 LLMs.txt" description="Cursor、GitHub Copilot、Claude.ai、ChatGPT、Windsurf 等工具的使用说明" />
2 changes: 1 addition & 1 deletion src/content/docs/zh/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import ListCard from '~/components/ListCard.astro';
</ListCard>

<ListCard title="工具" iconName="terminal">
- [新!AskAptos AI 聊天机器人](#) 查询文档,规划或完善需求(右上角!)。
- [新!AskAptos AI 聊天机器人](/zh/build/ai) 查询文档,规划或完善需求(右上角!)。
- [测试网水龙头](/zh/network/faucet) 为你的测试网账户提供 APT 资金以开始构建。
- [官方 SDK](/zh/build/sdks) TypeScript、Go、Java、Python、Rust、C++、Unity 等。
- [Aptos CLI](/zh/build/cli) 编译、测试、发布合约;账户和密钥;本地网络。
Expand Down
19 changes: 19 additions & 0 deletions src/content/docs/zh/llms-txt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,27 @@ description: 如何让 Cursor、GitHub Copilot、ChatGPT 和 Claude 等工具理
- [llms-small.txt](/llms-small.txt) - 提供文档的压缩版本,针对较小的上下文窗口进行了优化
- [llms-full.txt](/llms-full.txt) - 提供所有 Aptos 概念的完整综合文档

## 逐页 Markdown 访问

每个文档页面也可以通过在 URL 后添加 `.md` 获取原始 Markdown 格式:

| 页面 URL | Markdown URL |
| -------------------------------------------------- | ----------------------------------------------------- |
| `https://aptos.dev/build/guides/first-transaction` | `https://aptos.dev/build/guides/first-transaction.md` |
| `https://aptos.dev/build/sdks/ts-sdk` | `https://aptos.dev/build/sdks/ts-sdk.md` |

这对于需要以最少 token 获取单个页面的 AI 工具非常有用,而不必摄取完整的文档。[llms.txt](/llms.txt) 索引列出了所有页面及其 `.md` URL 和描述,以便您的 AI 工具可以准确选择要阅读的页面。

## 与 AI 工具的使用

### Claude Code

将 Aptos 文档上下文添加到 [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview) 项目:

1. 将 `https://aptos.dev/llms.txt` 添加到项目的 `CLAUDE.md` 文件中作为参考
2. Claude Code 会读取索引并根据需要通过 `.md` URL 获取相关页面
3. 如需更深层次的链上工具集成,请参阅 [Aptos MCP for Claude Code](/zh/build/ai/aptos-mcp/claude)

### Cursor

在 Cursor 中使用 `@Docs` 功能将 LLMs.txt 文件包含在您的项目中。这有助于 Cursor 为 Aptos 开发提供更准确的代码建议和文档。
Expand Down
25 changes: 25 additions & 0 deletions src/integrations/llms-txt-index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { AstroIntegration, RouteOptions } from "astro";

/**
* Overrides the starlight-llms-txt plugin's /llms.txt index route with a structured
* version that lists all pages with titles, descriptions, and per-page .md URLs.
*
* Uses the astro:route:setup hook to swap the plugin's entrypoint for our custom handler
* while keeping the llms-full.txt and llms-small.txt routes from the plugin untouched.
*/
export function llmsTxtIndex(): AstroIntegration {
return {
name: "llms-txt-index",
hooks: {
"astro:route:setup": ({ route }: { route: RouteOptions }) => {
// Only override the plugin's /llms.txt index route (not full/small/custom)
if (
route.component.includes("starlight-llms-txt") &&
route.component.endsWith("/llms.txt.ts")
) {
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The route component override uses a type cast that bypasses TypeScript's type system. While this may be necessary given Astro's integration API, consider adding a comment explaining why the cast is needed and ensuring the route.component property is indeed writable at runtime. Additionally, verify that the component path is correct and relative to the project root.

Suggested change
) {
) {
// NOTE: Astro's RouteOptions type treats `component` as effectively read-only,
// but the `astro:route:setup` integration hook is explicitly designed to allow
// reassigning `route.component` at runtime in order to swap out the route handler.
// We assert a mutable `component` property here to satisfy TypeScript while relying
// on Astro's documented behavior that this mutation is supported.
// The replacement path is intended to be relative to the project root and must
// point to a valid page/component file that will handle the `/llms.txt` route.

Copilot uses AI. Check for mistakes.
(route as { component: string }).component = "./src/pages/llms-index.ts";
}
},
},
};
}
Loading