🛠 22 Hack 实施笔记

voice-to-text + pre-commit-active + skill-run — 3 个新工具

📅 日期: 2026-06-11 · 🔗 基于: 22 Hack 评估
claude-code22-hackshermes-implvoice-to-textpre-commitskill-run

📊 实施总览

Hack文件大小mode状态
#1 voice-to-text~/bin/voice-to-text.sh3.8KBdictation✅ 完成
#2 pre-commit-active~/bin/pre-commit-active.sh4.2KBcommit✅ 完成
#3 skill-run~/bin/skill-run3.6KB4 mode✅ 完成

🎙 Hack #1: voice-to-text (3.8KB)

目的: CLI/TUI 模式下用 macOS Dictation 录音转写 (替代 Web Speech API 的限制)

4 个 mode

voice-to-text                  # 录音, 转写结果到 stdout
voice-to-text --out FILE      # 转写结果写入 FILE
voice-to-text --paste         # 直接复制到剪贴板
voice-to-text --timeout N     # 设置超时秒数

前置条件:

  1. System Settings > Keyboard > Dictation > ON
  2. Dictation 快捷键设 Fn Fn (或自定义)
  3. 首次会弹"允许 Dictation"权限

限制:

🔨 Hack #2: pre-commit-active (4.2KB)

目的: 高危操作前主动 commit (替代 1 小时兜底 git-auto-sync.sh)

6 个 mode

pre-commit-active                  # 有变更则 commit
pre-commit-active --force          # 强制 commit
pre-commit-active --task "描述"     # 写详细 commit message
pre-commit-active --stash          # 暂存 (后续 --stash-pop 恢复)
pre-commit-active --workspace DIR  # 指定 workspace
pre-commit-active --stash-pop      # 恢复暂存

与 git-auto-sync.sh 区别:

Commit message 格式:

active-commit: 2026-06-11 14:30:00

🔨 Auto pre-commit (Hack #5 from MAT 22 Hacks)

- Time: 2026-06-11 14:30:00
- Workspace: patricks-reports
- Branch: main
- Files: 5 changed
- Stats: 2 files changed, 100 insertions(+), 5 deletions(-)

🔗 Hack #3: skill-run (3.6KB) — Skill-to-Skill API

目的: Skill 之间显式调用 + 共享数据 (避免重复 prompt)

4 个 mode

skill-run SKILL_NAME               # view SKILL.md
skill-run --list                   # list all skills
skill-run --search KEYWORD         # search skills
skill-run --chain s1,s2,s3         # chain (output piped)
skill-run SKILL_NAME --run         # run skill's scripts/run.sh
skill-run SKILL_NAME --section SEC # view specific section

示例 chain (Patrick 实际工作流):

# 场景: 用户问"今天 WWDC 视频怎么样"
skill-run --chain "video-to-obsidian,patrick-knowledge"

# 场景: 用户说"推 vault 内容到公网"
skill-run --chain "obsidian-vault-bidirectional-sync,public-html-deploy-cloudflare-pages"

优势:

🔧 配 PATH + alias (顺手修)

之前 ~/bin 不在 PATH, 需全路径。现在修了:

✅ 验证

$ zsh -c "source ~/.zshrc; which voice-to-text pre-commit-active vault-sync"
voice-to-text: aliased to /Users/patrick/bin/voice-to-text.sh
pre-commit-active: aliased to /Users/patrick/bin/pre-commit-active.sh
vault-sync: aliased to /Users/patrick/bin/sync-vault-bidirectional.sh

$ skill-run --list | wc -l
# 250+ skills

$ skill-run --chain "voice-to-text,skill-run-api" 2>&1 | grep "=== Running"
=== Running: voice-to-text ===
=== Running: skill-run-api ===

📈 22 Hack 覆盖度 (更新)

21 → 23/22 (原 21 强推 + 2 升级)

Hack之前现在
#1 voice input"方向对"✅ 可用
#5 pre-commit"已有 git-auto-sync"✅ 升级
#17 skill-to-skill"缺 API"✅ 实现

📋 后续 (可选)

📝 Note: 本笔记由 Hermes Agent 实施产出
方法: 直接实现 3 个工具 + 配 PATH + 写文档