一键导入
protect-lockfile
Use pkglock to switch package-lock.json between local npm registries and the public registry, and install safeguards against committing local URLs
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use pkglock to switch package-lock.json between local npm registries and the public registry, and install safeguards against committing local URLs
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use dfm to initialize dotfile backups, track files safely, sync private repositories, and review AI-suggested dotfile improvements
Work on llbbl/esm, a PHP enum-state-machine library, with its local quality gates and API constraints
Integrate llbbl/enum-state-machine into a PHP project with enum states, attribute transitions, guards, hooks, and validation
Use grepwrite gw to find matches, preview code rewrites, apply transactional edits with snapshots, and undo safely
Integrate logan-logger into TypeScript apps with correct runtime imports, environment config, safe metadata, and validation
Use repjan to audit GitHub repositories, review archive candidates, export decisions, and safely archive or unarchive repos
| name | protect-lockfile |
| version | 0.1.0 |
| description | Use pkglock to switch package-lock.json between local npm registries and the public registry, and install safeguards against committing local URLs |
| allowed-tools | Bash, Read, Grep, Glob, Edit, MultiEdit, Write |
Use this skill when the user wants to use pkglock in a JavaScript/TypeScript project with package-lock.json, especially when switching between a local npm registry such as Verdaccio/Nexus and https://registry.npmjs.org.
Examples:
pkglock operates on ./package-lock.json in the current directory. Run it from the project root.
Use it when:
localhost, .local, .lan, private IP, or loopback registry URLsDo not use it for pnpm-lock.yaml, yarn.lock, or Bun lockfiles.
cargo install pkglock
Confirm:
pkglock --help
If Cargo bin commands are not on PATH, add $HOME/.cargo/bin.
Before committing a project with package-lock.json:
pkglock --to-public
git diff -- package-lock.json
This rewrites local-looking resolved URL hosts back to https://registry.npmjs.org while preserving package paths, query strings, and fragments.
Local-looking hosts include:
localhost.test, .local, or .lanReview the diff before committing.
Explicit local registry:
pkglock --to-local http://localhost:4873
pkglock --to-local https://verdaccio.lan/repo
Autodetect from a bare registry= line in ./.npmrc:
pkglock --to-local
Do not put credentials in the URL. Use .npmrc auth token entries for authentication.
Install the local Git hook:
pkglock install-hook
The hook runs pkglock --to-public when package-lock.json is staged, then re-stages the file.
Important behavior:
.git/hooks/ is local-only and not committed.pkglock is missing from PATH.If an existing hook is present, integrate this pattern manually:
if git diff --cached --name-only --diff-filter=ACMR | grep -q '^package-lock\.json$'; then
if ! command -v pkglock >/dev/null 2>&1; then
echo "pkglock: command not found on PATH" >&2
exit 1
fi
cd "$(git rev-parse --show-toplevel)"
pkglock --to-public
git add package-lock.json
fi
Use config-file mode only for unusual registry setups:
{
"local": "http://localhost:4873",
"remote": "https://registry.npmjs.org"
}
Commands:
pkglock --local
pkglock --remote
These replace every resolved URL authority unconditionally. Prefer --to-public and --to-local for safer conditional behavior.
package-lock.json.git diff -- package-lock.json after rewriting..npmrc registries are honored by pkglock --to-local; it reads only a bare registry= line.pkglock on pnpm/yarn/bun lockfiles.