Skip to content

添加开发文档 - #5438

Closed
zhangzhichaolove wants to merge 2 commits into
QuantumNous:mainfrom
zhangzhichaolove:main
Closed

添加开发文档#5438
zhangzhichaolove wants to merge 2 commits into
QuantumNous:mainfrom
zhangzhichaolove:main

Conversation

@zhangzhichaolove

@zhangzhichaolove zhangzhichaolove commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

为项目添加了完整的开发文档(DEVELOPMENT.md),帮助开发者快速搭建本地开发环境。

主要内容:

  • 环境要求说明(Go、Bun、数据库)
  • 本地开发快速启动步骤(首次构建前端 → 启动后端 → 启动前端)
  • 前后端开发指南、技术栈说明、项目结构
  • 常见问题解答(go:embed 报错、端口冲突等)

为什么这样改:

  • 原项目缺少面向开发者的本地开发指南,README 只包含用户部署文档
  • //go:embed 机制导致开发时需要特殊处理,未说明会导致新手开发者遇到报错
  • Rsbuild 默认端口与后端冲突问题需要明确说明
  • 支持 5 种语言(简体中文、繁体中文、英文、法语、日语),与 README 语言保持一致

变更细节:

  • 新增 docs/development/DEVELOPMENT.*.md(5 个语言版本)
  • 更新所有 README 文档部分的快速导航表格,添加开发指南入口

🚀 变更类型 / Type of change

  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 不适用(文档更新)
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已按照开发文档步骤在本地完整验证前后端启动流程。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

已在本地成功验证以下流程:

  1. 按照文档步骤构建前端 → 启动后端(3000 端口)
  2. 启动前端开发服务器(5173 端口),正常访问并代理后端 API
  3. 验证 5 种语言的开发文档互相链接正常,README 导航链接正确

文档位置: docs/development/DEVELOPMENT.md 及其他语言版本
README 更新: 所有语言版本的文档部分已添加"开发指南"入口

Copilot AI review requested due to automatic review settings June 11, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds localized development guides and links them from the project READMEs to help developers run and develop new-api locally.

Changes:

  • Added a new Development Guide in English, Simplified Chinese, Traditional Chinese, Japanese, and French under docs/development/.
  • Documented local dev workflow (Bun build, Go run), Makefile-based dev workflow, and common issues (go:embed, port conflicts).
  • Linked each README language variant to its corresponding Development Guide doc.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/development/DEVELOPMENT.md Adds English development guide content.
docs/development/DEVELOPMENT.zh_CN.md Adds Simplified Chinese development guide content.
docs/development/DEVELOPMENT.zh_TW.md Adds Traditional Chinese development guide content.
docs/development/DEVELOPMENT.ja.md Adds Japanese development guide content.
docs/development/DEVELOPMENT.fr.md Adds French development guide content.
README.md Adds Development Guide link to English README (default).
README.en.md Adds Development Guide link to English README variant.
README.zh_CN.md Adds Development Guide link to Simplified Chinese README.
README.zh_TW.md Adds Development Guide link to Traditional Chinese README.
README.ja.md Adds Development Guide link to Japanese README.
README.fr.md Adds Development Guide link to French README.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +9
<p align="center">
<a href="./DEVELOPMENT.zh_CN.md">简体中文</a> |
<strong>繁體中文</strong> |
<a href="./DEVELOPMENT.md">English</a> |
<a href="./DEVELOPMENT.fr.md">Français</a> |
<a href="./DEVELOPMENT.ja.md">日本語</a>
</p>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR adds comprehensive development guide documentation in five languages (English, French, Japanese, Simplified Chinese, Traditional Chinese) and updates all corresponding README files to include Quick Navigation links to the new development resources. Each guide covers local setup, development workflows, troubleshooting, and contribution guidelines.

Changes

Development Guide Documentation

