Skip to content
Merged
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
140 changes: 140 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Apache Fory Site: System Understanding (Agent View)

## 1. Project Positioning

This repository contains the Apache Fory website and documentation site source (Docusaurus).
It is not the Fory core serialization library itself.

Primary responsibilities:

- Official homepage and marketing content (`src/pages` + custom components)
- Documentation (multi-version, multi-language)
- Blog
- Community, download, and related pages

Core objective: stable static site publishing plus high-quality documentation and Chinese localization maintenance.

## 2. Tech Stack and Runtime

- Framework: Docusaurus 3 (React 18 + TypeScript)
- Styling and motion: CSS Modules, Tailwind (partial usage), AOS, Framer Motion
- Search: `docusaurus-lunr-search`
- Node requirement: `>=18`

Common commands (`package.json`):

- `npm run start` / `npm run start-en` / `npm run start-zh`
- `npm run build` (runs `prebuild` first)
- `npm run docusaurus docs:version <ver>` (wrapped command with i18n version copy support)
- `npm run typecheck`

## 3. Information Architecture and Directory Responsibilities

Key directories:

- `docs/`: current docs (current/dev)
- `versioned_docs/version-*/`: historical docs by version
- `versioned_sidebars/`: sidebars for versioned docs
- `i18n/zh-CN/docusaurus-plugin-content-docs/`: Chinese docs (`current` + `version-*`)
- `blog/`: blog content
- `src/pages/`: homepage, users page, download page, security page, etc.
- `src/theme/`: Docusaurus theme overrides (notably blog rendering behavior)
- `src/plugin/redirect.js`: site redirect logic
- `scripts/`: docs versioning and i18n helper scripts
- `.github/workflows/`: CI/CD pipelines

Current docs footprint (rough file count):

- `docs/`: 158
- `versioned_docs/`: 333
- `i18n/zh-CN/docusaurus-plugin-content-docs/`: 500

## 4. Docs Versioning Strategy

- `versions.json` currently includes: `0.15, 0.14, 0.13, 0.12, 0.11, 0.10`
- In `docusaurus.config.ts`, `docs.lastVersion = "0.15"`
- The current docs label is `dev` (`current`)

Recommended versioning entry point:

- Use `npm run docusaurus docs:version <ver>`
- This invokes `scripts/docusaurus-with-i18n.sh`
- After native Docusaurus versioning, the wrapper copies each locale’s `current/` to `version-<ver>/`

## 5. Internationalization (i18n) Mechanism

Enabled locales:

- `en-US` (default)
- `zh-CN`

Chinese docs paths:

- `i18n/zh-CN/docusaurus-plugin-content-docs/current/`
- `i18n/zh-CN/docusaurus-plugin-content-docs/version-*/`

Chinese top-level sidebar labels are managed in:

- `i18n/zh-CN/docusaurus-plugin-content-docs/current.json`

Prebuild step:

- `scripts/copy-i18n-fallback.sh`
- It fills missing Chinese files for `specification` and `benchmarks` from English sources (`rsync --ignore-existing`) to prevent broken links

This means Chinese docs may be a mix of translated content and English fallback files.

## 6. Site Customization (vs. Default Docusaurus Behavior)

- The homepage is composed of custom sections (Hero, Features, language cards, code carousel)
- `src/plugin/redirect.js` has built-in redirects:
- `fury.apache.org` -> `fory.apache.org`
- Old routes `/docs/.../docs/{guide|introduction|start}` -> cleaned routes
- Blog theme overrides:
- List pages prefer frontmatter `description` as summary
- Post detail pages remove the global blog sidebar for a focused reading layout

## 7. CI/CD and Quality Gates

### CI

- `lint.yml`
- Markdown lint (`markdownlint-cli`)
- YAML lint (`yamllint`)
- `link-check.yml`
- Workflow exists, but link-check steps are currently commented out (not effectively running)

### CD

- `deploy.yml`
- Runs on push to `main` and on pull requests
- Calls `scripts/unified-docs/script.py`
- Runs `npm run download-avatars` + `npm run build`
- Publishes to `deploy` branch for non-PR events (`peaceiris/actions-gh-pages`)

## 8. Key Repository Caveats

