Step-by-step guide
The five-minute start lists the commands; this guide goes through them once, in a repository you know, with what to look at in each step.
- See what is missing. Run
npx depcurfew doctorin the root of the repository. Withoutdepcurfew.jsonit compares the repository with the policyinitwould write and lists, under "Compared with the default policy (no depcurfew.json):", every fileapplywould create or change and why: a package manager that installs new versions without a release-age delay, dependencies whose install scripts would run, an update bot that proposes versions sooner than the package manager would install them. Nothing fails yet; these are notes. - Write the policy.
npx depcurfew initwritesdepcurfew.jsonand says what it found. Read its notes: it keeps a longer release-age delay the repository already has, puts well-known packages whose install scripts are not needed intoinstallScripts.deny, and lists the packages with install scripts to review. Allow the ones the project needs ininstallScripts.allow; every other entry of the policy file has a safe default. - Look before writing.
npx depcurfew explainshows the tools it detected and what the policy means for each one, including the tools that cannot enforce a part of it.npx depcurfew apply --dry-runprints the changes as a diff. - Apply and commit.
npx depcurfew applywrites the configuration into the files each tool reads, keeps their comments and formatting, and marks the parts it manages. Commitdepcurfew.jsonand the changed files together: from now on the team and CI get the protection from those files, whether or not they run depcurfew. - Check that it works.
npx depcurfew doctornow compares the repository withdepcurfew.json. Fix what it reports; each finding says where it is and how to fix it, and doctor rules explains every rule. A typical first finding is a CI job or Dockerfile that installs with an older package manager than the one the setting needs. - Block known malicious versions.
npx depcurfew osv updatedownloads the public OSV.dev data of known malicious packages for npm, PyPI and Packagist;check, the hook,depcurfew mcpanddoctorthen block those versions offline. Run it again regularly;doctorsays when the copy is more than a week old. - Keep it in CI. Add the GitHub Action, pinned to a release commit, so that
doctorruns on every push and pull request and reports to code scanning. On other CI systems, run the project's own copy (see Other CI systems). - Guard installs by coding agents. With Claude Code, add the hook, which checks every install command before it runs; for other agents, add the MCP server.
- Protect the whole machine (optional).
npx depcurfew init --userandnpx depcurfew apply --usergive every project on the computer the same release-age delay and script blocking, also projects without depcurfew: see Protecting the whole machine.
When depcurfew.json changes later, run npx depcurfew apply again and commit the result; a second run with the same policy changes nothing.