Identify SST command in code

I want to conditionally run some code during stack setup depending on whether the command sst start, sst deploy or sst remove was executed. How do I know which command was executed?

Just add the code inside “scripts”: { “start”: … } in package.json? If the code you want to execute is looping until manually killed, you probably want to spawn a parallel thread, and when that is done then run the actual command executed: npx sst start, for instance.

I can just set an environment variable before the sst start and detect that and take action based on that in my stack constructor. I was just hoping there would be something built-in.