Git迁移
- 作者仓库星标 121,528
- 作者更新于 实时读取
- 作者仓库 electron
- 领域
- 工程开发
- 兼容 Agent
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- 信任分
- 88 / 100 · 社区维护
- 作者 / 版本 / 许可
- @electron · 未声明 license
- Token 消耗评级
- 中等消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部 API Key
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 底层运行要求
- 无特殊要求
- 文件与系统权限
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 网络行为
- 仅限本地
- 安装命令数
- 26 条
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: electron-chromium-upgrade
description: Guide for performing Chromium version upgrades in the Electron project. Use when working on the…
category: 工程开发
runtime: 无特殊运行时
---
# electron-chromium-upgrade 输出预览
## PART A: 任务判断
- 适用问题:代码实现、重构、调试或代码审查。
- 输入要求:目标材料、限制条件、期望输出和验收方式。
- 证据边界:围绕“Summary / Success Criteria / Context”读取原文规则,不把推断写成作者承诺。
## PART B: 执行结果
- **01** 任务判断:确认你的需求是否属于代码实现、重构、调试或代码审查,并标出输入、限制和预期结果。
- **02** 执行计划:优先按“Summary / Success Criteria / Context”拆成步骤,说明每一步会读取什么、修改什么、产出什么。
- **03** 交付结果:给出可复制的命令、文件改动、检查清单或内容草稿,并说明如何继续迭代。
- **04** 风险边界:结合 读取文件、写入/修改文件、执行终端命令、主要在本地完成、通常不需要额外 API Key 给出执行前确认项。
## Running Rules
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先小样例验证,再放大到真实任务。
- 交付时同时给结果、检查口径和下一步迭代建议。 原文出现了 `/src` 这类斜杠命令;如果你的 Agent 支持命令触发,优先用命令开场,再补充目标和边界。
告诉 Agent 目标文件或材料、期望结果、不可改范围、是否允许联网或执行命令。本 Skill 的权限画像是:读取文件、写入/修改文件、执行终端命令。
先用一个小任务确认它会围绕“Summary / Success Criteria / Context”工作;涉及文件或命令时,先看 diff、日志、预览或测试结果。
检查最终产物是否包含明确结果、必要证据和下一步动作;如果输出泛泛而谈,就补充输入、边界和验收标准后重跑。
---
name: electron-chromium-upgrade
description: Guide for performing Chromium version upgrades in the Electron project. Use when working on the…
category: 工程开发
source: electron/electron
---
# electron-chromium-upgrade
## 什么时候使用
- 把工程方向的常用动作沉淀成 Agent 可调用的技能 适合处理工程开发场景下的代码实现、调试、重构、测试或代码审查,核心价值是把输入、判断、执行、验证和交付边界固定下来,避免 Agent 泛泛回答。 把任务拆成可执行、可检查、可继续迭代…
- 面向代码实现、重构、调试或代码审查,优先处理能明确输入、步骤和验收标准的工作。
## 需要提供什么
- 目标材料、目录范围、期望结果和不可改动内容。
- 是否允许联网、执行命令、读写文件或调用外部服务。
## 执行规则
- 围绕「Summary / Success Criteria / Context」组织步骤,不把推断写成作者事实。
- 读取文件、写入/修改文件、执行终端命令;主要在本地完成;通常不需要额外 API Key。
- 先跑小样例,确认结果可检查后再扩大任务范围。
## 输出要求
- 给出最终产物、关键证据、验证方式和下一步动作。
- 信息不足时标记 unknown,不编造命令、平台或依赖。 作者原文负责流程事实;仓库文件负责来源和命令;流狐只补充适用场景、限制和质量判断。
skill "electron-chromium-upgrade" {
输入层 -> 用户目标 + 目标文件 + 禁止范围 + 验收标准
上下文层 -> Summary / Success Criteria / Context
规则层 -> SKILL.md 触发条件 / 执行顺序 / 输出格式
运行层 -> 无特殊运行时 | 读取文件、写入/修改文件、执行终端命令 | 主要在本地完成
安全层 -> 通常不需要额外 API Key + 小任务验证 + diff / 日志复核
输出层 -> 可复制结果 + 检查清单 + 下一步迭代
} Electron Chromium Upgrade: Phase One
Summary
Run e sync --3 repeatedly, fixing patch conflicts as they arise, until it succeeds. Then export patches and commit changes atomically.
Success Criteria
Linter Requirements:
- Code/patch edits: Title must be exactly
{CL-Number}: {upstream CL original title}withRef: {URL}in the body. - Metadata-only patch updates (hashes/line numbers): Message must be exactly
chore: update patcheswith no body.
Phase One is complete when:
e sync --3exits with code 0 (no patch failures)- All changes are committed per the commit guidelines
Do not stop until these criteria are met.
CRITICAL Do not delete or skip patches unless 100% certain the patch is no longer needed. Complicated conflicts or hard to resolve issues should be presented to the user after you have exhausted all other options. Do not delete the patch just because you can't solve it.
CRITICAL Never use git am --skip and then manually recreate a patch by making a new commit. This destroys the original patch's authorship, commit message, and position in the series. If git am --continue reports "No changes", investigate why — the changes were likely absorbed by a prior conflict resolution's 3-way merge. Present this situation to the user rather than skipping and recreating.
Context
The roller/chromium/main branch is created by automation to update Electron's Chromium dependency SHA. No work has been done to handle breaking changes between the old and new versions.
Key directories:
- Current directory: Electron repo (always run
ecommands here) ..(parent): Chromium repo (where most patches apply)patches/: Patch files organized by targetdocs/development/patches.md: Patch system documentation
Pre-flight Checks
Run these once at the start of each upgrade session:
- Clear rerere cache (if enabled):
git rerere clearin both the electron and..repos. Stale recorded resolutions from a prior attempt can silently apply wrong merges. - Ensure pre-commit hooks are installed: Check that
.git/hooks/pre-commitexists. If not, runyarn huskyto install it. The hook runslint-stagedwhich handles clang-format for C++ files.
Workflow
- Run
e sync --3(the--3flag enables 3-way merge, always required) - If succeeds → skip to step 5
- If patch fails:
- Identify target repo and patch from error output
- Analyze failure (see references/patch-analysis.md)
- Fix conflict in target repo's working directory
- Run
git am --continuein affected repo - Repeat until all patches for that repo apply
- IMPORTANT: Once
git am --continuesucceeds you MUST rune patches {target}to export fixes - Return to step 1
- When
e sync --3succeeds, rune patches all - Read
references/phase-one-commit-guidelines.mdNOW, then commit changes following those instructions exactly.
Commands Reference
| Command | Purpose |
|---|---|
e sync --3 |
Clone deps and apply patches with 3-way merge |
git am --continue |
Continue after resolving conflict (run in target repo) |
e patches {target} |
Export commits from target repo to patch files |
e patches all |
Export all patches from all targets |
e patches {target} --commit-updates |
Export patches and auto-commit trivial changes |
e patches --list-targets |
List targets and config paths |
Patch System Mental Model
patches/{target}/*.patch → [e sync --3] → target repo commits
← [e patches] ←
When to Edit Patches
| Situation | Action |
|---|---|
During active git am conflict |
Fix in target repo, then git am --continue |
| Modifying patch outside conflict | Edit .patch file directly |
| Creating new patch (rare, avoid) | Commit in target repo, then e patches {target} |
Fix existing patches 99% of the time rather than creating new ones.
Patch Fixing Rules
- Preserve authorship: Keep original author in TODO comments (from patch
From:field) - Never change TODO assignees:
TODO(name)must retain original name - Update descriptions: If upstream changed (e.g.,
DCHECK→CHECK_IS_TEST), update patch commit message to reflect current state - Never skip-and-recreate a patch: If
git am --continuesays "No changes — did you forget to use 'git add'?", do NOT rungit am --skipand create a replacement commit. The patch's changes were already absorbed by a prior 3-way merge resolution. This means an earlier conflict resolution pulled in too many changes. Present the situation to the user for guidance — the correct fix may require re-doing an earlier resolution more carefully to keep each patch's changes separate.
Electron Chromium Upgrade: Phase Two
Summary
Run e build -k 999 -- --quiet repeatedly, fixing build issues as they arise, until it succeeds. Then run e start --version to validate Electron launches and commit changes atomically.
Run Phase Two immediately after Phase One is complete.
Success Criteria
Linter Requirements:
- Code/patch edits: Title must be exactly
{CL-Number}: {upstream CL original title}withRef: {URL}in the body. - Metadata-only patch updates (hashes/line numbers): Message must be exactly
chore: update patcheswith no body.
Phase Two is complete when:
e build -k 999 -- --quietexits with code 0 (no build failures)e start --versionhas been run to check Electron launches- All changes are committed per the commit guidelines
Do not stop until these criteria are met. Do not delete code or features, never comment out code in order to take short cut. Make all existing code, logic and intention work.
Context
The roller/chromium/main branch is created by automation to update Electron's Chromium dependency SHA. No work has been done to handle breaking changes between the old and new versions. Chromium APIs frequently are renamed or refactored. In every case the code in Electron must be updated to account for the change in Chromium, strongly avoid making changes to the code in chromium to fix Electrons build.
Key directories:
- Current directory: Electron repo (always run
ecommands here) ..(parent): Chromium repo (do not touch this code to fix build issues, just read it to obtain context)
Workflow
- Run
e build -k 999 -- --quiet(the--quietflag suppresses per-target status lines, showing only errors and the final result) - If succeeds → skip to step 6
- If build fails:
- Identify underlying file in "electron" from the compilation error message
- Analyze failure
- Fix build issue by adapting Electron's code for the change in Chromium
- Run
e build -t {target_that_failed}.oto build just the failed target we were specifically fixing- You can identify the target_that_failed from the failure line in the build log. E.g.
FAILED: 2e506007-8d5d-4f38-bdd1-b5cd77999a77 "./obj/electron/chromium_src/chrome/process_singleton_posix.o" CXX obj/electron/chromium_src/chrome/process_singleton_posix.othe target name isobj/electron/chromium_src/chrome/process_singleton_posix.o
- You can identify the target_that_failed from the failure line in the build log. E.g.
- Read
references/phase-two-commit-guidelines.mdNOW, then commit changes following those instructions exactly. - Return to step 1
- CRITICAL: After ANY commit (especially patch commits), immediately run
git statusin the electron repo- Look for other modified
.patchfiles that only have index/hunk header changes - These are dependent patches affected by your fix
- Commit them immediately with:
git commit -am "chore: update patches"
- Look for other modified
- Return to step 1
- When
e buildsucceeds, rune start --version - Check if you have any pending changes in the Chromium repo by running
git status- If you have changes follow the instructions below in "A. Patch Fixes" to correctly commit those modifications into the appropriate patch file
Commands Reference
| Command | Purpose |
|---|---|
e build -k 999 -- --quiet |
Build Electron, continue on errors, suppress status lines |
e build -t {target}.o |
Build just one specific target to verify a fix |
e start --version |
Validate Electron launches after successful build |
Two Types of Build Fixes
A. Patch Fixes (for files in chromium_src or patched Chromium files)
When the error is in a file that Electron patches (check with grep -l "filename" patches/chromium/*.patch):
- Edit the file in the Chromium source tree (e.g.,
/src/chrome/browser/...) - Create a fixup commit targeting the original patch commit:
cd .. # to chromium repo git add <modified-file> git commit --fixup=<original-patch-commit-hash> GIT_SEQUENCE_EDITOR=: git rebase --autosquash --autostash -i <commit>^ - Export the updated patch:
e patches chromium - Commit the updated patch file following
references/phase-one-commit-guidelines.md.
To find the original patch commit to fixup: git log --oneline | grep -i "keyword from patch name"
The base commit for rebase is the Chromium commit before patches were applied. Find it by checking the refs/patches/upstream-head ref.
B. Electron Code Fixes (for files in shell/, electron/, etc.)
When the error is in Electron's own source code:
- Edit files directly in the electron repo
- Commit directly (no patch export needed)
Critical: Read Before Committing
- Before ANY Phase One commits: Read
references/phase-one-commit-guidelines.md - Before ANY Phase Two commits: Read
references/phase-two-commit-guidelines.md
Skill Directory Structure
This skill has additional reference files in references/:
- patch-analysis.md - How to analyze patch failures
- phase-one-commit-guidelines.md - Commit format for Phase One
- phase-two-commit-guidelines.md - Commit format for Phase Two
Read these when referenced in the workflow steps.
先判断是否适合
作者设计意图
作者的方法与取舍
边界和复核