Layer / File(s) Summary
README Quick Navigation updates
README.md, README.en.md, README.fr.md, README.ja.md, README.zh_CN.md, README.zh_TW.md
All six README files updated with a new "🛠️ Development Guide" row in the Documentation quick-navigation table, linking to the respective language-specific development guide.
English Development Guide
docs/development/DEVELOPMENT.md
Primary development guide documenting prerequisites (Go 1.22+, Bun, databases, Docker), local setup paths (manual + Makefile), frontend development commands (Bun/Rsbuild/TypeScript/ESLint/i18n), backend setup (SQLite/MySQL/PostgreSQL), project structure, production build process, debugging utilities (make reset-setup), troubleshooting for go:embed and port conflicts, and contribution checklist.
French Development Guide
docs/development/DEVELOPMENT.fr.md
French translation covering the same comprehensive content: prerequisites, quick-start options, frontend workflows, backend database configuration, production compilation steps, debugging tools, and common issues with solutions.
Japanese Development Guide
docs/development/DEVELOPMENT.ja.md
Japanese localization with identical structure: environment setup, Makefile usage, frontend development tools and tech stack, i18n synchronization, backend configuration for three database types, project structure overview, production builds, setup wizard reset debugging, troubleshooting guidance, and support contact information.
Simplified Chinese Development Guide
docs/development/DEVELOPMENT.zh_CN.md
Simplified Chinese version providing complete development documentation with environment requirements, quick-start instructions, frontend and backend development workflows, database configuration options, project structure, debugging and reset utilities, common issues (go:embed, port conflicts, migrations, proxy configuration), and contribution guidelines.
Traditional Chinese Development Guide
docs/development/DEVELOPMENT.zh_TW.md
Traditional Chinese translation of full development documentation covering prerequisites, setup commands, frontend/backend workflows and project structure, production build steps, debugging/reset instructions, troubleshooting for go:embed and port conflicts, database migration and proxy behavior, contribution requirements, and technical support contact.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • QuantumNous/new-api#2486: Both PRs update README "Quick Navigation" documentation tables to link users to development resources, with this PR adding new Development Guide entries and the related PR modifying existing documentation routing paths.

Poem

📚 A rabbit hops through docs so neat,
Five languages, one developer treat!
Quick navigation now guides the way,
To build and debug without delay. 🛠️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title "添加开发文档" (Add Development Documentation) accurately describes the main change: adding comprehensive development guides in multiple languages across the repository.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
docs/development/DEVELOPMENT.md (1)

142-159: 💤 Low value

Optional: Add language identifier to code block.

The project structure diagram uses a fenced code block without a language specification. Consider adding text or leaving it unmarked for better Markdown compatibility.

As per coding guidelines, the static analysis tool flagged that fenced code blocks should specify a language (MD040).