- `CONTRIBUTING.md` states that `docs/guide` and `docs/specification` are mainly synced from `apache/fory`.
For those sections, confirm whether changes should go to the main `apache/fory` repo instead.
- `scripts/unified-docs/script.py` uses `i18n/eu-US/...` paths (not `en-US`); treat this as existing behavior and validate intent before changing.
- Since link-check is not effectively active, external link regressions may pass PR checks.
- The repo has substantial versioned/mirrored docs; avoid accidental bulk edits in `versioned_docs` and `i18n/version-*`.

## 9. Recommended Agent Workflow

- Before editing docs, scope the target explicitly:
- `docs/current`
- `versioned_docs/version-*`
- `i18n/zh-CN/current`
- `i18n/zh-CN/version-*`
- For Chinese translation tasks:
- Follow `skills/translate-docs-zh/SKILL.md`
- Use terminology from `skills/translate-docs-zh/references/terminology.md`
- Do not use external translation tools/APIs/websites
- When changing top-level sidebar categories (Introduction/Start/Schema IDL & Compiler/Guide):
- Update `sidebars.ts`
- Update `i18n/zh-CN/docusaurus-plugin-content-docs/current.json` (and version JSON files if needed)
- Minimum pre-commit validation:
- `npm run build`
- `npm run typecheck`
- Manually verify critical routes: `/`, `/docs`, `/zh-CN/docs`, `/blog`
16 changes: 16 additions & 0 deletions i18n/zh-CN/docusaurus-plugin-content-docs/current.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,21 @@
"version.label": {
"message": "dev",
"description": "The label for version current"
},
"sidebar.docsSidebar.category.Introduction": {
"message": "Apache Fory 介绍",
"description": "The label for category Introduction in sidebar docsSidebar"
},
"sidebar.docsSidebar.category.Start": {
"message": "快速开始",
"description": "The label for category Start in sidebar docsSidebar"
},
"sidebar.docsSidebar.category.Schema IDL & Compiler": {
"message": "Schema IDL 与编译器",
"description": "The label for category Schema IDL & Compiler in sidebar docsSidebar"
},
"sidebar.docsSidebar.category.Guide": {
"message": "用户指南",
"description": "The label for category Guide in sidebar docsSidebar"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,48 @@

## 性能摘要

| 数据类型 | 操作 | Fory (ops/s) | Protobuf (ops/s) | Msgpack (ops/s) | Fory vs PB | Fory vs MP |
|---------|------|--------------|------------------|-----------------|------------|------------|
| Struct | 序列化 | 15.16M | 10.23M | 5.41M | 1.48x | 2.80x |
| Struct | 反序列化 | 12.10M | 11.01M | 3.23M | 1.10x | 3.75x |
| Structlist | 序列化 | 1.58M | 561K | 299K | 2.82x | 5.28x |
| Structlist | 反序列化 | 1.10M | 529K | 175K | 2.09x | 6.30x |
| Sample | 序列化 | 7.28M | 2.72M | 670K | 2.68x | 10.87x |
| Sample | 反序列化 | 3.79M | 2.37M | 376K | 1.60x | 10.09x |
| Samplelist | 序列化 | 510K | 141K | 38K | 3.61x | 13.34x |
| Samplelist | 反序列化 | 236K | 107K | 19K | 2.20x | 12.66x |
| Mediacontent | 序列化 | 3.72M | 2.12M | 1.29M | 1.75x | 2.88x |
| Mediacontent | 反序列化 | 2.34M | 1.81M | 698K | 1.30x | 3.35x |
| Mediacontentlist | 序列化 | 268K | 110K | 72K | 2.44x | 3.72x |
| Mediacontentlist | 反序列化 | 138K | 87K | 36K | 1.58x | 3.86x |
| 数据类型 | 操作 | Fory (ops/s) | Protobuf (ops/s) | Msgpack (ops/s) | Fory vs PB | Fory vs MP |
| ---------------- | -------- | ------------ | ---------------- | --------------- | ---------- | ---------- |
| Struct | 序列化 | 15.16M | 10.23M | 5.41M | 1.48x | 2.80x |
| Struct | 反序列化 | 12.10M | 11.01M | 3.23M | 1.10x | 3.75x |
| Structlist | 序列化 | 1.58M | 561K | 299K | 2.82x | 5.28x |
| Structlist | 反序列化 | 1.10M | 529K | 175K | 2.09x | 6.30x |
| Sample | 序列化 | 7.28M | 2.72M | 670K | 2.68x | 10.87x |
| Sample | 反序列化 | 3.79M | 2.37M | 376K | 1.60x | 10.09x |
| Samplelist | 序列化 | 510K | 141K | 38K | 3.61x | 13.34x |
| Samplelist | 反序列化 | 236K | 107K | 19K | 2.20x | 12.66x |
| Mediacontent | 序列化 | 3.72M | 2.12M | 1.29M | 1.75x | 2.88x |
| Mediacontent | 反序列化 | 2.34M | 1.81M | 698K | 1.30x | 3.35x |
| Mediacontentlist | 序列化 | 268K | 110K | 72K | 2.44x | 3.72x |
| Mediacontentlist | 反序列化 | 138K | 87K | 36K | 1.58x | 3.86x |

## 详细耗时(ns/op)

| 数据类型 | 操作 | Fory | Protobuf | Msgpack |
|---------|------|------|----------|---------|
| Struct | 序列化 | 66.0 | 97.8 | 184.9 |
| Struct | 反序列化 | 82.7 | 90.9 | 309.6 |
| Structlist | 序列化 | 632.8 | 1783.0 | 3340.0 |
| Structlist | 反序列化 | 906.4 | 1891.0 | 5709.0 |
| Sample | 序列化 | 137.3 | 367.3 | 1492.0 |
| Sample | 反序列化 | 263.6 | 422.2 | 2661.0 |
| Samplelist | 序列化 | 1962.0 | 7087.0 | 26169.0 |
| Samplelist | 反序列化 | 4234.0 | 9321.0 | 53615.0 |
| Mediacontent | 序列化 | 268.8 | 471.1 | 773.7 |
| Mediacontent | 反序列化 | 426.9 | 553.1 | 1432.0 |
| Mediacontentlist | 序列化 | 3736.0 | 9107.0 | 13911.0 |
| Mediacontentlist | 反序列化 | 7247.0 | 11435.0 | 27975.0 |
| 数据类型 | 操作 | Fory | Protobuf | Msgpack |
| ---------------- | -------- | ------ | -------- | ------- |
| Struct | 序列化 | 66.0 | 97.8 | 184.9 |
| Struct | 反序列化 | 82.7 | 90.9 | 309.6 |
| Structlist | 序列化 | 632.8 | 1783.0 | 3340.0 |
| Structlist | 反序列化 | 906.4 | 1891.0 | 5709.0 |
| Sample | 序列化 | 137.3 | 367.3 | 1492.0 |
| Sample | 反序列化 | 263.6 | 422.2 | 2661.0 |
| Samplelist | 序列化 | 1962.0 | 7087.0 | 26169.0 |
| Samplelist | 反序列化 | 4234.0 | 9321.0 | 53615.0 |
| Mediacontent | 序列化 | 268.8 | 471.1 | 773.7 |
| Mediacontent | 反序列化 | 426.9 | 553.1 | 1432.0 |
| Mediacontentlist | 序列化 | 3736.0 | 9107.0 | 13911.0 |
| Mediacontentlist | 反序列化 | 7247.0 | 11435.0 | 27975.0 |

### 序列化后数据大小(字节)

| 数据类型 | Fory | Protobuf | Msgpack |
|---------|------|----------|---------|
| Struct | 58 | 61 | 57 |
| Sample | 446 | 375 | 524 |
| MediaContent | 342 | 301 | 400 |
| StructList | 560 | 1260 | 1146 |
| SampleList | 7600 | 7560 | 10486 |
| MediaContentList | 5776 | 6080 | 8006 |
| 数据类型 | Fory | Protobuf | Msgpack |
| ---------------- | ---- | -------- | ------- |
| Struct | 58 | 61 | 57 |
| Sample | 446 | 375 | 524 |
| MediaContent | 342 | 301 | 400 |
| StructList | 560 | 1260 | 1146 |
| SampleList | 7600 | 7560 | 10486 |
| MediaContentList | 5776 | 6080 | 8006 |

## 性能图表

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"position": 3,
"label": "Schema IDL 与编译器",
"collapsible": true,
"collapsed": true
}
Loading
Loading