← 返回 Skills 目录
我的 Skill

commit-code

审查本地变更、整理提交范围,并在明确确认后创建 Git 提交。

分类
Git 工作流
维护者
seven
来源
个人私有仓库
许可证
私有
固定版本
854e8cc87916
最近检查
2026-07-22
适用场景
  • 提交前审查
  • 生成提交计划
  • 确认后创建 commit
Git提交审批
安装

把它带到你的 Codex。

执行前需在本机配置 gitlab-personal SSH 身份,并拥有私有仓库访问权限。

来源:个人私有仓库
显示安装命令
set -euo pipefail
skill_name='commit-code'
source_url='git@gitlab-personal:seven-grove/tools/personal-codex-skills.git'
source_ref='854e8cc87916742fc7cef130b8263342af8614f6'
source_subdirectory='skills/commit-code'
temp_root=$(mktemp -d)
backup_root="${CODEX_HOME:-$HOME/.codex}/skills-backups"
target_root="${CODEX_HOME:-$HOME/.codex}/skills"
backup_path=""
install_complete="0"
restore_previous() {
  if [ "$install_complete" != "1" ]; then
    rm -rf "$target_root/$skill_name"
    if [ -n "$backup_path" ] && [ -d "$backup_path" ]; then
      mv "$backup_path" "$target_root/$skill_name"
    fi
  fi
}
cleanup() { rm -rf "$temp_root"; }
trap 'restore_previous; cleanup' EXIT
git clone --filter=blob:none --no-checkout "$source_url" "$temp_root/repo"
git -C "$temp_root/repo" checkout "$source_ref" -- "$source_subdirectory"
test -f "$temp_root/repo/$source_subdirectory/SKILL.md"
mkdir -p "$target_root" "$backup_root"
if [ -e "$target_root/$skill_name" ]; then
  backup_path="$backup_root/$skill_name-$(date +%Y%m%d-%H%M%S)"
  mv "$target_root/$skill_name" "$backup_path"
fi
cp -R "$temp_root/repo/$source_subdirectory" "$target_root/$skill_name"
test -f "$target_root/$skill_name/SKILL.md"
install_complete="1"
printf 'Installed %s\n' "$target_root/$skill_name"
if [ -n "$backup_path" ]; then printf 'Backup %s\n' "$backup_path"; fi