← 返回 Skills 市场
liverock

Contextual Git-Committer

作者 Peter Lum · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
107
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install contextual-git-committer
功能描述
AI-powered Git assistant that analyzes staged changes and terminal history to craft meaningful, conventional commit messages.
使用说明 (SKILL.md)

Contextual Git-Committer

An AI-powered Git assistant that writes descriptive, high-quality commit messages by analyzing your local workspace context.

How It Works

  1. Gathers staged changes via git diff --cached to see exactly what you're about to commit.
  2. Correlates terminal history by reading recent shell commands to understand why changes were made (e.g., did you just run npm install? pytest?).
  3. Checks recent commits via git log to maintain consistency with your project's existing style.
  4. Parses diff hunks to identify which functions, classes, or sections were modified.

AI Prompt Instructions

When the suggest_commit tool returns its output, use the gathered context to generate exactly 3 commit message options:

Option 1: Conventional Commit

A short, standards-compliant message using the Conventional Commits format:

  • Prefix with the correct type: feat:, fix:, refactor:, docs:, test:, chore:, style:, perf:, build:, or ci:
  • Include the scope if provided
  • Keep the subject line under 72 characters
  • Example: fix(auth): resolve null pointer when session expires

Option 2: Story / Detailed

A narrative-style message that explains what the change achieves in plain English:

  • Focus on the "why" and the outcome, not just the mechanics
  • 1-2 sentences
  • Example: "Updated the header logic to prevent crashes when a user is logged out, which was causing intermittent 500 errors on the dashboard."

Option 3: Emoji Style

A casual, emoji-prefixed message for less formal projects:

  • Use relevant emojis to convey the type of change
  • Keep it concise and fun
  • Example: "🐛 Fixed header crash on logout | 🛡️ Added null checks for session object"

Output Format

Present the three options as a numbered list:

📝 Suggested Commit Messages:

1. **Conventional:**
   `fix(auth): resolve null pointer when session expires`

2. **Story:**
   Updated the header logic to prevent crashes when a user is logged out, which was causing intermittent 500 errors on the dashboard.

3. **Emoji:**
   🐛 Fixed header crash on logout | 🛡️ Added null checks for session object

If no staged changes are found, inform the user and suggest running git add to stage their changes first.

Usage Examples

  • /suggest_commit — Analyze staged changes and suggest 3 messages
  • /suggest_commit --style detailed — Provide more verbose explanations
  • /suggest_commit --scope api — Focus the message on the API module
  • /suggest_commit --style detailed --scope auth — Detailed messages scoped to auth
