ce-commit-push-pr
everyinc/compound-engineering-plugin
提交、推送并创建拉取请求。当被要求发布/创建拉取请求时使用,或用于仅涉及拉取请求描述的流程,例如编写、重写或描述拉取请求正文。
...展开全部关于ce-commit-push-pr
在提交、推送代码以及创建拉取请求时,生成自适应且以价值为先的描述,其详细程度会根据更改规模动态调整。 该工具由“提交并创建拉取请求”、“发布此内容”、“创建拉取请求”或“打开拉取请求”等指令触发,同时也支持仅处理描述的流程,例如“编写拉取请求描述”或“重写拉取请求正文”,而无需进行提交或推送操作。 它定义了三种模式:仅描述(仅运行描述步骤并打印结果)、描述更新(刷新现有已打开拉取请求的正文并通过 gh pr edit 应用)以及完整工作流(按顺序运行所有步骤)。 当需要向用户提问时,它会使用平台的阻塞式提问工具,并配备聊天备选方案。
该工作流通过 Claude Code 中预填充的段落,或通过其他地方提供的上下文备用命令,收集 Git 上下文信息——包括状态、工作树差异、当前分支、最近的提交、远程默认分支以及任何现有的 PR。 步骤 1 确定分支和 PR 状态,并根据情况进行路由:若 HEAD 处于脱离状态,则提示创建功能分支;若位于默认分支且有工作内容,则自动创建功能分支(因为不支持直接推送默认分支);若位于默认分支且无工作内容,则停止;若位于功能分支,则继续。 步骤 2 确定命名规范,匹配仓库风格并默认采用常规提交;当存在歧义时,优先使用“fix:”而非“feat:”,并将“feat:”保留给真正的新功能。
步骤 3 进行提交和推送: 当位于默认分支时,会参考分支创建指南;将已修改的文件在文件层面分组为最多两到三个逻辑提交(避免使用 git add -p、git add -A 或 git add .,以免误将 .env 和构建产物一并纳入);并使用 git push -u origin HEAD 进行推送。 步骤 4:通过完整阅读必读的 PR 描述撰写指南来编写标题和正文,并做出证据决策——将用户提供的成果纳入“演示”部分, “演示”、“截图”或“证据”标题下整合用户提供的成果,当用户需要证据但未提供时主动询问,并跳过不可观察变更的证据——同时针对可观察的行为包含简明验证说明。 步骤 5 执行提交并生成报告,使用 `gh pr create` 创建新的拉取请求或使用 `gh pr edit` 更新现有拉取请求,在应用更新前预览标题和正文,并将正文写入临时文件。
常见问题
该技能支持哪些模式?
三种:仅描述模式(仅编写并打印 PR 描述)、描述更新模式(重写现有已打开 PR 的正文并提交),以及包含提交、推送以及创建或更新 PR 的完整工作流。
如果我在默认分支上运行它会发生什么?
如果有待处理的工作,它会自动创建一个功能分支,因为不支持直接推送默认分支。如果没有待处理的工作,它会报告该情况并停止运行。
对于常规提交,它如何在“fix:”和“feat:”之间进行区分?
它会匹配仓库的风格,并默认采用常规提交格式;当存在歧义时,优先使用 'fix:' 而不是 'feat:',因为添加代码来修复损坏或缺失的行为属于修复。'feat:' 仅用于真正的新功能。
为什么它会避免使用 `git add -A` 和 `git add .`?
因为这些命令会将 .env、构建产物和生成的文件等一并纳入。它会将特定文件添加到暂存区,并在文件层面上将更改分组为最多两到三个逻辑提交。
在 PR 描述中如何处理证据?
用户提供的材料将归入“演示”、“截图”或“证据”标题下;如果用户希望提供证据但尚未提供,技能会主动询问;对于不可观察的更改则省略证据,但会针对可观察的行为包含一条验证说明。
所有文件
3个文件SKILL.md8.6KB查看references/pr-description-writing.md7.2KB查看references/branch-creation.md1.8 KB查看Asking the user: use the host's blocking question tool — AskUserQuestion in Claude Code (ToolSearch select:AskUserQuestion first if unloaded), request_user_input in Codex, ask_question in Antigravity (agy), ask_user in Pi (needs the pi-ask-user extension). Fall back to the chat surface only when no blocking tool exists or the call errors, never because a schema load is required, and never silently skip the question.
Mode
- Description-only — the user wants just a description ("write/draft a PR description", "describe this PR", a pasted PR URL or number). Run Step 4 only and print it. Apply it only if asked. Pass any pasted PR ref so Pre-A resolves the range.
- Description update — refresh or rewrite an existing PR's description, with no commit or push intent. Resolve PR presence by the Context rule below: an exit-0
[]is "no open PR" (report it and stop), and a non-zero exit is unknown (resolve auth or connectivity, then stop until presence is known). With an open PR, run Step 4 in PR mode on that URL, then Step 5 to preview, confirm, and apply viagh pr edit. - Full workflow — otherwise: Steps 1-5. Enter Stack mode instead when intent or preference wants a stack.
mode:pipeline modifier, set by orchestrated callers such as lfg. Run the resolved mode non-interactively and suppress every blocking ask; each takes the conservative default: no existing-PR rewrite, the branch kept, an unresolvable base stopping rather than guessed, and a description-update preview applied directly, since that invocation is the apply intent. Pipeline stack mode uses only the intent and scope on the invocation and passes posture into the handoff.
Stack mode (opt-in)
Opt-in only. Enter it when intent or standing preference wants a multi-PR stack. An explicit stack request is required intent — do not re-read it as a single PR with a custom --base. Do not proactively suggest PR stacks. When the user did not ask for one, refuse nonsense stacks (one logical change, artificial slices) and stay single-PR.
In stack mode, load references/stack-submit.md before Step 3 and follow only its probing, topology, and retrospective construction; that layer-by-layer commit flow replaces ordinary Step 3. Do not submit there. Step 5 owns submission, the gh stack CLI dependency and residuals, and the handoff posture: posture:stack-ready by default, posture:stack-land only on explicit land intent, from the bottom open non-draft PR. Do not add posture: to this skill's argument-hint.
Context
Read references/context.md before Step 1. It owns the command table, the exit-code meanings, the fork and detached-HEAD traps, and the branch and PR resolution Steps 1-2 use. Two of its rules belong here too. Never ask whether to branch: a detached HEAD, or the default branch with work on it, creates one, and the default branch with no work reports and stops. And with conventional commits, default to fix: over feat: when ambiguous, unless the user overrides.
Three rules govern the run.
Every git and gh probe is its own argv-form call, gathering and re-verification alike, and its exit status is control flow. The reference gives the reason and names the two compound recipes this skill pins.
Probe output is a snapshot. Re-verify branch, remote, and PR state right before each consequential action: Step 3's push, Step 5's create.
Only an exit-0 [] from a query against the base repo means "no open PR." A non-zero exit is unknown, never "none". On a fork checkout, target the base with -R and pass the branch name only, since --head <owner>:<branch> silently returns []. With results, do not blindly take index 0: match head owner and branch, and stop on an ambiguous match. Note the URL and body from that entry — Step 5 routes on the URL, Step 4 rewrites the existing body.
Artifact Root
Resolve <root> once when archival is on: it writes an explainer under <root>/explainers/.
Resolve the CE artifact root <root> before composing any artifact path.
- Read
docs_rootfrom<repo-root>/.compound-engineering/config.yamlonly (<repo-root>=git rev-parse --show-toplevel). Do not read it fromconfig.local.yaml. Unset -><root>isdocs, exactly as before. - Validate a set value: a repo-relative directory whose real, symlink-resolved path stays inside the repo and is neither the repo root nor under
.git/. Otherwise stop with an error namingdocs_rootand the value -- never fall back todocs. - Use
<root>as the sole artifact location: create it if absent, compose each path as<root>/<subdir>with this skill's own subdirectory, and never also readdocs.
Step 3: Commit and push
Read references/commit-and-push.md for branch creation, commit grouping, the message and staging shapes, and the push. Branching off the default branch is the fragile case — stale local base, unpushed commits on it, colliding uncommitted changes — and references/branch-creation.md owns that flow. If the stack reference already committed retrospective layers, skip to Step 4; gh stack submit pushes in Step 5.
Two rules bound this step. Never git add -A or git add . — name the files, so .env, build, and generated files cannot ride along, and pass that same path list to git commit, so nothing staged earlier is swept in. Honor exclude:<paths>: those files stay uncommitted and the report says so.
Step 4: Compose the PR title and body
You MUST read references/pr-description-writing.md in full — it owns the title and body content rules, including the rule to preserve an existing Related: / Fixes on rewrite. Then read references/compose.md for the gates before composition: the evidence decision; the teaching gate, where pr_teaching_section defaults on, pr_teaching_archive defaults off, and only an active (non-commented) key changes either; and the branding gate, where branding is off unless this invocation carries branding:on or the user asks for Compound Engineering branding in this prompt.
If Step 1 found an existing PR, pass its URL to Step 4 so PR mode fetches the existing body.
Step 5: Apply and report
Read references/apply-and-handoff.md for the apply routes, preview-before-edit, archival, and handoff. Two rules bound the external writes. Re-run the existing-PR check right before gh pr create and route on it: a matching PR takes the existing-PR path, exit-0 [] creates, non-zero blocks. And pass the body via --body-file <path>, never stdin — gh exits 0 with an empty body.
The completion gate is here. In an interactive full workflow, or in mode:pipeline when this run submitted a stack, a reported PR URL, a stack submit, or new commits on an open PR leave this run not done until ce-babysit-pr owns follow-on for that PR. Reporting the PR URL alone is not success.
The only skips are babysit:off, a standing auto_babysit: false in CE config, and that reference's do-not-fire cases, drafts among them. No other watch substitutes: not ci-watcher, not gh pr checks --watch, not a hand-rolled poll, not "later". If ce-babysit-pr cannot be loaded or started, stop and report it blocked.





首页
