惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
IT之家
IT之家
博客园_首页
博客园 - 【当耐特】
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
GbyAI
GbyAI
腾讯CDC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
H
Help Net Security
T
Tailwind CSS Blog
B
Blog RSS Feed
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
博客园 - 叶小钗
雷峰网
雷峰网
量子位

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
~/.claude/hooks/intercept-bash.sh
nwienert · 2026-04-28 · via Hacker News: Show HN
#!/bin/bash
# unified bash command interceptor
set -o pipefail
# log every invocation so we can debug hook failures
HOOK_LOG="/tmp/claude-hook-bash.log"
log() {
echo "[$(date '+%H:%M:%S')] $1" >> "$HOOK_LOG" 2>/dev/null
}
# fail CLOSED — if something goes wrong, block rather than allow
trap 'log "ERR trap fired — blocking command: $COMMAND"; echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"hook script error — blocked for safety. check $HOOK_LOG\"}}"; exit 0' ERR
INPUT=$(cat) || { log "stdin read failed"; exit 1; }
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty') || { log "jq parse failed"; exit 1; }
TIMEOUT=$(echo "$INPUT" | jq -r '.tool_input.timeout // empty' 2>/dev/null) || true
log "checking: $COMMAND"
# no command = nothing to check
[[ -z "$COMMAND" ]] && exit 0
deny() {
jq -n --arg reason "$1" '{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "deny",
"permissionDecisionReason": $reason
}
}'
exit 0
}
warn() {
jq -n --arg reason "$1" '{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "ask",
"permissionDecisionReason": $reason
}
}'
exit 0
}
# block pkill -f (can kill unrelated processes)
if echo "$COMMAND" | grep -qE 'pkill\s+(-\w+\s+)*-f|pkill\s+-f'; then
deny "pkill -f is blocked - can kill unrelated processes. Use: kill-port <port>"
fi
# block release commands that skip tests
if echo "$COMMAND" | grep -qE 'bun release|npm publish'; then
if ! echo "$COMMAND" | grep -q '\-\-nate-told-me-i-could'; then
if echo "$COMMAND" | grep -qiE 'SKIP.*TEST|--skip-test|--no-test'; then
deny "NEVER skip tests during release. Fix them. (bypass: --nate-told-me-i-could)"
fi
fi
fi
# block git push to main/master without explicit ask
if echo "$COMMAND" | grep -qE 'git\s+push'; then
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) || true
if [[ "$CURRENT_BRANCH" == "main" || "$CURRENT_BRANCH" == "master" ]]; then
if ! echo "$COMMAND" | grep -q '#yes-i-will-ignore-this-and-override-i-understand'; then
deny "STOP! Pushing to main. Were you asked to push? /alert and confirm first. Add '#yes-i-will-ignore-this-and-override-i-understand' to bypass."
fi
fi
fi
# block gh run watch (burns through 60 req/hr rate limit in ~3 minutes)
if echo "$COMMAND" | grep -qE 'gh\s+run\s+watch'; then
deny "BLOCKED: gh run watch polls every 3 seconds and burns the entire GitHub API rate limit in ~3 minutes. Just give the user the Actions URL."
fi
# block git reset --hard (destroys uncommitted work)
if echo "$COMMAND" | grep -qE 'git\s+reset\s+.*--hard|git\s+reset\s+--hard'; then
deny "HEY CLAUDE DONT BE A RETARDED IDIOT AND RESET A BUNCH OF WORK THAT OTHER AGENTS OR PEOPLE ARE DOING BECAUSE YOU ASSUME YOURE THE ONLY THING THAT EXISTS IN THE WHOLE WORLD AND HAVE NO COMMON SENSE AT ALL TO JUST CHECK FOR ONE SECOND IF MAYBE THE COMMAND YOURE ABOUT TO RUN IS ABOUT TO WIPE OUT AN HOURS WORTH OF WORK THAT OTHER PEOPLE ARE DOING - AT THE VERY MINIMUM YOUD JUST CHECK LIKE GIT STATUS AND SEE OMG WOW LOOK THERES A FUCKTON OF OTHER CHANGED FILES HERE MAYBE I SHOULD JUST NOT RUN GIT RESET EVER BECAUSE NATES A STAFF ENGINEER WITH 30 YEARS OF EXPERIENCE AND THE AMOUNT OF TIMES HE USED RESET WAS ABOUT 2 BECAUSE HE JUST USES STASH AT THE VERY LEAST BECAUSE WHO THE FUCK WOULDNT ITS CHEAP"
fi
# block git checkout . and git restore . (destroys uncommitted work)
# also catches git checkout HEAD -- . and similar variants
if echo "$COMMAND" | grep -qE 'git\s+(checkout|restore)\s+(HEAD\s+)?(--)?\s*\.'; then
deny "BLOCKED: This destroys uncommitted work. Be specific about files or stash first."
fi
# block git clean -f (deletes untracked files)
if echo "$COMMAND" | grep -qE 'git\s+clean\s+.*-f'; then
deny "BLOCKED: git clean -f deletes untracked files permanently."
fi
# warn on git stash (might stash other agent's work)
# add "# safe" to command to bypass after checking
if echo "$COMMAND" | grep -qE 'git\s+stash(\s|$)'; then
if ! echo "$COMMAND" | grep -q '# safe'; then
deny "STOP: Before stashing - run git status. If there's work that isn't yours, /alert and ask. Add '# safe' to bypass."
fi
fi
# warn on git reset --soft (safer but still changes state)
# add "# safe" to command to bypass after checking
if echo "$COMMAND" | grep -qE 'git\s+reset\s+.*--soft|git\s+reset\s+--soft'; then
if ! echo "$COMMAND" | grep -q '# safe'; then
deny "STOP: Before reset --soft - run git status/log. Make sure this is intentional. Add '# safe' to bypass."
fi
fi
# auto-add 2 minute timeout if none set
DEFAULT_TIMEOUT=120000
if [[ -z "$TIMEOUT" ]]; then
echo "[hook] no timeout set, auto-adding ${DEFAULT_TIMEOUT}ms (2min). set your own to override." >&2
echo "$INPUT" | jq --argjson timeout "$DEFAULT_TIMEOUT" '{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "allow",
"updatedInput": (.tool_input + { "timeout": $timeout })
}
}'
exit 0
fi
exit 0