Interactive Tutorial
Learn Pastoralist step by step
Learn Pastoralist step by step
This tutorial follows an express → qs override through tracking and cleanup.
The versions are fixture inputs, not package-version recommendations.
mkdir test-pastoralistcd test-pastoralistnpm init -ynpm pkg set name=shepherd-clinpm pkg set overrides.qs=6.11.2npm install [email protected] --save-exactnpm install pastoralist --save-devnpx pastoralistPastoralist generated this diff from the fixture's dependency graph:
--- package.json+++ package.json@@ -5,5 +5,17 @@ }, "overrides": { "qs": "6.11.2"+ },+ "pastoralist": {+ "appendix": {+ "[email protected]": {+ "dependents": {+ "shepherd-cli": "qs (required by express)"+ },+ "ledger": {+ "addedDate": "2026-10-16"+ }+ }+ } } }dependents identifies the project and the package requiring qs.
ledger.addedDate records when Pastoralist first tracked the override.
Actual dependents reflect your resolved dependency tree.
npx pastoralist doctornpx pastoralist --dry-runRemove the dependency that required the override, then preview cleanup:
npm uninstall expressnpx pastoralist --remove-unused --dry-runIf no other package needs qs, apply cleanup:
npx pastoralist --remove-unusedPastoralist removes the unused override and its appendix entry. Active keep constraints protect entries from removal; uncertain usage is not proof that an override is unused.
Opt into running Pastoralist after dependency installs:
npx pastoralist --setup-hookUse Configuration for ledger reasons and keep constraints, or Workspaces for monorepo setup.
Open Interactive Demos to see Pastoralist in action.
mkdir test-pastoralist
cd test-pastoralist
npm init -y
npm pkg set name=shepherd-cli
npm pkg set overrides.qs=6.11.2
npm install [email protected] --save-exact
npm install pastoralist --save-devnpx pastoralist--- package.json
+++ package.json
@@ -5,5 +5,17 @@
},
"overrides": {
"qs": "6.11.2"
+ },
+ "pastoralist": {
+ "appendix": {
+ "[email protected]": {
+ "dependents": {
+ "shepherd-cli": "qs (required by express)"
+ },
+ "ledger": {
+ "addedDate": "2026-10-16"
+ }
+ }
+ }
}
}npx pastoralist doctor
npx pastoralist --dry-runnpm uninstall express
npx pastoralist --remove-unused --dry-runnpx pastoralist --remove-unusednpx pastoralist --setup-hook