-
Notifications
You must be signed in to change notification settings - Fork 112
docs: add LLMs.txt and Changelog section #645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
6895c9d
f1cb971
c6a3c8a
627c24d
4bdbeb0
a464d00
8bb8f8f
f962de9
f9b52b5
3957b0a
af6e8f4
24a76a3
b1f6d1b
d4d31ef
d7266b7
61c662e
7f3eeca
8476826
5046550
6382698
73fc502
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@stackflow/docs": minor | ||
| --- | ||
|
|
||
| Add LLMs.txt and changelog section |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| /.next | ||
| /out | ||
| .open-next | ||
| .open-next | ||
|
|
||
| /public/llms-*.txt | ||
| /public/llms.txt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| { | ||
| "get-started": "Get Started", | ||
| "advanced": "Advanced Usage" | ||
| "advanced": "Advanced Usage", | ||
| "ai-integration": "AI Integration", | ||
| "changelog": "Changelog" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| { | ||
| "get-started": "시작하기", | ||
| "advanced": "활용하기" | ||
| "advanced": "활용하기", | ||
| "ai-integration": "AI 통합", | ||
| "changelog": "변경 이력" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "llms-txt": "LLMs.txt" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "llms-txt": "LLMs.txt" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| title: LLMs.txt | ||
| --- | ||
|
|
||
| # LLMs.txt | ||
|
|
||
| We provide an LLMs.txt setup to help large language models (LLMs) easily understand Stackflow. | ||
|
|
||
| ### Structure | ||
|
|
||
| We provide the following LLMs.txt files: | ||
|
|
||
| - [llms.txt](https://stackflow.so/llms.txt): The main file that describes the structure of all LLMs.txt files. | ||
| - [llms-full.txt](https://stackflow.so/llms-full.txt): Includes all Stackflow documentation. | ||
| - [llms-changelog.txt](https://stackflow.so/llms-changelog.txt): Contains the latest updates and changes so you can review version-by-version history. | ||
|
|
||
| ### Using with AI tools | ||
| #### Cursor | ||
| You can include the LLMs.txt files in your project using Cursor's @Docs feature. | ||
|
|
||
| [**Learn more about Cursor @Docs**](https://docs.cursor.com/context/@-symbols/@-docs) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| title: LLMs.txt | ||
| --- | ||
|
|
||
| # LLMs.txt | ||
|
|
||
| 대규모 언어 모델(LLM)이 Stackflow를 쉽게 이해할 수 있도록 LLMs.txt를 제공합니다. | ||
|
|
||
| ### 구조 | ||
|
|
||
| 다음과 같은 LLMs.txt 파일들을 제공합니다: | ||
|
|
||
| - [llms.txt](https://stackflow.so/llms.txt): LLMs.txt 파일들의 구조를 제공하는 메인 파일입니다. | ||
| - [llms-full.txt](https://stackflow.so/llms-full.txt): Stackflow의 모든 문서를 포함합니다. | ||
| - [llms-changelog.txt](https://stackflow.so/llms-changelog.txt): 최신 업데이트와 변경사항을 포함하여 버전별 변경 내역을 확인할 수 있습니다. | ||
|
|
||
| ### AI 도구와 함께 사용하기 | ||
| #### Cursor | ||
| Cursor의 @Docs 기능을 사용하여 프로젝트에 LLMs.txt 파일을 포함할 수 있습니다. | ||
|
|
||
| [**Cursor @Docs에 대해 자세히 알아보기**](https://docs.cursor.com/context/@-symbols/@-docs) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| --- | ||
| title: Changelog | ||
| --- | ||
|
|
||
| ## 2025.10.24 #2 | ||
|
|
||
| Add LLMs.txt and changelog section | ||
|
|
||
| Released packages: | ||
| - 📦 [@stackflow/docs@2.1.0](https://npmjs.com/package/@stackflow/docs/v/2.1.0) | ||
|
|
||
| --- | ||
|
|
||
| ## 2025.10.24 | ||
|
|
||
| Add LLMs.txt and changelog section | ||
|
|
||
| Released packages: | ||
| - 📦 [@stackflow/docs@2.1.0](https://npmjs.com/package/@stackflow/docs/v/2.1.0) | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| --- | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| --- | ||
| title: Changelog | ||
| --- | ||
|
|
||
| ## 2025.10.24 #2 | ||
|
|
||
| Add LLMs.txt and changelog section | ||
|
|
||
| Released packages: | ||
| - 📦 [@stackflow/docs@2.1.0](https://npmjs.com/package/@stackflow/docs/v/2.1.0) | ||
|
|
||
| --- | ||
|
|
||
| ## 2025.10.24 | ||
|
|
||
| Add LLMs.txt and changelog section | ||
|
|
||
| Released packages: | ||
| - 📦 [@stackflow/docs@2.1.0](https://npmjs.com/package/@stackflow/docs/v/2.1.0) | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| --- | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import fs from "node:fs"; | ||
| import path from "node:path"; | ||
| import matter from "gray-matter"; | ||
| import { remark } from "remark"; | ||
| import remarkGfm from "remark-gfm"; | ||
| import remarkStringify from "remark-stringify"; | ||
| import { baseUrl } from "../utils/constants"; | ||
| import { getAllPages } from "../utils/get-all-pages"; | ||
|
|
||
| async function generateLlmsFull() { | ||
| const pages = getAllPages(); | ||
| const content = pages | ||
| .map((page) => `# ${page.title}\n\n${page.content}`) | ||
| .join("\n\n"); | ||
|
|
||
| const outputPath = path.join(process.cwd(), "public/llms-full.txt"); | ||
| fs.writeFileSync(outputPath, content); | ||
| console.log(`Generated ${outputPath}`); | ||
| } | ||
|
|
||
| async function generateLlmsChangelog() { | ||
| const changelogPath = path.join(process.cwd(), "pages/docs/changelog.en.mdx"); | ||
| const fileContent = fs.readFileSync(changelogPath, "utf-8"); | ||
| const { content } = matter(fileContent); | ||
|
|
||
| const processed = await remark() | ||
| .use(remarkGfm) | ||
| .use(remarkStringify) | ||
| .process(content); | ||
|
|
||
| const response = `# Stackflow - Changelog\n\n${String(processed)}`; | ||
|
|
||
| const outputPath = path.join(process.cwd(), "public/llms-changelog.txt"); | ||
| fs.writeFileSync(outputPath, response); | ||
| console.log(`Generated ${outputPath}`); | ||
| } | ||
|
|
||
| async function generateLlmsIndex() { | ||
| const content = ` | ||
| # Stackflow Documentation for LLMs | ||
|
|
||
| ## Documentation Sets | ||
|
|
||
| - [llms-full.txt](${new URL("/llms-full.txt", baseUrl)}): Complete documentation of Stackflow | ||
| - [llms-changelog.txt](${new URL("/llms-changelog.txt", baseUrl)}): Latest updates and version history | ||
| `.trim(); | ||
|
|
||
| const outputPath = path.join(process.cwd(), "public/llms.txt"); | ||
| fs.writeFileSync(outputPath, content); | ||
| console.log(`Generated ${outputPath}`); | ||
| } | ||
|
|
||
| async function main() { | ||
| try { | ||
| // Ensure public directory exists | ||
| const publicDir = path.join(process.cwd(), "public"); | ||
| if (!fs.existsSync(publicDir)) { | ||
| fs.mkdirSync(publicDir); | ||
| } | ||
|
|
||
| await generateLlmsFull(); | ||
| await generateLlmsChangelog(); | ||
| await generateLlmsIndex(); | ||
| } catch (error) { | ||
| console.error("Error generating LLMS txt files:", error); | ||
| process.exit(1); | ||
| } | ||
| } | ||
|
|
||
| main(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "lib": [ | ||
| "dom", | ||
| "dom.iterable", | ||
| "esnext" | ||
| ], | ||
| "allowJs": true, | ||
| "skipLibCheck": true, | ||
| "strict": false, | ||
| "noEmit": true, | ||
| "incremental": true, | ||
| "module": "esnext", | ||
| "esModuleInterop": true, | ||
| "moduleResolution": "node", | ||
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "jsx": "preserve" | ||
| }, | ||
| "include": [ | ||
| "next-env.d.ts", | ||
| "**/*.ts", | ||
| "**/*.tsx" | ||
| ], | ||
| "exclude": [ | ||
| "node_modules" | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export const baseUrl = | ||
| process.env.NODE_ENV === "development" | ||
| ? new URL("http://localhost:6006") | ||
| : new URL(process.env.NEXT_PUBLIC_SITE_URL || "https://stackflow.so"); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import fs from "node:fs"; | ||
| import path from "node:path"; | ||
| import matter from "gray-matter"; | ||
|
|
||
| interface Page { | ||
| path: string; | ||
| title: string; | ||
| description?: string; | ||
| content: string; | ||
| data: Record<string, any>; | ||
| } | ||
|
|
||
| export function getAllPages(): Page[] { | ||
| const pagesDir = path.join(process.cwd(), "pages"); | ||
| const files = getAllMdxFiles(pagesDir); | ||
|
|
||
| return files | ||
| .map((filePath) => { | ||
| const relativePath = path.relative(pagesDir, filePath); | ||
| const fileContent = fs.readFileSync(filePath, "utf-8"); | ||
| const { data, content } = matter(fileContent); | ||
|
|
||
| return { | ||
| path: relativePath, | ||
| title: data.title || "", | ||
| description: data.description, | ||
| content, | ||
| data, | ||
| }; | ||
| }) | ||
| .filter((page) => { | ||
| // API routes, _app, _document 등 제외 | ||
| if (page.path.startsWith("api/")) return false; | ||
| if (page.path.startsWith("_")) return false; | ||
|
|
||
| return true; | ||
| }) | ||
| .sort((a, b) => a.path.localeCompare(b.path)); | ||
| } | ||
|
|
||
| function getAllMdxFiles(dir: string, fileList: string[] = []): string[] { | ||
| const files = fs.readdirSync(dir); | ||
|
|
||
| files.forEach((file) => { | ||
| const filePath = path.join(dir, file); | ||
| const stat = fs.statSync(filePath); | ||
|
|
||
| if (stat.isDirectory()) { | ||
| getAllMdxFiles(filePath, fileList); | ||
| } else if (file.endsWith(".mdx") || file.endsWith(".md")) { | ||
| fileList.push(filePath); | ||
| } | ||
| }); | ||
|
|
||
| return fileList; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,19 +11,21 @@ | |
| "packages/*", | ||
| "extensions/*" | ||
| ], | ||
| "type": "module", | ||
|
||
| "scripts": { | ||
| "build": "ultra -r build", | ||
| "build:dts": "ultra -r --build build:dts", | ||
| "clean": "ultra -r clean", | ||
| "dev": "ultra -r --concurrency 100 dev", | ||
| "format": "biome check --write .", | ||
| "lint": "biome lint .", | ||
| "changeset:version": "changeset version && yarn install --no-immutable", | ||
| "changeset:version": "yarn generate:changelog && changeset version && yarn install --no-immutable", | ||
| "release": "yarn clean && yarn build && changeset && yarn changeset:version && changeset publish", | ||
| "release:canary": "yarn clean && yarn build && changeset pre enter canary && changeset && yarn changeset:version && changeset publish && changeset pre exit", | ||
| "test": "yarn build && ultra -r test", | ||
| "typecheck": "ultra -r typecheck", | ||
| "version": "yarn install && git stage yarn.lock" | ||
| "version": "yarn install && git stage yarn.lock", | ||
| "generate:changelog": "yarn node scripts/generate-changelog.ts" | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| "resolutions": { | ||
| "@mdx-js/react": "3.0.1", | ||
|
|
@@ -32,7 +34,13 @@ | |
| }, | ||
| "devDependencies": { | ||
| "@biomejs/biome": "^2.1.4", | ||
| "@changesets/assemble-release-plan": "^6.0.9", | ||
| "@changesets/cli": "^2.28.1", | ||
| "@changesets/config": "^3.1.1", | ||
| "@changesets/pre": "^2.0.2", | ||
| "@changesets/read": "^0.6.5", | ||
| "@changesets/types": "^6.1.0", | ||
| "@manypkg/get-packages": "~1.1.3", | ||
| "@types/jest": "^29.5.12", | ||
| "@types/node": "^20.14.9", | ||
| "@types/react": "^18.3.3", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.