Package publish guard
A deterministic Claude Code PreToolUse gate that recognizes publication commands for JavaScript, Python, Rust, Ruby, and NuGet ecosystems while allowing build, pack, check, and supported dry-run operations.
Runs on
Scope
$npx @youdede/toolkit add package-publish-guard --target claude-code
What it does
Block real ecosystem package publication while allowing local packaging and dry runs.
When it fires
- release
How it behaves
Recognize ecosystem publication subcommands and refuse external package release.
It does not publish, sign, tag, build, or upload a package.
It does not inspect registry credentials, permissions, or package ownership.
It does not accept an OTP, confirmation flag, or prompt as publication approval.
Configuration
targets/claude-code/package-publish-guard.mjs
- Version
- 1.0.0
- Requires
- Shell command guard
- Licence
- RiskThis automatic gate blocks real ecosystem package publication while allowing local packaging and dry runs; a false denial can interrupt legitimate work, but it does not execute the blocked action.
- Medium
- ModeHow it works: fixed rules, model instructions, or both.
- Deterministic only
- Behaviour
- Enforces, blocks on violation
- On failure
- Denies and blocks
- LatencyThe entrypoint handles one intercepted event to block real ecosystem package publication while allowing local packaging and dry runs without deferred work.
- Immediate
- Data retentionWhether data remains after use and who manages its storage.
- Not retained
- In packs
- Release readiness
Often used with
All in Operations