feat: add skill-forge and push-and-report skills

This commit is contained in:
sunjunzhao committed 2026-09-27 19:43:42 +08:00
1 parent 5eb50bf3ba
commit 41fe8bace2
5 files changed
+343 -4

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
---
name: push-and-report
description: 标准收尾流程:盘点 git 变更 → 英文 conventional commit → 推送远程(兼容 git submodule 多 repo 与单个 git repo)→ 通过 SPMS MCP 上报当日日报。当用户要求“提交推送并上报日报 / push 并写日报 / 提交代码顺便写日报”等收尾推送+日报场景时使用。
---
# 提交推送并上报日报
标准收尾流程,一条指令走完:变更盘点 → 英文 commit → 推送 → SPMS 日报。
## 触发方式
- “提交推送并上报日报” / “push 并写日报” / “提交代码并写今日日报”
- 任何同时要求「提交推送代码」和「上报日报」的表述
## Step 1: 盘点变更
- 主仓:`git status --short`、`git diff`(未暂存 + `git diff --cached` 已暂存)
- 判断仓库形态:`git submodule status` 非空即 submodule 多 repo,逐个 `git -C <sub> status --short`、`git -C <sub> diff`
- 摘要一律以实际 diff 为准,不凭记忆
- ⚠️ 全量提交(`git add -A` / `git add .`)前若发现与本次任务无关的杂项文件(未跟踪文档、临时文件等),先向用户确认是否一并提交,不擅自排除或包含
## Step 2: 生成英文 commit message
- conventional commits 风格(`feat: ...` / `fix: ...` / `refactor(scope): ...`),并参考该仓库 `git log --oneline` 的既有习惯
- 多 repo 共用同一条 message 时,message 要能概括全部改动
## Step 3: 提交并推送
按仓库形态选路径:
### A. 仓库自带推送脚本(优先)
若仓库提供一键推送脚本(例如内部已处理 submodule 的 `bin/push` 之类),直接用它,按其用法传入 message:
```bash
./bin/push "<commit message>"
```
使用前先快速浏览脚本确认行为(pull 策略、add 范围、是否处理 submodule)。
### B. submodule 多 repo(无脚本时手工)
1. 逐个处理有变更的子模块:
```bash
git -C <sub> pull && git -C <sub> add -A && git -C <sub> commit -m "<msg>" && git -C <sub> push
```
子模块处于 detached HEAD 时停下来报告,不擅自建分支。
2. 主仓同样四步(pull → add -A → commit → push),把子模块指针更新一并提交。
### C. 单个 git repo
```bash
git pull && git add -A && git commit -m "<msg>" && git push
```
### 通用要求
- 先 pull 后 push,减少 non-fast-forward;push 被拒绝时 pull 后重试一次,再失败则停下报告
- 每个 repo 的推送结果都要确认成功;部分失败如实汇报,不假装完成
- 只提交推送,不做 tag、release、force-push 等额外操作
## Step 4: 上报日报(SPMS MCP)
1. `date +%F` 取当天日期(不用会话里的旧时间)。
2. 确定项目:`spms_get_bootstrap` 查 projects,按当前仓库/产品名匹配;匹配不到或有歧义时问用户,不猜。
3. 调用 `spms_submit_report`:
- `project`:上一步确定的项目名或 id
- `content`:本次修改摘要,中文列表,逐条说清楚做了什么(改了什么、为什么、结果如何),不铺垫、不评价
- `mode`:默认 `append`(同日同产品自动追加);仅用户明确要求覆盖时用 `replace`
4. 日报由服务端按 项目→版本→产品 自动归集,无需手动指定产品。
## 约定
- commit message 用英文;日报内容用中文
- SPMS MCP 不可用时,完成 git 部分并明确告知日报未上报