Background Agents + private NPM dependencies

just wondering if anyone has figured out how to use background agents in a service where it has dependencies from a private npm package.

i use nodejs and github package registry. i have internal libraries in private github registry packages set up that downstream services use. a project .npmrc file checked into the codebase specifies the registry, but requires a Github PAT in ~/.npmrc which is not checked into the codebase.

in CI i load the github PAT into an env var and in the CI script have a small command that writes the PAT to ~/.npmrc; so that when the install command, everything works as expected.

but background agents have no pre-install script if you will.

wondering how folks do this. cursor has the ability to add secrets, but this would be something more like before a background agent is run (akin to .github/workflows/action.yml, but like .cursor/workflows/action.yml) to load the ~/.npmrc file

Any way you could do this with a git submodule? I think you can also create a preinstall script - check out environment.json here Cursor – Background Agents

sorry, could you break it down and explain like i’m an idiot?

what would i have to do to load in an ~/.npmrc file with a github PAT before the background agent starts working?

the only thing useful i saw in the cursor docs for background agents was connecting to the background agent itself where i could manually write the file, but that doesn’t seem like a great solution. also, it’s unclear how environment.json can help - is that supposed to be checked into git, is that configuration on the cursor side?