Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
5 changes: 5 additions & 0 deletions .changeset/chatty-breads-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stackflow/docs": minor
---

Add LLMs.txt and changelog section
768 changes: 768 additions & 0 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 4 additions & 1 deletion docs/.gitignore
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
3 changes: 3 additions & 0 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export default withNextra({
defaultLocale: "en",
localeDetection: false,
},
typescript: {
ignoreBuildErrors: true,
},
});

import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
Expand Down
8 changes: 7 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"description": "Mobile-first stack navigator framework with Composable Plugin System",
"license": "MIT",
"scripts": {
"build": "next build",
"build:llms": "yarn tsx scripts/generate-llms-txt.ts",
"build": "yarn build:llms && next build",
"start": "next start",
"dev": "next -p 6006",
"preview": "opennextjs-cloudflare build && opennextjs-cloudflare preview",
Expand All @@ -27,13 +28,17 @@
"autoprefixer": "^10.4.20",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"gray-matter": "^4.0.3",
"lucide-react": "^0.451.0",
"next": "^14.2.4",
"nextra": "^2.13.4",
"nextra-theme-docs": "^2.13.4",
"postcss": "^8.4.47",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"remark": "^15.0.1",
"remark-gfm": "^4.0.1",
"remark-stringify": "^11.0.0",
"simple-reveal": "^0.8.0",
"tailwind-merge": "^2.5.3",
"tailwindcss": "^3.4.13"
Expand All @@ -42,6 +47,7 @@
"@seed-design/stylesheet": "^1.0.4",
"@types/node": "^22.7.5",
"react-lazy-load-image-component": "^1.6.2",
"tsx": "^4.20.6",
"typescript": "^5.6.3",
"wrangler": "^4.12.1"
}
Expand Down
4 changes: 3 additions & 1 deletion docs/pages/docs/_meta.en.json
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"
}
4 changes: 3 additions & 1 deletion docs/pages/docs/_meta.ko.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"get-started": "시작하기",
"advanced": "활용하기"
"advanced": "활용하기",
"ai-integration": "AI 통합",
"changelog": "변경 이력"
}
3 changes: 3 additions & 0 deletions docs/pages/docs/ai-integration/_meta.en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"llms-txt": "LLMs.txt"
}
3 changes: 3 additions & 0 deletions docs/pages/docs/ai-integration/_meta.ko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"llms-txt": "LLMs.txt"
}
21 changes: 21 additions & 0 deletions docs/pages/docs/ai-integration/llms-txt.en.mdx
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)
21 changes: 21 additions & 0 deletions docs/pages/docs/ai-integration/llms-txt.ko.mdx
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)
22 changes: 22 additions & 0 deletions docs/pages/docs/changelog.en.mdx
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)

---

22 changes: 22 additions & 0 deletions docs/pages/docs/changelog.ko.mdx
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)

---

3 changes: 2 additions & 1 deletion docs/pages/docs/get-started/_meta.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"activity": "Activity",
"navigating-activities": "Navigating Activities",
"navigating-step": "Navigating Step",
"getting-state": "Getting State"
"getting-state": "Getting State",
"ai-integration": "AI Integration"
}
3 changes: 2 additions & 1 deletion docs/pages/docs/get-started/_meta.ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"activity": "액티비티",
"navigating-activities": "액티비티 탐색하기",
"navigating-step": "스텝 탐색하기",
"getting-state": "상태 가져오기"
"getting-state": "상태 가져오기",
"ai-integration": "AI 통합"
}
70 changes: 70 additions & 0 deletions docs/scripts/generate-llms-txt.ts
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();
28 changes: 28 additions & 0 deletions docs/tsconfig.json
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"
]
}
4 changes: 4 additions & 0 deletions docs/utils/constants.ts
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");
56 changes: 56 additions & 0 deletions docs/utils/get-all-pages.ts
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;
}
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@
"packages/*",
"extensions/*"
],
"type": "module",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify ESM compatibility across the monorepo before merging.

Adding "type": "module" converts the entire monorepo to ES modules, which is a breaking change. Ensure all workspaces, build scripts, and dependencies properly support ESM before merging.


🏁 Script executed:

#!/bin/bash
# Description: Verify generate-changelog.ts exists and check ESM compatibility indicators

# Check if generate-changelog.ts exists
if [ -f scripts/generate-changelog.ts ]; then
  echo "✓ scripts/generate-changelog.ts exists"
  head -20 scripts/generate-changelog.ts
else
  echo "✗ scripts/generate-changelog.ts NOT FOUND"
fi

# Verify the script doesn't use CommonJS requires
if [ -f scripts/generate-changelog.ts ]; then
  if grep -q "require(" scripts/generate-changelog.ts; then
    echo "⚠ WARNING: Script appears to use CommonJS require() - may not work with type:module"
  else
    echo "✓ Script appears to use ES imports"
  fi
fi

# Check for any .ts config or build files that might conflict
fd -e ts -e mjs -e cjs scripts/ 2>/dev/null | head -10

Length of output: 785



🏁 Script executed:

#!/bin/bash
# Description: Verify ESM compatibility across workspaces and build configuration

# Check workspace package.json files for type field
echo "=== Checking workspace configurations ==="
fd -e package.json -path '*/packages/*/package.json' | head -20 | while read -r pkg; do
  echo "File: $pkg"
  grep -E '"type"|"module"' "$pkg" || echo "  (no type field)"
done

# Check root tsconfig.json for module settings
echo -e "\n=== Checking TypeScript module configuration ==="
if [ -f tsconfig.json ]; then
  echo "Root tsconfig.json:"
  grep -A2 -B2 '"module"' tsconfig.json || echo "  (no module field)"
