refactor: centralize outbound policy + target schema
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { Command } from "commander";
|
||||
import { messageCommand } from "../../../commands/message.js";
|
||||
import { danger, setVerbose } from "../../../globals.js";
|
||||
import { CHANNEL_TARGET_DESCRIPTION } from "../../../infra/outbound/channel-target.js";
|
||||
import { defaultRuntime } from "../../../runtime.js";
|
||||
import { createDefaultDeps } from "../../deps.js";
|
||||
|
||||
@@ -26,12 +27,12 @@ export function createMessageCliHelpers(
|
||||
const withMessageTarget = (command: Command) =>
|
||||
command.option(
|
||||
"-t, --to <dest>",
|
||||
"Recipient/channel: E.164 for WhatsApp/Signal, Telegram chat id/@username, Discord/Slack channel/user, or iMessage handle/chat_id",
|
||||
CHANNEL_TARGET_DESCRIPTION,
|
||||
);
|
||||
const withRequiredMessageTarget = (command: Command) =>
|
||||
command.requiredOption(
|
||||
"-t, --to <dest>",
|
||||
"Recipient/channel: E.164 for WhatsApp/Signal, Telegram chat id/@username, Discord/Slack channel/user, or iMessage handle/chat_id",
|
||||
CHANNEL_TARGET_DESCRIPTION,
|
||||
);
|
||||
|
||||
const runMessageAction = async (action: string, opts: Record<string, unknown>) => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Command } from "commander";
|
||||
import { CHANNEL_TARGETS_DESCRIPTION } from "../../../infra/outbound/channel-target.js";
|
||||
import type { MessageCliHelpers } from "./helpers.js";
|
||||
|
||||
export function registerMessageBroadcastCommand(message: Command, helpers: MessageCliHelpers) {
|
||||
@@ -8,7 +9,7 @@ export function registerMessageBroadcastCommand(message: Command, helpers: Messa
|
||||
)
|
||||
.requiredOption(
|
||||
"--targets <target...>",
|
||||
"Targets to broadcast to (repeatable, accepts names or ids)",
|
||||
CHANNEL_TARGETS_DESCRIPTION,
|
||||
)
|
||||
.option("--message <text>", "Message to send")
|
||||
.option("--media <url>", "Media URL")
|
||||
|
||||
Reference in New Issue
Block a user