推送
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 工程开发
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 读取环境变量
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
收集背景信息。并行运行所有这些:在继续之前处理边缘情况:分离头:停止。告诉用户首先创建或签出分支。未配置远程:停止。告诉用户添加一个遥控器。在未提交更改的 main/master 上:在继续之前发出警告并要求确认。
这是验证一切的唯一命令。不要重复其单独的检查。该脚本涵盖:架构约束(无平台标头、src/ 中无 malloc)、clang 格式、所有 3 个配置文件构建(数据/音频/媒体)、每个配置文件的 ctest、符号前缀验证、无全局可变状态以及 AddressSanitizer 构建+测试。如果失败:
仅在第 2 步 CI 验证通过后才能达到。如果 `git status` 显示未提交的更改(包括步骤 2 中的任何 clang 格式自动修复): 显示更改:按名称暂存相关文件。切勿暂存匹配的文件:`.env*`、`credentials*`、`*.key`、`*.pem`、`*.p12`。如果此类文件出现在工作树中,则警告用户。
检测今天提交中的分层增量修复,这些修复可以被压缩到更干净的历史记录中。如果今天提交少于 2 次:完全跳过。继续执行第 5 步。寻找以下信号: 今天提交超过 3 次修改的任何 `.c` 或 `.h` 文件(强信号) 修复链:“实现 X”,然后“修复 X”或“修复 X 中的拼写错误”
将更改的文件与上游进行比较,以检测可能过时的文档。应用这些映射规则: 更改的文件 · 检查此文档 · 原因 `src/nano_*.c` 或 `src/nano_*.h` · `docs/QUALITY_SCORE.md` · 模块等级可能需要更新 `include/nanortc.h` · `ARCHITECTURE.md` · 公共 API 更改影响架构
检查上游跟踪和推送: 无上游:`git push -u origin $(git branch --show-current)` 有上游:`git push`
显示英文摘要:如果分支不是`main`,建议创建 PR。
# git-push — NanoRTC Pre-flight Push Workflow
Run local CI, fix formatting, review commits, check doc freshness, then push. The goal is to
catch everything GitHub Actions would catch, before the code leaves your machine.
## Step 1: Pre-flight Status
Gather context. Run ALL of these in parallel:
```bash
git status
git branch --show-current
git remote -v
git log --oneline -5
git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "NO_UPSTREAM"
```
Handle edge cases before proceeding:
- **Detached HEAD**: Stop. Tell the user to create or checkout a branch first.
- **No remote configured**: Stop. Tell the user to add a remote.
- **On main/master with uncommitted changes**: Warn and ask for confirmation before continuing.
- **Clean working tree AND up-to-date with remote**: Tell the user nothing to push. Stop.
## Step 2: CI Validation
This is the ONE command that validates everything. Do not replicate its individual checks.
```bash
./scripts/ci-check.sh
```
This script covers: architecture constraints (no platform headers, no malloc in src/),
clang-format, all 3 profile builds (DATA/AUDIO/MEDIA), ctest for each profile,
symbol prefix validation, no global mutable state, and AddressSanitizer build+test.
**If it fails:**
1. Check if the failure is clang-format. Look for `FAIL` next to `clang-format check` in the
output while other checks passed. If so, auto-fix:
```bash
clang-format -i src/*.c src/*.h include/*.h crypto/*.h crypto/*.c
```
Then re-run `./scripts/ci-check.sh`. If it passes now, the formatting fixes become part of
the uncommitted changes handled in Step 3.
2. If the failure is NOT clang-format (build error, test failure, architecture constraint
violation, symbol naming, ASan failure): **stop the entire flow**. Show the failure output
clearly to the user. Do NOT attempt automatic fixes for anything other than formatting.
## Step 3: Handle Uncommitted Changes
Only reached after Step 2 CI validation passes. If `git status` shows uncommitted changes
(including any clang-format auto-fixes from Step 2):
1. Show changes:
```bash
git status
git diff HEAD
```
2. Stage relevant files by name. **Never stage** files matching: `.env*`, `credentials*`,
`*.key`, `*.pem`, `*.p12`. Warn the user if such files appear in the working tree.
3. Generate a commit message with conventional commit prefix (`feat:`, `fix:`, `docs:`,
`refactor:`, `test:`, `chore:`, `style:`) based on the actual changes. If the only change
is formatting, use `style: auto-fix clang-format`.
4. Commit using HEREDOC format:
```bash
git commit -m "$(cat <<'EOF'
<type>: <description>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
EOF
)"
```
If no uncommitted changes, skip this step.
## Step 4: Patch-on-Patch Review (Advisory)
Detect layered incremental fixes in today's commits that could be squashed into cleaner history.
```bash
# Today's commits on this branch
git log --since="00:00" --format='%h %s' --no-merges
# Source files modified in multiple commits today
git log --since="00:00" --format='%h' --no-merges | \
xargs -I{} git diff-tree --no-commit-id --name-only -r {} | \
grep -E '\.(c|h)$' | sort | uniq -c | sort -rn
```
**If fewer than 2 commits today:** Skip entirely. Proceed to Step 5.
Look for these signals:
- Any `.c` or `.h` file modified in 3+ commits today (strong signal)
- Fix chains: "implement X" then "fix X" or "fix typo in X"
- Messages containing "forgot to", "actually", "another attempt"
If detected, warn the user:
> Patch-on-patch detected: `nano_stun.c` modified across multiple commits today.
> Consider squashing with `git rebase -i` before pushing.
This is advisory only — if the user says proceed, continue to Step 5.
## Step 5: Documentation Freshness Check (Advisory)
Compare changed files against upstream to detect potentially stale documentation.
```bash
UPSTREAM=$(git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "origin/main")
git diff --name-only "$UPSTREAM"...HEAD 2>/dev/null || git diff --name-only HEAD~5..HEAD
```
Apply these mapping rules:
| Changed files | Check this doc | Reason |
|---|---|---|
| `src/nano_*.c` or `src/nano_*.h` | `docs/QUALITY_SCORE.md` | Module grade may need updating |
| `include/nanortc.h` | `ARCHITECTURE.md` | Public API change affects architecture |
| New file in `src/` | `docs/engineering/development-workflow.md` | Module order may need updating |
| `CMakeLists.txt` | `AGENTS.md` | Build instructions may have changed |
| New `tests/test_*.c` | `docs/QUALITY_SCORE.md` | Test coverage column may need updating |
| `crypto/nanortc_crypto*.c` | `docs/references/rfc-index.md` | Crypto RFC refs may need adding |
| Any `src/` or `crypto/` file | `docs/exec-plans/active/*.md` | Active plan progress may need updating |
If staleness detected, list the potential gaps and let the user decide:
> Docs may need updating:
> - `docs/QUALITY_SCORE.md` — nano_stun implemented, grade may need bumping from D
> - `ARCHITECTURE.md` — nanortc.h public API changed
Do not block. The user decides whether to update docs before or after pushing.
## Step 6: Push
Check upstream tracking and push:
```bash
# Check if upstream exists
git rev-parse --abbrev-ref @{upstream} 2>/dev/null
```
- **No upstream**: `git push -u origin $(git branch --show-current)`
- **Has upstream**: `git push`
## Step 7: Post-push Summary
Display a summary in English:
```
Push complete
Branch: feat/stun-parser
Commits: 3
Remote: origin (git@github.com:user/nanortc.git)
CI validation: PASSED
Doc reminders: 1 (QUALITY_SCORE.md)
```
If branch is not `main`, suggest creating a PR.
## Rules
- **Never force push** unless the user explicitly requests it. Warn if targeting `main`/`master`.
- **Never skip CI.** Always run `./scripts/ci-check.sh` before pushing. No shortcuts.
- **Never commit secrets.** Abort and warn if any staged file looks like a key, token, or credential.
- **Do not replicate ci-check.sh.** The script handles architecture constraints, formatting,
3 profile builds, tests, symbol checks, and ASan. Just run it. If the script is updated,
the skill automatically benefits.
- **Only auto-fix formatting.** Build failures, test failures, and constraint violations need
human judgment. clang-format is the only auto-fixable issue.
- **Patch-on-patch and doc freshness are advisory.** Warn but never block the push.
- **HEREDOC for commit messages.** Always use the heredoc format.
- **Co-Authored-By trailer** on all auto-generated commits.
- **Prefer new commits over amending.** Format fixes get their own commit.
---
> Source: [0x1abin/nanortc](https://github.com/0x1abin/nanortc) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->
按说明文件中的顺序排列。
第 1 步:飞行前状态
第 2 步:CI 验证
第 3 步:处理未提交的更改
第 4 步:逐个补丁审查(咨询)
第 5 步:文档新鲜度检查(咨询)
文件/命令 -> FAIL · clang-format check · ./scripts/ci-check.sh · git status · .env* · credentials* · *.key · *.pem
内容校验值 -> 2cb64a752960
当前原文的自动摘译,尚未人工审校。
第 3 步:处理未提交的更改
仅在第 2 步 CI 验证通过后才能达到。如果
git status显示未提交的更改(包括步骤 2 中的任何 clang 格式自动修复): 显示更改:按名称暂存相关文件。切勿暂存以下匹配的文件:.env*、credentials*、*.key、*.pem、*.p12。如果此类文件出现在工作树中,则警告用户。第 4 步:逐个补丁审查(咨询)
检测今天提交中的分层增量修复,这些修复可以被压缩到更干净的历史记录中。如果今天提交少于 2 次:完全跳过。继续执行第 5 步。寻找以下信号: 今天提交超过 3 次修改的任何
.c或.h文件(强信号) 修复链:“实现 X”然后“修复 X”或“修复 X 中的拼写错误”