pflow-commit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOn any failure (non-zero exit from a Shell command OR an field in JSON output) print and stop immediately.
error⚠️ <error message>任何失败情况(Shell命令返回非零值或JSON输出中包含字段)下,打印并立即停止。
error⚠️ <error message>Steps
步骤
-
Get the context:. If the output is
.agents/skills/pflow-commit/scripts/git-commit-context.sh, tell the user there is nothing to commit and stop.No changes detected. -
Compose MESSAGE (see format below) using ONLY the step-1 output — no other sources.
-
Run the commit command in escalated execution mode from the start (forwrite access):
.git. The script prints JSON:.agents/skills/pflow-commit/scripts/git-commit-push.sh --message "MESSAGE"on success, or{commit_hash, branch_name, push_status}on failure. If{…, error:{step, message}}is present, printerrorand stop.⚠️ <error.message> -
Reply exactly, substituting values from the JSON:text
✅ Commit message: MESSAGE ✅ Committed and pushed: Hash: <commit_hash> | Branch: <branch_name> | Status: <push_status>
-
获取上下文:执行。如果输出为
.agents/skills/pflow-commit/scripts/git-commit-context.sh,告知用户没有内容可提交并停止。No changes detected. -
仅使用步骤1的输出来编写提交信息MESSAGE(格式见下文)——不得使用其他来源的信息。
-
从一开始就以提升权限的执行模式运行提交命令(以获取写入权限):
.git。脚本执行成功时会输出JSON:.agents/skills/pflow-commit/scripts/git-commit-push.sh --message "MESSAGE";失败时会输出{commit_hash, branch_name, push_status}。如果存在{…, error:{step, message}}字段,打印error并停止。⚠️ <error.message> -
严格按照以下格式回复,替换JSON中的对应值:text
✅ Commit message: MESSAGE ✅ Committed and pushed: Hash: <commit_hash> | Branch: <branch_name> | Status: <push_status>
Gotchas
注意事项
- runs
git-commit-push.sh— the commit includes ALL working-tree changes, not just the ones your message describes. Account for this when composing the text.git add -A - The script now prechecks write access and stale
.git; if it fails, rerun in escalated execution context.index.lock - The step-1 output is the ONLY input. Do not enrich or verify it: no reading files, no commands, no grep/search, no conversation history, no sub-agents. If the context is incomplete or truncated, write the message from what it does contain — describe only what is visible and stay generic about the rest. Never ask the user for more context.
git - The context from step 1 is truncated: at most 50 lines per file and 600 lines total. Large diffs are shown only partially — don't draw conclusions about the cut-off part.
- :
push_status(upstream already existed) orpushed(created viapushed_with_upstream).git push -u origin <branch> - The push script does not write git errors to stderr — they go into the JSON field. Always check it (step 3), otherwise a failed commit/push goes unnoticed.
error
- 会执行
git-commit-push.sh——提交会包含工作树中的所有变更,而不仅仅是提交信息中描述的内容。编写文本时要考虑到这一点。git add -A - 脚本现在会预先检查写入权限和过期的
.git;如果检查失败,需在提升权限的执行环境中重新运行。index.lock - 步骤1的输出是唯一输入来源。不得补充或验证该输入:不得读取文件、执行命令、进行grep/搜索、查看对话历史或调用子Agent。如果上下文不完整或被截断,仅根据现有内容编写提交信息——只描述可见部分,其余部分保持通用表述。切勿向用户索要更多上下文。
git - 步骤1的上下文会被截断:每个文件最多显示50行,总计最多600行。大型差异仅会部分显示——不要对被截断的内容做出推断。
- 的取值:
push_status(上游分支已存在)或pushed(通过pushed_with_upstream创建上游分支)。git push -u origin <branch> - 推送脚本不会将Git错误写入stderr——错误信息会存入JSON的字段。务必检查该字段(步骤3),否则提交/推送失败可能会被忽略。
error
Message format (Conventional Commits)
提交信息格式(Conventional Commits)
<type>[(scope)][!]: <description>- Language: the entire message (description, body, and footers) MUST always be written in English — regardless of the conversation language — unless the user explicitly requests another language.
- Types: (MINOR),
feat(PATCH),fix,build,chore,ci,docs,style,refactor,perf,test.revert - Breaking change: in the header or a
!footer (MAJOR).BREAKING CHANGE: ... - — only when it adds value. Pick the narrowest correct type; split unrelated types into separate commits.
scope - Description — short, in English, imperative mood ("add", not "added").
Examples: · ·
feat: add user pagefix(parser): handle empty inputfeat!: remove legacy auth flow<type>[(scope)][!]: <description>- 语言要求:整个提交信息(描述、正文和页脚)必须始终使用英文——无论对话使用何种语言——除非用户明确要求使用其他语言。
- 类型:(MINOR版本)、
feat(PATCH版本)、fix、build、chore、ci、docs、style、refactor、perf、test。revert - 破坏性变更:在标题中添加或在页脚中添加
!(对应MAJOR版本)。BREAKING CHANGE: ... - ——仅在能增加信息价值时使用。选择最精准的类型;将不相关的类型拆分为单独的提交。
scope - 描述——简短、英文、祈使语气(使用“add”而非“added”)。
示例: · ·
feat: add user pagefix(parser): handle empty inputfeat!: remove legacy auth flow