Problem
In pg-node/package.json:
"send": "node --env-file-if-exists=.env index.mjs --send",
"upload": "node --env-file-if-exists=.env index.mjs --upload-only"
But pg-node/index.mjs:30 only inspects one flag:
const mode = process.argv.includes('--upload-only') ? 'upload-only' : 'send-email';
--send is parsed as no flag at all — the mode falls through to the default `send-email` branch. This works by coincidence today: anyone copying `npm start` (which has no flag) also gets send-email, so behaviour matches the script names. But:
- Adding a future mode (e.g. `--dry-run`) makes `--send` look load-bearing when it isn't.
- A typo like `--Send` would also "work", masking the bug.
- The CLI usage block in `index.mjs` only mentions npm scripts, not raw flags — so the inconsistency is invisible from a quick read.
Suggested fix
Either:
- Drop `--send` from the npm script (preferred — keep the flag set minimal):
"send": "node --env-file-if-exists=.env index.mjs"
- Or honour `--send` explicitly in `index.mjs` and reject unknown flags:
const args = process.argv.slice(2);
const mode =
args.includes('--upload-only') ? 'upload-only' :
args.includes('--send') ? 'send-email' :
'send-email';
Option 1 is the smaller, more honest fix.
Files
pg-node/package.json — send script
pg-node/index.mjs:30 — mode parsing
Problem
In
pg-node/package.json:But
pg-node/index.mjs:30only inspects one flag:--sendis parsed as no flag at all — the mode falls through to the default `send-email` branch. This works by coincidence today: anyone copying `npm start` (which has no flag) also gets send-email, so behaviour matches the script names. But:Suggested fix
Either:
Option 1 is the smaller, more honest fix.
Files
pg-node/package.json—sendscriptpg-node/index.mjs:30— mode parsing