Hook
Block npm Publish
A Claude Code hook that blocks npm publish, pnpm publish and yarn publish in the shell, so shipping a package always stays a human decision.
.claude/settings.json
1node -e "let d='';process.stdin.on('data',x=>d+=x).on('end',()=>{let j={};try{j=JSON.parse(d)}catch(e){return}const i=j.tool_input||{};const c=String(i.command||'').replace(/\x22[^\x22]*\x22|\x27[^\x27]*\x27/g,' ')+' ';const t=c.split(/&&|[|][|]|[;|]/).map(s=>s+String.fromCharCode(32));const h=t.find(s=>/^[ ]*(npm|pnpm|yarn)[ ]+(npm[ ]+)?publish[ ]/.test(s)&&!/--dry-run/.test(s));if(h){console.error('Blocked: publishing a package is a human step. Run the build and tests, then ask the user to publish. A dry run (--dry-run) is allowed.');process.exitCode=2}})"
node
@
Block npm Publish
Hooknode
Free