feat: add config validation and send dry-run

This commit is contained in:
Peter Steinberger
2025-11-25 03:46:26 +01:00
parent a89d7319a9
commit 8bd406f6b1
5 changed files with 116 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ export async function sendCommand(
wait: string;
poll: string;
provider: Provider;
dryRun?: boolean;
},
deps: CliDeps,
runtime: RuntimeEnv,
@@ -26,6 +27,12 @@ export async function sendCommand(
}
if (opts.provider === "web") {
if (opts.dryRun) {
runtime.log(
`[dry-run] would send via web -> ${opts.to}: ${opts.message}`,
);
return;
}
if (waitSeconds !== 0) {
runtime.log(info("Wait/poll are Twilio-only; ignored for provider=web."));
}
@@ -33,6 +40,13 @@ export async function sendCommand(
return;
}
if (opts.dryRun) {
runtime.log(
`[dry-run] would send via twilio -> ${opts.to}: ${opts.message}`,
);
return;
}
const result = await deps.sendMessage(opts.to, opts.message, runtime);
if (!result) return;
if (waitSeconds === 0) return;