@tritard/waterbrother 0.16.125 → 0.16.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/channels.js +3 -2
- package/src/cli.js +81 -0
package/package.json
CHANGED
package/src/channels.js
CHANGED
|
@@ -229,7 +229,7 @@ export function buildChannelOnboardingPayload(serviceId) {
|
|
|
229
229
|
"Enable Message Content Intent before testing DMs or mentions"
|
|
230
230
|
],
|
|
231
231
|
commands: [
|
|
232
|
-
"waterbrother config set-json channels '{\"discord\":{\"enabled\":true,\"botToken\":\"
|
|
232
|
+
"waterbrother config set-json channels '{\"discord\":{\"enabled\":true,\"botToken\":\"YOUR_BOT_TOKEN\",\"applicationId\":\"YOUR_APP_ID\",\"pairingMode\":\"manual\",\"allowedUserIds\":[]}}'",
|
|
233
233
|
"waterbrother channels status",
|
|
234
234
|
"waterbrother discord status",
|
|
235
235
|
"waterbrother discord run"
|
|
@@ -237,7 +237,8 @@ export function buildChannelOnboardingPayload(serviceId) {
|
|
|
237
237
|
notes: [
|
|
238
238
|
"Start with direct messages before any guild or channel workflow.",
|
|
239
239
|
"This first runtime slice handles DMs and mentions, not full Roundtable rooms yet.",
|
|
240
|
-
"Prefer explicit user allowlists."
|
|
240
|
+
"Prefer explicit user allowlists.",
|
|
241
|
+
"The interactive TUI onboarding wizard can store the Discord token and application id directly, just like Telegram."
|
|
241
242
|
]
|
|
242
243
|
};
|
|
243
244
|
}
|
package/src/cli.js
CHANGED
|
@@ -3694,6 +3694,87 @@ async function runOnboardingWizard(config, { cwd }) {
|
|
|
3694
3694
|
console.log(dim("Skipping Telegram setup for now. You can always run `waterbrother onboarding telegram` later."));
|
|
3695
3695
|
}
|
|
3696
3696
|
}
|
|
3697
|
+
|
|
3698
|
+
const configureDiscord = await promptYesNo("Enable Discord DM control now?", {
|
|
3699
|
+
input: process.stdin,
|
|
3700
|
+
output: process.stdout
|
|
3701
|
+
});
|
|
3702
|
+
if (configureDiscord) {
|
|
3703
|
+
const alreadyHaveDiscordSetup = await promptYesNo("Do you already have a Discord bot token and application id?", {
|
|
3704
|
+
input: process.stdin,
|
|
3705
|
+
output: process.stdout
|
|
3706
|
+
});
|
|
3707
|
+
if (!alreadyHaveDiscordSetup) {
|
|
3708
|
+
console.log("Create a Discord application and bot, enable Message Content Intent, then come back here.");
|
|
3709
|
+
console.log(dim(`Guide: ${getDocsUrl("/onboarding/discord")}`));
|
|
3710
|
+
const openGuide = await promptYesNo("Open the Discord setup guide in your browser?", {
|
|
3711
|
+
input: process.stdin,
|
|
3712
|
+
output: process.stdout
|
|
3713
|
+
});
|
|
3714
|
+
if (openGuide) {
|
|
3715
|
+
const opened = await maybeOpenUrl(getDocsUrl("/onboarding/discord"));
|
|
3716
|
+
if (!opened) {
|
|
3717
|
+
console.log(dim(`Could not open browser automatically. Visit ${getDocsUrl("/onboarding/discord")}`));
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3720
|
+
}
|
|
3721
|
+
|
|
3722
|
+
const existingDiscord = next.channels?.discord && typeof next.channels.discord === "object" ? next.channels.discord : {};
|
|
3723
|
+
let discordToken = String(existingDiscord.botToken || existingDiscord.token || "").trim();
|
|
3724
|
+
let discordApplicationId = String(existingDiscord.applicationId || "").trim();
|
|
3725
|
+
|
|
3726
|
+
if (discordToken) {
|
|
3727
|
+
const keepExistingDiscordToken = await promptYesNo(`Use saved Discord bot token (${formatApiKeyHint(discordToken)})?`, {
|
|
3728
|
+
input: process.stdin,
|
|
3729
|
+
output: process.stdout
|
|
3730
|
+
});
|
|
3731
|
+
if (!keepExistingDiscordToken) {
|
|
3732
|
+
discordToken = "";
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
while (!discordToken) {
|
|
3737
|
+
const enteredDiscordToken = (await promptLine("Paste Discord bot token (Enter to skip for now): ")).trim();
|
|
3738
|
+
if (!enteredDiscordToken) break;
|
|
3739
|
+
discordToken = enteredDiscordToken;
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3742
|
+
if (discordApplicationId) {
|
|
3743
|
+
const keepExistingDiscordAppId = await promptYesNo(`Use saved Discord application id (${discordApplicationId})?`, {
|
|
3744
|
+
input: process.stdin,
|
|
3745
|
+
output: process.stdout
|
|
3746
|
+
});
|
|
3747
|
+
if (!keepExistingDiscordAppId) {
|
|
3748
|
+
discordApplicationId = "";
|
|
3749
|
+
}
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3752
|
+
while (!discordApplicationId && discordToken) {
|
|
3753
|
+
const enteredDiscordApplicationId = (await promptLine("Paste Discord application id (Enter to skip for now): ")).trim();
|
|
3754
|
+
if (!enteredDiscordApplicationId) break;
|
|
3755
|
+
discordApplicationId = enteredDiscordApplicationId;
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
if (discordToken && discordApplicationId) {
|
|
3759
|
+
const channels = next.channels && typeof next.channels === "object" ? { ...next.channels } : {};
|
|
3760
|
+
const discord = channels.discord && typeof channels.discord === "object" ? { ...channels.discord } : {};
|
|
3761
|
+
channels.discord = {
|
|
3762
|
+
...discord,
|
|
3763
|
+
enabled: true,
|
|
3764
|
+
botToken: discordToken,
|
|
3765
|
+
applicationId: discordApplicationId,
|
|
3766
|
+
pairingMode: discord.pairingMode || "manual",
|
|
3767
|
+
allowedUserIds: Array.isArray(discord.allowedUserIds) ? discord.allowedUserIds : []
|
|
3768
|
+
};
|
|
3769
|
+
next.channels = channels;
|
|
3770
|
+
|
|
3771
|
+
console.log(green("Discord configured for DM-first control."));
|
|
3772
|
+
console.log(dim("Run `waterbrother discord run` in a second terminal when you want the Discord gateway live."));
|
|
3773
|
+
} else {
|
|
3774
|
+
console.log(dim("Skipping Discord setup for now. You can always run `waterbrother onboarding discord` later."));
|
|
3775
|
+
}
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3697
3778
|
if (!next.approvalMode) next.approvalMode = 'on-request';
|
|
3698
3779
|
if (!next.designModel) next.designModel = getDefaultDesignModelForProvider(next.provider);
|
|
3699
3780
|
if (next.traceMode === undefined) next.traceMode = 'on';
|