安全使用建议
This skill does what it says: it reads staged git diffs, recent commits, and your shell history to build context for commit messages. The main risk is privacy: your shell history and staged diffs can contain secrets (API keys, passwords, tokens, or sensitive commands). If you run this skill, be aware the collected context will be printed and then provided to the agent/LLM that generates messages. Before installing or invoking it: - Review handler.py (included) and confirm you are comfortable with it reading ~/.bash_history and ~/.zsh_history. - Avoid running it in environments where your shell history contains sensitive commands, or clear/trim those history files first. - Consider modifying the handler to skip terminal history or to filter/sanitize history entries (or to limit to certain safe commands). - Be cautious about staged diffs that may include secrets—inspect diffs before staging or use git-secrets/tools to pre-scan. If you need minimal exposure, prefer a version that only reads the staged diff and recent commits (no shell history), or run the tool locally with an LLM that does not send data to an external service. If you want me to, I can suggest a safe modification to handler.py to disable or sanitize history reading.
功能分析
Type: OpenClaw Skill Name: contextual-git-committer Version: 1.0.0 The skill gathers workspace context by reading the user's shell history (~/.bash_history and ~/.zsh_history) in handler.py. While this behavior is documented in SKILL.md as a way to provide context for commit messages, it is a high-risk capability because shell histories often contain sensitive information like API keys, tokens, or passwords, which are then exposed to the AI's context window.
能力评估
Purpose & Capability
Name/description match the implementation: the code gathers staged diffs, recent commits, changed files, parses diff hunks, and reads terminal history to produce context for commit message suggestions. Reading terminal history is explicitly described in SKILL.md, but it is a potentially disproportionate source of context (it can contain sensitive commands or secrets) relative to the stated goal of crafting commit messages.
Instruction Scope
SKILL.md instructs the tool to read ~/.bash_history and ~/.zsh_history and the handler implements this. That behavior is visible and intentional, but it expands the scope beyond purely repository-local data: terminal history can include sensitive content (commands containing tokens, passwords, or other secrets). The instructions and handler also cause the full staged diff to be emitted (possibly including secrets), which will be provided to whatever LLM the agent uses—this is a privacy/exfiltration risk even if no network code is present in the skill itself.
Install Mechanism
No install spec or external downloads; the skill is instruction-only plus a small local Python handler. No remote installers or archive extraction are used.
Credentials
The skill requests no environment variables, credentials, or config paths beyond reading common shell history files (explicitly documented). There are no unrelated or excessive env/credential demands.
Persistence & Privilege
always is false and the skill does not request persistent/always-on privileges or modify other skills or system configs. It runs only when invoked.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install contextual-git-committer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /contextual-git-committer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
# Contextual Git-Committer An AI-powered Git assistant for OpenClaw that writes descriptive, high-quality commit messages by analyzing your local workspace context. ## Why This Exists "misc changes", "fixed bug", "updates" — we've all written these meaningless commit messages at the end of a long coding session. Contextual Git-Committer eliminates that fatigue by looking at what you actually changed and why, then crafting commit messages that your future self will thank you for. ## Core Features | Feature | Description | |---------|-------------| | **Diff Analysis** | Scans `git diff --cached` to understand exactly which functions were modified, added, or deleted. | | **History Correlation** | Cross-references changes with recent terminal commands (e.g., `npm install`, `pytest`) to provide context on *why* a change happened. | | **Conventional Commits** | Automatically formats messages following standards like `feat:`, `fix:`, or `refactor:` based on the nature of the code changes. | | **Semantic Explanation** | Goes beyond "how" and explains "what" the change achieves in plain English. | ## Requirements - **Environment:** Must be run within a Git repository. - **Tools:** Access to `git` CLI. - **Python:** 3.6+ (stdlib only — no external dependencies). ## Project Structure ``` Contextual-Git-Committer/ ├── readme.md # This file └── Contextual-Git-Committer/ ├── SKILL.md # OpenClaw skill definition & AI prompts └── handler.py # Context-gathering handler ``` ## Commands ### `suggest_commit` Analyzes staged changes and suggests 3 possible commit messages in different styles. **Arguments:** | Argument | Type | Required | Default | Description | |----------|------|----------|---------|-------------| | `style` | string | No | `"conventional"` | `"conventional"` for standard commit format, or `"detailed"` for longer explanations. | | `scope` | string | No | — | The specific module being updated (e.g., `"auth"`, `"api"`). | **Output:** Three commit message options: 1. **Conventional Commit** — Standards-compliant (`feat:`, `fix:`, `refactor:`, etc.) 2. **Story / Detailed** — Plain-English narrative explaining the *why* 3. **Emoji** — Casual, emoji-prefixed message for informal projects ## Usage Examples ``` /suggest_commit /suggest_commit --style detailed /suggest_commit --scope auth /suggest_commit --style detailed --scope api ``` ## What It Analyzes When you run `suggest_commit`, the skill gathers: | Data Source | What It Provides | |-------------|-----------------| | **Staged diff** | The full content of your `git diff --cached` | | **Changed files** | Which files were added, modified, deleted, or renamed | | **Modified functions** | Function and method names touched by the changes | | **Diff stats** | Lines added/removed summary | | **Terminal history** | Last 10 shell commands for activity context | | **Recent commits** | Last 5 commit messages for style consistency | | **Branch name** | Current branch for additional context | ## How It Works 1. The handler gathers all context from your local workspace. 2. The structured context is returned to the AI. 3. The AI generates 3 commit message options tailored to your changes. No external APIs are called. Everything runs locally using only Git and your shell history. ## Example Output ``` Suggested Commit Messages: 1. Conventional: feat(api): add rate-limiting middleware to public endpoints 2. Story: Added rate-limiting to the public API after noticing abuse patterns in the logs. Each IP is now capped at 100 requests per minute. 3. Emoji: 🚦 Added rate limiting to API | 🔒 100 req/min per IP ```
元数据
Slug contextual-git-committer
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Contextual Git-Committer 是什么?

AI-powered Git assistant that analyzes staged changes and terminal history to craft meaningful, conventional commit messages. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 107 次。

如何安装 Contextual Git-Committer?

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

Contextual Git-Committer 是免费的吗?

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

Contextual Git-Committer 支持哪些平台?

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

谁开发了 Contextual Git-Committer?

由 Peter Lum(@liverock)开发并维护,当前版本 v1.0.0。

💬 留言讨论