🎨 Optional formatting improvement
-```
+```text
 .
 ├── router/        # HTTP routing
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/development/DEVELOPMENT.md` around lines 142 - 159, The fenced code
block containing the project tree diagram (the block that begins with a single
dot followed by the tree lines) lacks a language identifier and triggers MD040;
update that fenced block by adding a language token such as text (e.g., change
``` to ```text) so the Markdown linter accepts it and the diagram renders as
plain text.

Source: Linters/SAST tools

docs/development/DEVELOPMENT.fr.md (1)

142-142: ⚡ Quick win

Add language specifier to project structure code block.

All four translation files have a fenced code block at line 142 without a language specifier. For better rendering and accessibility, specify a language identifier such as text or plaintext.

📝 Proposed fix

Replace the opening fence marker at line 142 in all four files:

-```
+```text
 .
 ├── router/        # ...
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/development/DEVELOPMENT.fr.md` at line 142, The fenced code block at the
project structure opening fence is missing a language specifier; update the
opening triple-backtick for the tree snippet (the line that currently reads ```
) to include a language identifier such as text (i.e. change ``` to ```text) so
the code block renders as plain text across all four translation files.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/development/DEVELOPMENT.md`:
- Line 15: Update the DEVELOPMENT.md note to explicitly state that go.mod
specifies "go 1.25.1" while the Dockerfile image uses "golang:1.26.1-alpine",
clarifying that the module/go toolchain requirement is 1.25.1 but the dev
container image intentionally uses 1.26.1 for tooling/compatibility (or change
the image if you prefer exact parity); mention both exact tokens ("go 1.25.1"
and "golang:1.26.1-alpine") so readers are not confused and include a short
guidance line on whether contributors should match their local Go version to
go.mod or rely on the Docker image.

In `@docs/development/DEVELOPMENT.zh_TW.md`:
- Around line 233-234: Update the two Traditional Chinese links in
docs/development/DEVELOPMENT.zh_TW.md (the link texts "[用戶文件]" and "[API 文件]")
to point to the working Chinese locale by replacing their URLs from
https://docs.newapi.pro/en/docs and https://docs.newapi.pro/en/docs/api to
https://docs.newapi.pro/zh/docs and https://docs.newapi.pro/zh/docs/api
respectively (or add a short parenthetical note after the link if you
intentionally want to keep English content).

---

Nitpick comments:
In `@docs/development/DEVELOPMENT.fr.md`:
- Line 142: The fenced code block at the project structure opening fence is
missing a language specifier; update the opening triple-backtick for the tree
snippet (the line that currently reads ``` ) to include a language identifier
such as text (i.e. change ``` to ```text) so the code block renders as plain
text across all four translation files.

In `@docs/development/DEVELOPMENT.md`:
- Around line 142-159: The fenced code block containing the project tree diagram
(the block that begins with a single dot followed by the tree lines) lacks a
language identifier and triggers MD040; update that fenced block by adding a
language token such as text (e.g., change ``` to ```text) so the Markdown linter
accepts it and the diagram renders as plain text.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0b57119f-4362-4892-8d28-f0e15bb45b1f

📥 Commits

Reviewing files that changed from the base of the PR and between 6f41542 and 6538c53.

📒 Files selected for processing (11)
  • README.en.md
  • README.fr.md
  • README.ja.md
  • README.md
  • README.zh_CN.md
  • README.zh_TW.md
  • docs/development/DEVELOPMENT.fr.md
  • docs/development/DEVELOPMENT.ja.md
  • docs/development/DEVELOPMENT.md
  • docs/development/DEVELOPMENT.zh_CN.md
  • docs/development/DEVELOPMENT.zh_TW.md


## Requirements

- **Go**: 1.22+ (project uses 1.25.1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check Go version requirements across the repository

echo "=== Checking go.mod for Go version ==="
if [ -f go.mod ]; then
  grep '^go ' go.mod
fi

echo ""
echo "=== Checking Dockerfile for Go version ==="
fd -t f 'Dockerfile|dockerfile' --exec grep -H 'FROM.*golang'

echo ""
echo "=== Checking GitHub Actions for Go version ==="
fd -t f -e yml -e yaml -p '.github/workflows' --exec grep -H 'go-version'

echo ""
echo "=== Checking any version files ==="
fd -t f '.go-version|.tool-versions' --exec cat {}

Repository: QuantumNous/new-api

Length of output: 417


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== DEVELOPMENT.md around line 15 ==="
nl -ba docs/development/DEVELOPMENT.md | sed -n '1,40p'

echo
echo "=== Search for 1.25.1 / go-version / toolchain / go directives ==="
rg -n --hidden --no-ignore-vcs -S '1\.25\.1|go-version|toolchain\s|^go\s+[0-9]+' . || true

echo
echo "=== Show go.mod (small) ==="
if [ -f go.mod ]; then
  nl -ba go.mod | head -n 80
fi

Repository: QuantumNous/new-api

Length of output: 162


🌐 Web query:

Go 1.25.1 release notes go.dev

💡 Result:

Go 1.25.1 release notes (go.dev) summarize that go1.25.1 (released 2025-09-03) includes security fixes to the net/http package, as well as bug fixes to the go command, and the net, os, os/exec, and testing/synctest packages; it also points to the Go 1.25.1 milestone on the issue tracker for additional details.[1] The go.dev “Release History” page is the place where the Go 1.25.1 release highlights are listed (it references a milestone for the full set of changes):[1] - go1.25.1 (released 2025-09-03): security fixes to net/http; bug fixes to the go command, and net, os, os/exec, testing/synctest.[1]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== DEVELOPMENT.md line 15 context ==="
sed -n '10,20p' docs/development/DEVELOPMENT.md

echo
echo "=== Search for 1.25.1 / go-version / toolchain / go directives ==="
rg -n -S '1\.25\.1|go-version|toolchain\s|^go\s+[0-9]+\.[0-9]+' . || true

echo
echo "=== Search for golang:<version> in Dockerfiles ==="
rg -n -S 'golang:([0-9]+\.)+[0-9]+' Dockerfile* .github/workflows/* 2>/dev/null || true

echo
echo "=== Print relevant go.mod lines ==="
if [ -f go.mod ]; then rg -n -S '^(go\s+[0-9]+\.[0-9]+(\.[0-9]+)?)|toolchain\s+' go.mod || true; fi

Repository: QuantumNous/new-api

Length of output: 1216


Go requirement is consistent: go.mod uses 1.25.1 (not a typo)

docs/development/DEVELOPMENT.md matches go.mod (go 1.25.1). Docker-based dev instead uses golang:1.26.1-alpine in Dockerfile*; consider clarifying this difference in the docs to avoid confusion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/development/DEVELOPMENT.md` at line 15, Update the DEVELOPMENT.md note
to explicitly state that go.mod specifies "go 1.25.1" while the Dockerfile image
uses "golang:1.26.1-alpine", clarifying that the module/go toolchain requirement
is 1.25.1 but the dev container image intentionally uses 1.26.1 for
tooling/compatibility (or change the image if you prefer exact parity); mention
both exact tokens ("go 1.25.1" and "golang:1.26.1-alpine") so readers are not
confused and include a short guidance line on whether contributors should match
their local Go version to go.mod or rely on the Docker image.

Comment on lines +233 to +234
- [用戶文件](https://docs.newapi.pro/en/docs)
- [API 文件](https://docs.newapi.pro/en/docs/api)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if docs.newapi.pro supports zh locale for Traditional Chinese

curl -s -o /dev/null -w "%{http_code}" https://docs.newapi.pro/zh/docs
echo " - Status code for /zh/docs"

# Also check if there's a separate zh-TW or zh_TW locale
curl -s -o /dev/null -w "%{http_code}" https://docs.newapi.pro/zh-TW/docs
echo " - Status code for /zh-TW/docs"

curl -s -o /dev/null -w "%{http_code}" https://docs.newapi.pro/zh_TW/docs
echo " - Status code for /zh_TW/docs"

Repository: QuantumNous/new-api

Length of output: 162


🏁 Script executed:

#!/bin/bash
set -euo pipefail

check() {
  url="$1"
  echo "== $url =="
  # Print final effective URL after redirects + status code
  curl -s -o /dev/null -L -w "Final status: %{http_code}; Effective URL: %{url_effective}\n" "$url"
  # Also print first hop Location header if it is a redirect
  echo -n "Redirect Location(s): "
  curl -sI -o /dev/null -w "%{http_code}\n" "$url" | tail -n 1 >/dev/null
  # safer: just display Location header from HEAD (single hop)
  loc="$(curl -sI "$url" | awk 'BEGIN{IGNORECASE=1} /^location:/{print $2; exit}')"
  if [ -n "$loc" ]; then
    echo "$loc"
  else
    echo "(none)"
  fi
}

check "https://docs.newapi.pro/zh/docs"
check "https://docs.newapi.pro/zh-TW/docs"
check "https://docs.newapi.pro/zh_TW/docs"
check "https://docs.newapi.pro/en/docs"

Repository: QuantumNous/new-api

Length of output: 631


🏁 Script executed:

#!/bin/bash
set -euo pipefail

check() {
  url="$1"
  echo "== $url =="
  # Final status code and effective URL after redirects
  curl -s -o /dev/null -L -w "Final status: %{http_code}; Effective URL: %{url_effective}\n" "$url"
  # Single-hop Location (if any)
  loc="$(curl -sI "$url" | awk 'BEGIN{IGNORECASE=1} /^location:/{print $2; exit}')"
  if [ -n "$loc" ]; then
    echo "Single-hop Location: $loc"
  else
    echo "Single-hop Location: (none)"
  fi
}

check "https://docs.newapi.pro/zh/docs"
check "https://docs.newapi.pro/zh-TW/docs"
check "https://docs.newapi.pro/zh_TW/docs"
check "https://docs.newapi.pro/en/docs"

Repository: QuantumNous/new-api

Length of output: 627


🏁 Script executed:

#!/bin/bash
set -euo pipefail

check() {
  url="$1"
  echo "== $url =="
  curl -s -o /dev/null -L -w "Final status: %{http_code}; Effective URL: %{url_effective}\n" "$url"
  loc="$(curl -sI "$url" | awk 'BEGIN{IGNORECASE=1} /^location:/{print $2; exit}')"
  if [ -n "$loc" ]; then
    echo "Single-hop Location: $loc"
  else
    echo "Single-hop Location: (none)"
  fi
}

check "https://docs.newapi.pro/zh/docs"
check "https://docs.newapi.pro/zh-TW/docs"
check "https://docs.newapi.pro/zh_TW/docs"
check "https://docs.newapi.pro/en/docs"

Repository: QuantumNous/new-api

Length of output: 627


Fix Traditional Chinese doc links to point to the available Chinese locale

  • docs/development/DEVELOPMENT.zh_TW.md currently links to https://docs.newapi.pro/en/docs for both the user docs and API docs.
  • https://docs.newapi.pro/zh/docs returns 200, but https://docs.newapi.pro/zh-TW/docs and https://docs.newapi.pro/zh_TW/docs return 404.
  • Update the zh_TW links to https://docs.newapi.pro/zh/docs (or add a brief note if English is intentionally used).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/development/DEVELOPMENT.zh_TW.md` around lines 233 - 234, Update the two
Traditional Chinese links in docs/development/DEVELOPMENT.zh_TW.md (the link
texts "[用戶文件]" and "[API 文件]") to point to the working Chinese locale by
replacing their URLs from https://docs.newapi.pro/en/docs and
https://docs.newapi.pro/en/docs/api to https://docs.newapi.pro/zh/docs and
https://docs.newapi.pro/zh/docs/api respectively (or add a short parenthetical
note after the link if you intentionally want to keep English content).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants