Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/ysicing/code-pilot/git-msggit clone --depth 1 https://github.com/ysicing/code-pilotWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.02220 |
| Opus 5 | $0.00000 | $0.01110 |
| Sonnet 5 | $0.00000 | $0.00444 |
| Haiku 4.5 | $0.00000 | $0.00222 |
Grade A, and why
git-msg scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 349 lines — stays where its author put it; the contents beside it link to each section on GitHub.
提交消息
从暂存的更改(git diff --staged)生成合适的提交消息。仅生成消息并复制到剪贴板,不执行 git 命令。
使用方法
/git-msg [选项]
选项
--format <格式>: 指定消息格式(conventional, gitmoji, angular)--lang <语言>: 强制指定消息语言(en, ja)--breaking: 检测并记录 Breaking Change
基本示例
# 从暂存的更改生成消息(自动判定语言)
# 主要候选会自动复制到剪贴板
/git-msg
# 强制指定语言
/git-msg --lang ja
/git-msg --lang en
# 检测 Breaking Change
/git-msg --breaking
前提条件
重要: 此命令仅分析暂存的更改。需要先使用 git add 暂存更改。
# 如果没有暂存更改,会显示警告
$ /git-msg
没有暂存的更改。请先执行 git add。
自动剪贴板功能
生成的主要候选会以 git commit -m "消息" 的完整格式自动复制到剪贴板。可以直接在终端粘贴执行。
实现注意事项:
- 将提交命令传递给
pbcopy时,应与消息输出分开执行 - 使用
printf而不是echo以避免末尾换行
项目规范自动检测
重要: 如果存在项目特有的规范,将优先使用。
1. CommitLint 配置检查
从以下文件自动检测配置:
commitlint.config.jscommitlint.config.mjscommitlint.config.cjscommitlint.config.ts.commitlintrc.js.commitlintrc.json.commitlintrc.yml.commitlintrc.yamlpackage.json的commitlint部分
# 搜索配置文件
find . -name "commitlint.config.*" -o -name ".commitlintrc.*" | head -1
2. 自定义类型检测
项目特有类型示例:
// commitlint.config.mjs
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'feat', 'fix', 'docs', 'style', 'refactor', 'test', 'chore',
'wip', // 进行中
'hotfix', // 紧急修复
'release', // 发布
'deps', // 依赖更新
'config' // 配置更改
]
]
}
}
3. 语言设置检测
// 项目使用中文消息时
export default {
rules: {
'subject-case': [0], // 为支持中文而禁用
'subject-max-length': [2, 'always', 72] // 为中文调整字符数限制
}
}
4. 现有提交历史分析
# 从最近的提交学习使用模式
git log --oneline -50 --pretty=format:"%s"
# 使用类型统计
git log --oneline -100 --pretty=format:"%s" | \
grep -oE '^[a-z]+(\([^)]+\))?' | \
sort | uniq -c | sort -nr
语言自动判定
根据以下条件自动切换中文/英文:
- CommitLint 配置中的语言设置
- git log 分析的自动判定
- 项目文件的语言设置
- 更改文件中的注释和字符串分析
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 349 lines · 0 tokens per session scan A 1f1977b1e76c
git-msg is a command published in the GitHub repository ysicing/code-pilot (38 stars, last pushed 5mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 2,220 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other commands, from other repositories
specify
Create or update the feature specification from a natural language feature description.
speckit.git.validate
Validate current branch follows feature branch naming conventions.
pr-address
Address PR review comments on current branch.
plan-save
Save the current session's plan to GitHub as an issue.
enforce_standards
CRITICAL: Before running the code standards enforcer, we must prepare the stack properly and abort if there are merge conflicts.
OPSX: Sync
Sync delta specs from a change to main specs.