else
  echo "tsconfig.json not found"
fi

# Look for any build/test scripts that might use CommonJS syntax
echo -e "\n=== Checking for CommonJS patterns in build context ==="
grep -r "require\.resolve\|module\.exports\|CommonJS" . --include="*.ts" --include="*.js" -l 2>/dev/null | grep -E "(build|test|scripts)" | head -10 || echo "  (no obvious CommonJS patterns in build scripts)"

# Check if .mocharc or similar test config exists and uses ESM
echo -e "\n=== Checking test configuration ==="
fd -E node_modules '.mocharc*' -o '.babelrc*' -o 'jest.config*' | head -5

Length of output: 679


🏁 Script executed:

#!/bin/bash
# Check if there are documented ESM breaking changes or migration notes
echo "=== Checking for ESM migration documentation ==="
fd -e md -e txt -E node_modules | xargs grep -l "ESM\|module.*type\|CommonJS" 2>/dev/null | head -5

Length of output: 100


🏁 Script executed:

#!/bin/bash
# Description: Verify ESM compatibility across workspaces and build configuration

# Check workspace package.json files for type field
echo "=== Checking workspace configurations ==="
fd -e package.json -path '*/packages/*/package.json' | head -20 | while read -r pkg; do
  echo "File: $pkg"
  grep -E '"type"' "$pkg" || echo "  (no type field)"
done

# Check root tsconfig.json for module settings
echo -e "\n=== Checking TypeScript module configuration ==="
if [ -f tsconfig.json ]; then
  echo "Root tsconfig.json:"
  grep -A2 -B2 '"module"' tsconfig.json || echo "  (no module field)"
fi

# Check for .mts files or explicit ESM markers
echo -e "\n=== Checking for ESM file extensions in scripts ==="
fd -e mts -o -e mjs scripts/ 2>/dev/null || echo "  (no .mts or .mjs files in scripts)"

# Look for common ESM incompatibilities in scripts directory
echo -e "\n=== Checking script files for ESM compatibility ==="
fd -type f scripts/ 2>/dev/null | while read -r script; do
  if file "$script" | grep -q "JavaScript"; then
    if grep -l "module.exports\|require(" "$script" 2>/dev/null; then
      echo "⚠ POTENTIAL ISSUE: $script uses CommonJS"
    fi
  fi
done

Length of output: 555



🏁 Script executed:

#!/bin/bash
# Description: Check esbuild-config usage and build process compatibility

# Verify how esbuild-config is imported/used
echo "=== Searching for esbuild-config imports ==="
rg -n "esbuild-config" --type ts --type js -B2 -A2 | head -30

# Check package.json to see if esbuild-config is a package or internal config
echo -e "\n=== Checking esbuild-config package structure ==="
if [ -f packages/esbuild-config/package.json ]; then
  echo "esbuild-config package.json:"
  cat packages/esbuild-config/package.json | head -15
fi

# Check root package.json build scripts more closely
echo -e "\n=== Build and script commands from root package.json ==="
grep -E '"(build|dev|test|prepare|postinstall)"' package.json | head -10

Length of output: 2698



🏁 Script executed:

#!/bin/bash
# Description: Verify if esbuild configs have been migrated to ESM or .mjs/.mts

# Check for .mjs or .mts versions of esbuild config files
echo "=== Checking for ESM versions of esbuild config ==="
fd -e mjs -e mts | grep esbuild || echo "  (no .mjs or .mts esbuild configs found)"

# Check if any esbuild.config.js files have been converted to import syntax
echo -e "\n=== Checking if any esbuild.config.js use import syntax ==="
fd -name "esbuild.config.js" | while read -r file; do
  if head -5 "$file" | grep -q "^import\|^export"; then
    echo "✓ ESM: $file"
  else
    echo "✗ CommonJS: $file"
  fi
done

# Check if git shows these files as modified in this PR
echo -e "\n=== Checking git status of esbuild config files ==="
git diff HEAD --name-only 2>/dev/null | grep -i esbuild || echo "  (no esbuild files modified in this PR)"

Length of output: 479


Migrate esbuild.config.js files to ESM before setting "type": "module".

Adding "type": "module" at the root converts all .js files to ESM. However, multiple esbuild.config.js files throughout the monorepo (extensions/react-ui-core/, extensions/plugin-basic-ui/, extensions/plugin-stack-depth-change/, extensions/plugin-map-initial-activity/, extensions/plugin-history-sync/, extensions/plugin-preload/, and others) still use CommonJS require() syntax. These will fail when parsed as ESM.

Either migrate these build config files to ESM (.mjs or import syntax) or add "type": "commonjs" to their respective package.json files to override the root setting.

🤖 Prompt for AI Agents
In package.json around line 14, adding "type": "module" will make all .js files
ESM and will break existing esbuild.config.js files that still use CommonJS
require() in the listed extension packages (extensions/react-ui-core,
extensions/plugin-basic-ui, extensions/plugin-stack-depth-change,
extensions/plugin-map-initial-activity, extensions/plugin-history-sync,
extensions/plugin-preload, etc.); fix by either (A) migrating each
esbuild.config.js to ESM: rename to .mjs or convert require()/module.exports to
import/export syntax and adjust any synchronous require usage to ESM-compatible
patterns, or (B) add a package.json in each extension folder with "type":
"commonjs" to keep those configs as CommonJS; pick one approach per package and
apply consistently so the root "type": "module" does not break their build
configs.

"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"
},
"resolutions": {
"@mdx-js/react": "3.0.1",
Expand All @@ -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",
Expand Down
Loading