Skip to content
cccskills
FreePublished on GitHub

format

运行 tools/format.sh 对整个仓库做 clang-format、cmake-format 与行尾符 统一。用户要求"格式化代码"、"跑 format"、提交前统一格式时使用。

The English summary is being prepared. Showing the original description.

thun-res/vlink115 stars(GitHub 115 + cccskills 0)

Run score Not tested

See how to install

Files included (2)

  • SKILL.md2.9 KB
  • agents/openai.yaml191 B

SKILL.md (original)

Review the instructions the agent will receive before you install.

代码格式化

对仓库执行统一格式化,入口与参数同 CI 的 lint 门禁 (.github/scripts/ci-lint.sh)中 "Check formatting" 步骤。本地工具版本 不一定与 CI 镜像固定版本相同。

1. 执行

先检查 clang-format 与 cmake-format。任一缺失时停止并询问是否允许 pip install --user;未经确认不得直接运行会自动安装依赖的 tools/format.sh。

REPO_ROOT="$(git rev-parse --show-toplevel)"
export PYTHONPYCACHEPREFIX="$REPO_ROOT/build-ai/skill_format/__pycache__"
command -v clang-format || exit 1
command -v cmake-format || exit 1
FORMAT_PATH="$PATH"
if [ "$(uname -s)" = Darwin ]; then
    command -v brew || exit 1
    GNU_SED_BIN="$(brew --prefix gnu-sed)/libexec/gnubin" || exit 1
    [ -x "$GNU_SED_BIN/sed" ] || exit 1
    FORMAT_PATH="$GNU_SED_BIN:$PATH"
fi
PATH="$FORMAT_PATH" bash "$REPO_ROOT/tools/format.sh" "$REPO_ROOT"

三个阶段共用 tools/format.sh 中同一组目录排除条件: 根 tools/、thirdparty/、build/、build-*/、builtin/、 prebuilt/ 与 android-bp/。这是 /format 的唯一执行范围基准, 语言分册不另行复制维护路径集合。

脚本行为:

  1. clang-format:按仓库根 .clang-format 原地格式化所有 .h/.hpp/.cc/.cpp。
  2. cmake-format:原地格式化所有 CMakeLists.txt、*.cmake、 *.cmake.in。
  3. EOL-FORMAT:按 .gitattributes 的 eol 属性统一脚本文件行尾符 (crlf/lf)。
  4. 最后执行 git diff --quiet:有未暂存的已跟踪差异时退出码为 1 并 打印 diff;仅暂存或未跟踪文件不在该命令的判断范围。干净工作树中可 据此判断格式化产生了改动;脏工作树中不能把全部差异归因于本次格式化。

2. 注意事项

  • tools/format.sh 在依赖缺失时会自动 pip install --user,因此必须 完成上述确认。
  • 执行依赖检查、安装和格式化期间保持上述 PYTHONPYCACHEPREFIX, 不得在源码树生成 __pycache__。
  • 当前脚本使用 GNU sed -i。Linux 直接执行;macOS 必须先确认 Homebrew gnu-sed 可用并按上例注入 PATH。缺失时先询问是否允许安装,不得先跑 前两个原地格式化阶段。
  • 执行前记录 clang-format --version 与 cmake-format --version; 需要精确复现 CI 时使用仓库 CI 镜像中的固定版本。
  • 工作区有未提交改动时也可运行,但 diff 会混入格式化改动;建议先确认 git status 再执行。共享工作区出现并发变化时停止,不得让全仓格式化 覆盖或混入其他 Agent 正在修改的内容。
  • 只做格式化,不做静态检查;静态检查用 /check(cpplint)或 /clang-tidy。

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

asan

Free

以 AddressSanitizer(ENABLE_TEST_SANITIZE=ON)构建并运行 vlink-test 单元测试,复现 CI 的 ASan 门禁。用户要求"跑 asan"、"内存检测测试"、 排查 ci-test 的 sanitize 失败时使用。

The English summary is being prepared. Showing the original description.

thun-res/vlink115Updated Oct 15, 2026

bench

Free

构建并运行 vlink-bench 性能基准(showcase/quick/full 预设),生成 HTML/JSON 报告。用户要求"跑 bench"、"性能测试"、对比后端吞吐/延迟、 验证性能回归时使用。

The English summary is being prepared. Showing the original description.

thun-res/vlink115Updated Oct 15, 2026

check

Free

运行 tools/check.sh 对整个仓库执行 cpplint 静态检查(120 列,项目定制 过滤集)。用户要求"跑 check"、"cpplint 检查"、排查 CI lint 门禁失败 时使用。

The English summary is being prepared. Showing the original description.

thun-res/vlink115Updated Oct 15, 2026

cicd

Free

用 gh CLI 触发/查看 GitHub CI/CD:手动 dispatch 工作流 (release/coverage/docker)、查看运行状态与失败日志、重跑失败 job. 用户要求"触发 CI"、"看流水线"、"重跑失败的 job"时使用;创建 dev 到 master 的 PR 使用 /pr,正式发版使用 /release.

The English summary is being prepared. Showing the original description.

thun-res/vlink115Updated Oct 15, 2026

对指定文件或全仓库运行 clang-tidy(WarningsAsErrors='*')。用户要求 "跑 clang-tidy"、"tidy 检查某文件"、排查 CI tidy 门禁失败时使用。

The English summary is being prepared. Showing the original description.

thun-res/vlink115Updated Oct 15, 2026

commit

Free

提交前强制执行 VLink 的 format 与 check skill,再分析当前工作树的全部 staged、unstaged 与 untracked 改动,按模块、功能和依赖关系拆分为可独立 评审的 Conventional Commits,生成简洁且覆盖重要行为的英文 commit message 并逐组提交。用户要求“提交当前改动”、“按功能拆 commit”、 “自动写 commit msg”或“整理提交历史”时使用。

The English summary is being prepared. Showing the original description.

thun-res/vlink115Updated Oct 15, 2026

See all skills by thun-res

Report a problem with this skill