build: add local node bin to restart script PATH

This commit is contained in:
Peter Steinberger
2025-12-07 18:49:55 +01:00
parent 558af7a454
commit d463c82c95
31 changed files with 2089 additions and 1851 deletions

View File

@@ -135,16 +135,20 @@ export function buildProgram() {
program
.command("send")
.description("Send a WhatsApp message (web provider)")
.description("Send a message (WhatsApp web or Telegram bot)")
.requiredOption(
"-t, --to <number>",
"Recipient number in E.164 (e.g. +15555550123)",
"Recipient: E.164 for WhatsApp (e.g. +15555550123) or Telegram chat id/@username",
)
.requiredOption("-m, --message <text>", "Message body")
.option(
"--media <path-or-url>",
"Attach media (image/audio/video/document). Accepts local paths or URLs.",
)
.option(
"--provider <provider>",
"Delivery provider: whatsapp|telegram (default: whatsapp)",
)
.option("--dry-run", "Print payload and skip sending", false)
.option("--json", "Output result as JSON", false)
.option("--verbose", "Verbose logging", false)
@@ -562,6 +566,42 @@ Examples:
}
});
program
.command("relay:telegram")
.description("Auto-reply to Telegram (Bot API, long-poll)")
.option("--verbose", "Verbose logging", false)
.addHelpText(
"after",
`
Examples:
clawdis relay:telegram # uses TELEGRAM_BOT_TOKEN env
TELEGRAM_BOT_TOKEN=xxx clawdis relay:telegram --verbose
`,
)
.action(async (opts) => {
setVerbose(Boolean(opts.verbose));
const token = process.env.TELEGRAM_BOT_TOKEN;
if (!token) {
defaultRuntime.error(
danger("Set TELEGRAM_BOT_TOKEN to use telegram relay"),
);
defaultRuntime.exit(1);
return;
}
try {
await import("../telegram/monitor.js").then((m) =>
m.monitorTelegramProvider({
verbose: Boolean(opts.verbose),
token,
runtime: defaultRuntime,
}),
);
} catch (err) {
defaultRuntime.error(danger(`Telegram relay failed: ${String(err)}`));
defaultRuntime.exit(1);
}
});
program
.command("status")
.description("Show web session health and recent session recipients")