-
Notifications
You must be signed in to change notification settings - Fork 551
Refactor docs structure: fix title/sidebar mismatches, complete English translation #56
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8388487
docs: add technical proposal for structure refactor + i18n completion
cyfung1031 8d73ad5
ci: add URL/i18n/frontmatter guardrail scripts (Phase 0)
cyfung1031 1848f02
fix: broken links/anchors, deprecated config, add /docs/use/ redirect…
cyfung1031 e1f44cb
refactor: file path = doc ID = URL, explicit sidebars (Phase 2)
cyfung1031 51c4e38
refactor: normalize image assets to <doc-name>.assets/ (Phase 3)
cyfung1031 5996642
refactor: title = sidebar label = H1, enforce frontmatter lint (Phase 4)
cyfung1031 f5f928e
docs(i18n): complete English translation, flip i18n parity to strict …
cyfung1031 6ba1ad6
docs: add CONTRIBUTING.md capturing the doc structure conventions
cyfung1031 9720445
i18n: translate the Agent sidebar category label
cyfung1031 7a90524
Delete REFACTOR_PROPOSAL.md
cyfung1031 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches-ignore: | ||
| - main | ||
| - release/* | ||
|
|
||
| env: | ||
| RUNNER_TOOL_CACHE: /toolcache | ||
|
|
||
| jobs: | ||
| check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - uses: pnpm/action-setup@v4 | ||
|
|
||
| - name: Use Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20.x" | ||
| cache: 'pnpm' | ||
|
|
||
| - name: Install | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Typecheck | ||
| run: pnpm run typecheck | ||
|
|
||
| - name: Build | ||
| run: pnpm run build | ||
|
|
||
| - name: Check URL inventory, i18n parity, and frontmatter conventions | ||
| run: pnpm run check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # 贡献指南 / Contributing Guide | ||
|
|
||
| > EN summary: file path = doc ID = published URL, no `id:`/`sidebar_position:` frontmatter, no number-prefixed filenames, `title:` is the only page-title source (no body `# H1`), images live in a sibling `<doc-name>.assets/` folder, and every `docs/**/*.md` needs an `i18n/en/docusaurus-plugin-content-docs/current/**/*.md` mirror. Run `pnpm run check` before opening a PR — it enforces all of this. See [REFACTOR_PROPOSAL.md](./REFACTOR_PROPOSAL.md) for the full rationale. | ||
|
|
||
| 本文档记录本仓库的文档结构约定,帮助人类贡献者和 AI Agent 在不读遍全部历史讨论的情况下,正确地新增/修改文档。 | ||
|
|
||
| ## 核心约定 | ||
|
|
||
| | 关注点 | 唯一来源 | | ||
| |---|---| | ||
| | URL / doc ID | 文件路径本身(不使用 `id:`、不使用数字前缀) | | ||
| | 页面标题 / 侧边栏文字 / `<title>` | frontmatter `title:`(可选 `sidebar_label:` 用于侧边栏简称) | | ||
| | 侧边栏排序 | `sidebars.js`,三个 sidebar(`use`/`dev`/`change`)均为显式列表 | | ||
| | 图片 | `<文档名>.assets/` 同级目录 | | ||
| | 内部链接 | 指向 `.md` 文件的相对路径(构建时会校验) | | ||
| | URL 不变契约 | 提交的 `scripts/url-inventory.txt`,每次 PR 由 CI 校验 | | ||
|
|
||
| **为什么这样做**:过去 `id:`/`sidebar_position:`/数字前缀/`README.md` 四种机制同时存在,导致侧边栏文字和页面标题可能不一致(例如"VSCode 扩展开发脚本" vs 页面实际标题"使用 VSCode 开发脚本"),且文件名与 URL 无法直接对应。现在文件路径就是 URL,看文件名就知道页面在哪。 | ||
|
|
||
| ## 新增一篇文档 | ||
|
|
||
| 1. 在 `docs/<section>/` 下创建 `xxx.md`(不要加数字前缀,不要用 `README.md`——除非确实是该目录的落地页,此时用 `index.md`)。 | ||
| 2. frontmatter 只写 `title:`(必需)和可选的 `sidebar_label:`;不要写 `id:` 或 `sidebar_position:`。 | ||
| 3. 正文**不要**再写一个 `# 标题` 作为 H1——`title:` 会自动渲染为页面标题。 | ||
| 4. 在 `sidebars.js` 对应的数组里加一行 `"section/xxx"`(除非这是一个故意不出现在侧边栏的隐藏页面,如 `use/install_comple`)。 | ||
| 5. 在 `i18n/en/docusaurus-plugin-content-docs/current/<section>/xxx.md` 创建英文镜像,路径和文件名必须完全一致。 | ||
| 6. 图片放在 `docs/<section>/xxx.assets/` 下,用 `./xxx.assets/foo.png` 引用;纯 UI 截图等语言无关的图片,英文版可以用 `@site/docs/<section>/xxx.assets/foo.png` 直接复用中文版的图片,不必重复存一份二进制文件。 | ||
| 7. 跑一次 `pnpm run build && pnpm run check`,确认三项检查全部通过。 | ||
|
|
||
| ## 新增一条更新日志 | ||
|
|
||
| `change/` 下的版本文件(`v1.x.md`)不使用数字前缀排序;在 `sidebars.js` 的 `change` 数组里手动插入新版本号(数组顺序即侧边栏顺序,新版本插在最前面)。`change/beta-changelog.md` 是 Beta 版本的单独更新日志。 | ||
|
|
||
| ## 加载不变的 URL(改动前必须确认不受影响) | ||
|
|
||
| 以下 URL 被扩展程序硬编码调用,**任何重构都不能改变它们**: | ||
|
|
||
| - `/docs/script_installation/` | ||
| - `/docs/use/install_comple/`(`install_comple` 是历史拼写,故意保留,不是笔误) | ||
| - `/uninstall/` | ||
|
|
||
| `scripts/check-url-inventory.mjs` 会在每次 `pnpm run build` 后对比 `scripts/url-inventory.txt`;如果你的改动导致路由变化,CI 会失败并列出具体差异。**新增**路由是允许的(比如加一个 redirect),但需要在同一个 PR 里用 `node scripts/check-url-inventory.mjs --write` 更新这个文件,让 review 能看到你有意添加了什么。 | ||
|
|
||
| ## 翻译对照表 | ||
|
|
||
| | 中文 | English | | ||
| |---|---| | ||
| | 脚本猫 | ScriptCat | | ||
| | 用户脚本 | user script | | ||
| | 后台脚本 | background script | | ||
| | 定时脚本 | scheduled script | | ||
| | 油猴 | Tampermonkey | | ||
|
|
||
| 英文标题结构应尽量与中文一一对应(标题层级、顺序一致),这样跨语言的锚点链接更容易对齐;注意 Docusaurus 生成的锚点是基于**渲染后的英文标题文本**,不是中文锚点的直接翻译(例如 `## Scheduled Script (\`@crontab\`)` 生成的锚点是 `#scheduled-script-crontab`,需要用构建产物核实,不要凭感觉猜。 | ||
|
|
||
| ## 本地检查命令 | ||
|
|
||
| ```bash | ||
| pnpm run build # 构建两个语言版本,onBrokenLinks/onBrokenAnchors 设置为 throw | ||
| pnpm run check # 依次跑 url 一致性 / i18n 覆盖率 / frontmatter 规范三项检查 | ||
| pnpm run check:urls # 单独跑 URL 不变契约检查 | ||
| pnpm run check:i18n # 单独跑中英文档配对检查 | ||
| pnpm run check:frontmatter # 单独跑 title/id/sidebar_position/H1 规范检查 | ||
| ``` |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,7 @@ | ||
| --- | ||
| sidebar_position: 9998 | ||
| title: v1.1 | ||
| --- | ||
|
|
||
| # v1.1 | ||
|
|
||
| ## 网盘平台 | ||
|
|
||
| 新增了Dropbox支持 | ||
|
|
||
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
docs/dev/agent/builtin-tools.md → docs/dev/agent/agent-builtin-tools.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
docs/dev/agent/conversation.md → docs/dev/agent/agent-conversation.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
docs/dev/agent/skill-dev.md → docs/dev/agent/agent-skill-dev.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check应该在build前面原来需要check构建后的产物