upstream-source-research
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUpstream Source Research
上游源码研究
Decide first whether ordinary web research is enough or whether the task should escalate.
首先判断普通网页搜索是否足够,还是需要升级研究方式。
Default Approach
默认方法
- Start with the smallest viable method.
- Prefer hosted views and web fetches for short lookups.
- Switch to ,
gh, or another relevant CLI when you need better access to issues, PRs, release metadata, tags, or repository navigation.glab - Use a shallow clone into when you need local source inspection, fast code search, commit history, or broader reading across many files.
/tmp - Keep the goal narrow: inspect and extract conclusions, not set up a long-lived checkout unless the task truly needs one.
- 从最简可行的方法开始。
- 对于简短查询,优先使用托管视图和网页获取方式。
- 当需要更好地访问问题、PR、版本元数据、标签或仓库导航时,切换至、
gh或其他相关CLI工具。glab - 当需要本地源码检查、快速代码搜索、提交历史或跨多文件阅读时,在目录进行浅克隆。
/tmp - 目标要明确:仅检查并提取结论,除非任务确实需要,否则不要创建长期存在的检出副本。
When To Escalate Beyond Web
何时需要超越网页搜索
- The answer depends on real source code across multiple files.
- You need issue, PR, tag, branch, or release data that is awkward or incomplete via web fetches.
- Browser, fetch, or API calls are hitting rate limits or other access limits.
- The investigation is large enough that repeated web requests are slower or noisier than local inspection.
- You need repository-wide search, blame, or commit-level context.
- 答案需要跨多个文件的真实源代码支撑。
- 你需要的问题、PR、标签、分支或版本数据通过网页获取方式难以获取或不完整。
- 浏览器、获取请求或API调用遇到速率限制或其他访问限制。
- 调查范围较大,重复网页请求比本地检查更慢或更杂乱。
- 你需要仓库级别的搜索、blame或提交级别的上下文信息。
Tool Choice
工具选择
- Prefer for GitHub and
ghfor GitLab when available.glab - Prefer non-interactive CLI commands that return focused data.
- Prefer lightweight remote inspection such as when refs or tags are enough.
git ls-remote - Prefer shallow clones such as unless history is part of the question.
--depth 1 - Deepen incrementally with or a larger
git fetch --deepenonly if the investigation proves more history is needed.--depth - Clone into by default for temporary inspection work.
/tmp - Avoid turning research checkouts into project dependencies or permanent local state unless the user asks.
- 若可用,GitHub优先使用,GitLab优先使用
gh。glab - 优先使用返回聚焦数据的非交互式CLI命令。
- 当仅需要引用或标签时,优先使用轻量级远程检查方式,如。
git ls-remote - 除非问题涉及历史记录,否则优先使用浅克隆(如)。
--depth 1 - 仅当调查证明需要更多历史记录时,才通过或更大的
git fetch --deepen参数逐步加深克隆深度。--depth - 默认在目录克隆以进行临时检查工作。
/tmp - 除非用户要求,否则不要将研究用的检出副本转为项目依赖或永久本地状态。
Temporary Clone Hygiene
临时克隆规范
- Treat clones as disposable research artifacts.
/tmp - If the clone needs submodules, deeper history, or large assets, keep checking whether that extra weight is actually required.
- After inspection, if the temporary folder is larger than about , warn the user and suggest cleanup now or a later automatic cleanup job.
512 MB - On systemd-based personal Linux machines, recommend a cleanup timer task over plain
systemdbecause a timer can usecronand catch up after the laptop was off or asleep.Persistent=true
- 将目录下的克隆视为可丢弃的研究产物。
/tmp - 如果克隆需要子模块、更深的历史记录或大型资源,持续确认这些额外开销是否真的必要。
- 检查后,如果临时文件夹大小超过约512 MB,需提醒用户并建议立即清理或设置后续自动清理任务。
- 在基于systemd的个人Linux机器上,推荐使用清理定时器任务而非普通
systemd,因为定时器可使用cron参数,在笔记本关机或休眠后仍能完成清理。Persistent=true
Return Value
返回值
Return the useful conclusion, the evidence source, and any constraints discovered during research.
If you used a temporary clone, mention where it was created and whether it should be deleted.
返回有用的结论、证据来源以及研究过程中发现的任何限制条件。
如果使用了临时克隆,需说明其创建位置以及是否需要删除。
Avoid
注意事项
- Cloning by habit when one or two web reads would answer the question.
- Fetching full history when shallow history is enough.
- Leaving large temporary research clones behind without telling the user.
- Treating rate-limit friction as a blocker before trying better-suited CLIs or a local clone.
- 当一两次网页浏览就能解决问题时,不要习惯性地进行克隆。
- 当浅历史记录足够时,不要获取完整历史记录。
- 不要留下大型临时研究克隆而不告知用户。
- 在尝试更合适的CLI工具或本地克隆之前,不要将速率限制视为阻碍。