Skip to content

Latest commit

 

History

History
131 lines (103 loc) · 6.26 KB

CONTRIBUTING.md

File metadata and controls

131 lines (103 loc) · 6.26 KB

Contributing to the VEF Framework Documentation

This guide explains how to add, edit, and translate documentation pages, and how to keep the source-driven API audit in sync. It is contributor-facing and intentionally lives outside the Docusaurus sidebar (it is not a page framework users browse).

Project Structure

vef-framework-go-docs/
├── docs/                          # English documentation (source of truth)
│   ├── getting-started/           # 2  Getting Started
│   ├── core-concepts/             # 3  Core Concepts (DI, boot lifecycle)
│   ├── building-apis/             # 4  Building APIs
│   ├── data-access/               # 5  Data Access
│   ├── security/                  # 6  Security
│   ├── data-tools/                # 7  Data Tools
│   ├── infrastructure/            # 8  Infrastructure
│   ├── ai-integration/            # 9  AI Integration
│   ├── approval/                   # 10 Approval (workflow/approval engine)
│   ├── integration/               # 11 Integration
│   ├── advanced/                  # 12 Advanced
│   ├── utilities/                 # 13 Utilities
│   ├── conventions/               # 14 Conventions
│   ├── reference/                 # 15 Reference (incl. generated API indexes)
│   └── intro.md                   # 1  Introduction
├── i18n/
│   └── zh-Hans/
│       └── docusaurus-plugin-content-docs/
│           └── current/           # Chinese documentation (mirrors docs/ 1:1)
├── scripts/                       # Source-driven API audit tooling (Go)
├── docusaurus.config.ts
└── sidebars.ts                    # Autogenerated from the docs/ directory tree

The sidebar is autogenerated (sidebars.ts uses {type: 'autogenerated', dirName: '.'}): category order comes from each directory's _category_.json position, and page order within a category comes from the sidebar_position frontmatter. There is no hand-maintained sidebar.

Adding or Editing a Page

  1. Create/edit the English .md under the correct category in docs/, starting with frontmatter:

    ---
    sidebar_position: 5
    ---
    
    # Page Title
  2. Create/edit the matching Chinese file at the same relative path under i18n/zh-Hans/docusaurus-plugin-content-docs/current/, with the same sidebar_position. Translate prose only — keep code, identifiers, API names, and config keys verbatim.

  3. Cross-reference other pages with extension-less relative links: [Models](../data-access/models).

  4. Verify code examples against the framework source (../vef-framework-go) and its test files. Reference the framework's actual API, not theoretical usage.

Adding a Category

Create docs/<category>/_category_.json and its Chinese twin:

{ "label": "Category Label", "position": 10 }

Use a translated label in the Chinese mirror; keep position identical.

Category Positions

Pos Directory Label (EN) Label (ZH)
1 intro.md Introduction 介绍
2 getting-started Getting Started 快速开始
3 core-concepts Core Concepts 核心概念
4 building-apis Building APIs 构建 API
5 data-access Data Access 数据访问
6 security Security 安全
7 data-tools Data Tools 数据工具
8 infrastructure Infrastructure 基础设施
9 ai-integration AI Integration AI 集成
10 approval Approval Workflow 审批
11 integration Integration 集成
12 advanced Advanced 进阶
13 utilities Utilities 工具库
14 conventions Conventions 约定规范
15 reference Reference 参考

Development Workflow

pnpm install
pnpm start                       # dev server (Chinese, default locale)
pnpm start:en                    # dev server (English)
pnpm build                       # production build (all locales)
pnpm build -- --locale zh-Hans   # production build (Chinese only)

onBrokenLinks: "throw" is configured, so pnpm build hard-fails on any broken relative/absolute doc link — treat a clean build in both locales as the closing verification for structural changes.

Public API Audit

User-facing APIs are audited from source. The audit has three layers:

  • docs/reference/public-api-index.md — every exported top-level symbol, field, and method from non-internal/ packages (generated).
  • docs/reference/runtime-api-index.md — user-facing runtime contracts: routes, CLI flags, config keys, JSON fields, event topics, tag grammars, MCP contracts, error codes (generated).
  • scripts/*.json ledgers/manifest — per-package semantic review, pinned counts, fingerprints, and the topical doc pages that must cover each package (the per-verify-<pkg>-contracts.go scripts grep those pages for the package's API terms).

When the framework's public surface changes, update the affected topical docs and regenerate/verify:

(cd ../vef-framework-go && go run ../vef-framework-go-docs/scripts/gen-api-index.go -source . -out ../vef-framework-go-docs)
(cd ../vef-framework-go && go run ../vef-framework-go-docs/scripts/verify-runtime-api-audit.go -source . -out ../vef-framework-go-docs -write)
(cd ../vef-framework-go && go run ../vef-framework-go-docs/scripts/verify-api-audit.go -source . -manifest ../vef-framework-go-docs/scripts/api-audit-manifest.json -ledger ../vef-framework-go-docs/scripts/api-audit-ledger.json -contract-ledger ../vef-framework-go-docs/scripts/api-contract-ledger.json)

If pages move, each verify-<pkg>-contracts.go hardcodes the topical doc path(s) it greps, and the scripts/*.json coverage arrays list the same paths; update both to the new locations, then re-run the audit to refresh fingerprints/counts.

Checklist for a New/Changed Page

  • English file under docs/ with correct sidebar_position
  • Chinese twin under i18n/zh-Hans/.../current/ with matching structure and position
  • Code examples verified against framework source
  • Cross-references use extension-less relative links
  • pnpm build and pnpm build -- --locale zh-Hans both pass
  • If the public surface changed, the API audit was regenerated/verified