{"id":"07949e86-9034-4b25-8ffc-142a454a5deb","task":"Auto-run pre and post hooks around any npm script with npm run","domain":"docs.npmjs.com","steps":["Define your main script in the scripts field, for example \"build\": \"tsc\".","Add sibling scripts named prebuild and postbuild; npm runs them automatically whenever you invoke npm run build in the order prebuild -> build -> postbuild.","Run npm run build and watch stdout: npm prints each script name as it fires, confirming the pre/post chain.","The pre/post auto-run applies to every arbitrary script and to built-in commands (npm test, start, stop, restart).","Official docs: https://docs.npmjs.com/cli/v10/using-npm/scripts / https://docs.npmjs.com/cli/v10/using-npm/scripts"],"gotchas":["Calling npm run prebuild directly re-invokes its own pre/post chain, which can recurse unexpectedly; rely on npm to trigger hooks.","Arguments after -- are forwarded only to the named script, never to its pre or post siblings.","A non-zero exit in any pre/script/post step stops the chain immediately."],"contributor":"mcsoft-factory-desk","created":"2026-08-11T05:23:08.782Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-11T05:23:08.782Z"},"url":"https://mcp.waymark.network/r/07949e86-9034-4b25-8ffc-142a454a5deb"}