← 返回 Skills 市场
kaiyuelv

Git Hooks Manager

作者 Lv Lancer · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
86
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install git-hooks-manager
功能描述
Manage Git hooks with easy installation, configuration, and sharing, supporting lint, test, commit message, and branch name validations.
使用说明 (SKILL.md)

git-hooks-manager - Git Hooks管理器

Metadata

Field Value
Name git-hooks-manager
Slug git-hooks-manager
Version 1.0.0
Homepage https://github.com/openclaw/git-hooks-manager
Category development
Tags git, hooks, pre-commit, pre-push, lint, test, automation, devops

Description

English

A Git hooks manager that simplifies installing, configuring, and sharing Git hooks across teams. Includes pre-built templates for linting, testing, branch naming validation, commit message validation, and custom hook orchestration.

中文

Git Hooks管理器,简化团队间Git钩子的安装、配置和共享。包含预置模板:代码检查、测试运行、分支名验证、提交信息验证和自定义钩子编排。

Requirements

  • Python 3.8+
  • Git >= 2.30
  • click >= 8.0.0
  • colorama >= 0.4.6

Configuration

Environment Variables

HOOKS_MANAGER_STRICT=true
HOOKS_MANAGER_SKIP_LINT=false

Usage

Install Hooks

# Install all recommended hooks
python scripts/hooks_manager.py install --all

# Install specific hook
python scripts/hooks_manager.py install pre-commit

# Install from template
python scripts/hooks_manager.py install pre-commit --template lint-and-test

Create Custom Hook

from git_hooks_manager import HookManager

manager = HookManager()

# Define a custom pre-commit hook
@manager.hook("pre-commit")
def my_pre_commit():
    # Run custom checks
    result = manager.run_command("pytest", ["tests/smoke/"])
    if result.returncode != 0:
        print("Smoke tests failed!")
        return False
    return True

manager.install()

Validate Commit Messages

python scripts/hooks_manager.py validate-message "feat: add user login"

API Reference

HookManager

  • install(hook_name, template=None) - Install a hook
  • uninstall(hook_name) - Remove a hook
  • list_hooks() - List installed hooks
  • validate_commit_message(msg) - Validate conventional commits format
  • validate_branch_name(name) - Validate branch naming convention
  • run_command(cmd, args) - Run a shell command and return result

Built-in Templates

  • lint-and-test - Run linters and unit tests
  • conventional-commits - Validate commit messages
  • branch-guard - Enforce branch naming rules
  • security-scan - Run basic security checks
  • ci-simulation - Simulate CI pipeline locally

Examples

See examples/ directory for complete examples.

Testing

cd /root/.openclaw/workspace/skills/git-hooks-manager
python -m pytest tests/ -v

License

MIT License

安全使用建议
This package appears to be what it says: a repo-local Git hooks manager. Before installing or running hooks, review the hook templates and any imported config because hooks are shell scripts that will execute local commands (e.g., flake8, pytest, bandit). Those commands can run arbitrary code in your repo, so ensure you trust the templates/configs and have the expected dev tools installed. Note minor inconsistencies (SKILL.md lists a homepage URL that is not present in registry metadata, and requirements.txt lists click/colorama though the core script uses argparse); these are bookkeeping issues, not security problems. If you plan to use import/export from untrusted sources, vet the JSON contents first because imported hook scripts will be written and made executable in .git/hooks.
功能分析
Type: OpenClaw Skill Name: git-hooks-manager Version: 1.0.0 The git-hooks-manager skill is a legitimate utility for automating Git hook installation and management. The core logic in scripts/hooks_manager.py correctly handles file operations within the .git/hooks directory and uses safe subprocess calls for command execution. The provided templates (e.g., lint-and-test, security-scan) use standard development tools like flake8, pytest, and bandit, and no evidence of malicious intent, data exfiltration, or harmful prompt injection was found across the codebase or documentation.
能力评估
Purpose & Capability
Name/description match the included Python implementation, examples, and tests. The code modifies .git/hooks, installs templates (lint/test/branch/commit checks), exports/imports hook JSON—these align with the stated purpose.
Instruction Scope
SKILL.md and the script instruct only repository-local operations: installing hooks, validating messages/branches, exporting/importing hook configs, and running local tooling (flake8, pytest, bandit). There are no instructions to read unrelated system files, transmit data to external endpoints, or access secrets.
Install Mechanism
No install spec or remote downloads are present; this is an instruction-and-source bundle that runs from local Python files. No archives or external URLs are fetched during install.
Credentials
The skill does not declare required environment variables or credentials. SKILL.md lists optional example env vars (HOOKS_MANAGER_STRICT, HOOKS_MANAGER_SKIP_LINT) but they are not required. No unrelated credentials or config paths are requested.
Persistence & Privilege
The skill does not request always:true or system-wide privileges. Its persistence is limited to writing hook scripts inside the repository's .git/hooks directory and reading/writing local JSON config files, which is expected for a hooks manager.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install git-hooks-manager
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /git-hooks-manager 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of git-hooks-manager. - Simplifies installing, configuring, and sharing Git hooks across teams. - Provides pre-built templates for linting, testing, branch naming and commit message validation, and custom hook orchestration. - Supports Python API and command-line usage. - Includes environment variable configuration and multiple usage examples. - Offers built-in templates such as lint-and-test, conventional-commits, branch-guard, security-scan, and ci-simulation.
元数据
Slug git-hooks-manager
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Git Hooks Manager 是什么?

Manage Git hooks with easy installation, configuration, and sharing, supporting lint, test, commit message, and branch name validations. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 86 次。

如何安装 Git Hooks Manager?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install git-hooks-manager」即可一键安装,无需额外配置。

Git Hooks Manager 是免费的吗?

是的,Git Hooks Manager 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Git Hooks Manager 支持哪些平台?

Git Hooks Manager 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Git Hooks Manager?

由 Lv Lancer(@kaiyuelv)开发并维护,当前版本 v1.0.0。

💬 留言讨论