> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 开发指南

> overleaf-pro 的贡献指南，涵盖仓库同步约束、分支约定以及上游/版本相关的常见问答。

### 简介

在开始开发之前，我们希望你先了解以下几点：

* Overleaf 官方在一个[内部仓库](http://github.com/overleaf/internal)中进行开发，社区版则发布在 [overleaf/overleaf](https://github.com/overleaf/overleaf)。由一个 copybot 负责在内部仓库和公共仓库之间同步代码。
* [Ayaka-notes/overleaf-pro](https://github.com/ayaka-notes/overleaf-pro) 是 Overleaf 社区版的一个分支版本。我们希望这个项目能够长期维护，因此在贡献之前请遵守以下规则。

### 提交规则

* 请不要对现有的 Overleaf 代码进行大范围修改。尽可能将功能集中在 `services/web/modules` 文件夹中。这样可以最大限度地减少我们之后合并和更新代码时的工作量。
* Vibe coding 确实非常便捷，但很容易把项目弄得一团糟，导致之后难以维护，因此请谨慎使用。
* 开发过程中请不要添加任何与翻译相关的内容；尽可能使用现有的翻译。
* 除非绝对必要，否则避免引入新的环境变量。如果确实需要，请确保它们尽可能与 Overleaf Toolkit 或 [docs.overleaf.com](https://docs.overleaf.com/) 中的环境变量保持一致。

### 分支规则

我们在 overleaf-pro 开发中使用以下分支：

* `main`：此分支仅用于同步上游代码，请**不要**提交任何外部更改。在此分支中，我们会设置一些类似 `ce-v[X.x.x]` 的标签，表示其对应 Overleaf 官方社区版的 `v[X.x.x]`。注意：此标签不可变！
* `server-pro`：此分支是日常开发的默认分支。
* `feature-X`：此分支用于开发某个特定功能。
* `release-vX.0.0`：专用于发布的分支，我们会在发布前在此进行一些热修复。

<Frame caption="Overleaf Pro 的分支规则">
  <img src="https://mintcdn.com/ayakaleaf-pro/x9kfDjtWlyyhG_mR/images/dev/release-model.png?fit=max&auto=format&n=x9kfDjtWlyyhG_mR&q=85&s=8a10a259ff5a6437cb05f03560a5dc2c" alt="" width="5652" height="2544" data-path="images/dev/release-model.png" />
</Frame>

### GitHub Action

[GitHub Action](https://github.com/ayaka-notes/overleaf-pro/actions) 负责自动化 CI/CD，包括：

* 每晚更新 main 分支
* 构建用于开发的 Docker 镜像
* 发布 Docker 镜像

### 问答

<Accordion title="如何找到 Overleaf 社区版 `X.0.0` 对应的提交哈希？">
  首先，你需要拉取 Docker 镜像，并运行以下命令来查看该 Docker 镜像中的标签：

  ```shellscript title="bash" wrap theme={null}
  docker inspect --format='{{json .Config.Labels}}' sharelatex/sharelatex:6.0.0
  {"com.overleaf.ce.revision":"b0d05c0cf0750714e1f467d20ed6c5f5e9467e8f","org.opencontainers.image.ref.name":"ubuntu","org.opencontainers.image.version":"24.04"}
  ```

  然后你可以检查该[提交（b0d05c0）](https://github.com/overleaf/overleaf/commit/b0d05c0cf0750714e1f467d20ed6c5f5e9467e8f)是否存在于上游 master 分支中。
</Accordion>

<Accordion title="为什么 CE 镜像 `6.0.0` 和 `6.0.1` 中的提交哈希相同？">
  这是预期行为。6.0.1 版本是基于 6.0.0 镜像构建的小型补丁版本。这些更改是通过对现有 6.0.0 镜像打补丁实现的，而不是基于新的提交重新构建镜像。因此，6.0.0 和 6.0.1 镜像中的提交哈希是相同的。

  详细信息请参阅 [hotfix](https://github.com/overleaf/overleaf/tree/main/server-ce/hotfix)。
</Accordion>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.