Can't this be made simpler. Something like a cli call npm vulnerable This could take the package.json and list which of my packages need to be upgraded or downgraded to be secure as per the known issues database.
cd() {
builtin cd $*
if [ -f "package.json" ] ; then
npm check-vulnerabilities
fi
}
I reckon you could also use this with david[0] to check if packages are up to date.