Monitoring fs accessing for Node process
npm i -D fs-spy
node -r fs-spy my-module.js
For wrapped CLIs:
# NODE_OPTIONS=--require=fs-spy <command>
NODE_OPTIONS=--require=fs-spy rollup -c

You can use fs-spy to debug why certain file has be accessed by using the hook. For example
import spy from 'fs-spy'
spy.onFileEvent((event, filepath) => {
if (filepath.endsWith('.json'))
throw new Error('See the stack trace')
})
MIT License © 2022 Anthony Fu
$ claude mcp add fs-spy \
-- python -m otcore.mcp_server <graph>