verbalcoding 0.2.10 → 0.2.11
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.
|
@@ -31,6 +31,7 @@ test('CLI includes npm-friendly setup and start commands', () => {
|
|
|
31
31
|
|
|
32
32
|
assert.match(cli, /vc setup \[--yes\]/);
|
|
33
33
|
assert.match(cli, /vc setup token \[bot-token\]/);
|
|
34
|
+
assert.match(cli, /vc setup channels \[voice-channel/);
|
|
34
35
|
assert.match(cli, /command === 'setup'/);
|
|
35
36
|
assert.match(cli, /install\.mjs'\), \.\.\.argv\.slice\(1\)/);
|
|
36
37
|
assert.match(cli, /VERBALCODING_SKIP_CLI_LINK/);
|
|
@@ -56,10 +57,14 @@ test('npm setup supports non-interactive --yes mode', () => {
|
|
|
56
57
|
|
|
57
58
|
assert.match(installer, /args\.includes\('--yes'\)/);
|
|
58
59
|
assert.match(installer, /configureDiscordToken/);
|
|
60
|
+
assert.match(installer, /configureAutoJoinChannels/);
|
|
59
61
|
assert.match(installer, /DISCORD_BOT_TOKEN: token/);
|
|
62
|
+
assert.match(installer, /AUTO_JOIN_VOICE_CHANNELS: channels/);
|
|
60
63
|
assert.match(installer, /vc setup token/);
|
|
64
|
+
assert.match(installer, /vc setup channels/);
|
|
61
65
|
assert.match(installer, /normalizeInstallAnswers\(process\.env\)/);
|
|
62
66
|
assert.match(config, /vc start/);
|
|
67
|
+
assert.match(config, /vc setup channels/);
|
|
63
68
|
assert.doesNotMatch(config, /npm install -g \.\s+#/);
|
|
64
69
|
});
|
|
65
70
|
|
|
@@ -259,6 +259,8 @@ export function renderInstallSummary(values = {}) {
|
|
|
259
259
|
'',
|
|
260
260
|
'Next commands:',
|
|
261
261
|
' vc doctor',
|
|
262
|
+
' vc setup token # register/update Discord bot token when ready',
|
|
263
|
+
' vc setup channels # set auto-join voice channel names',
|
|
262
264
|
' vc start',
|
|
263
265
|
'',
|
|
264
266
|
'Legacy project-local equivalents still work:',
|
package/package.json
CHANGED
package/scripts/cli.mjs
CHANGED
|
@@ -32,6 +32,7 @@ function usage() {
|
|
|
32
32
|
Usage:
|
|
33
33
|
vc setup [--yes] [--no-wizard] [--skip-system] [--skip-model] [--skip-edge-tts]
|
|
34
34
|
vc setup token [bot-token] [--client-id <client-id>]
|
|
35
|
+
vc setup channels [voice-channel[,voice-channel...]]
|
|
35
36
|
vc start
|
|
36
37
|
vc status
|
|
37
38
|
vc language <ko|en|auto>
|
|
@@ -50,6 +51,7 @@ Examples:
|
|
|
50
51
|
npx verbalcoding setup --yes
|
|
51
52
|
vc setup --yes
|
|
52
53
|
vc setup token
|
|
54
|
+
vc setup channels "General,Team Voice"
|
|
53
55
|
vc start
|
|
54
56
|
vc language en
|
|
55
57
|
vc language ko
|
|
@@ -277,7 +279,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
277
279
|
}
|
|
278
280
|
if (command === 'setup' || command === 'install') {
|
|
279
281
|
const { spawnSync } = await import('node:child_process');
|
|
280
|
-
if (
|
|
282
|
+
if (['token', 'discord', 'bot-token', 'channels', 'channel', 'voice'].includes(argv[1])) {
|
|
281
283
|
const result = spawnSync(process.execPath, [path.join(ROOT, 'scripts', 'install.mjs'), ...argv.slice(1)], { stdio: 'inherit', cwd: ROOT });
|
|
282
284
|
process.exitCode = result.status ?? 1;
|
|
283
285
|
return;
|
package/scripts/install.mjs
CHANGED
|
@@ -76,12 +76,41 @@ async function configureDiscordToken(args) {
|
|
|
76
76
|
if (clientId) console.log(`Invite URL: vc bot invite ${clientId}`);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
async function configureAutoJoinChannels(args) {
|
|
80
|
+
const envPath = path.join(ROOT, '.env');
|
|
81
|
+
let channels = args.find((arg, idx) => idx > 0 && !arg.startsWith('--')) || argValue(args, '--channels') || argValue(args, '--voice');
|
|
82
|
+
if (!channels) {
|
|
83
|
+
globalThis.__rl = readline.createInterface({ input, output });
|
|
84
|
+
try {
|
|
85
|
+
console.log('Discord auto-join voice channel setup');
|
|
86
|
+
console.log('Enter one or more voice channel names, comma-separated. Example: General,Team Voice,일반');
|
|
87
|
+
channels = await ask('Auto-join voice channel names', process.env.AUTO_JOIN_VOICE_CHANNELS || 'General,general');
|
|
88
|
+
} finally {
|
|
89
|
+
globalThis.__rl.close();
|
|
90
|
+
globalThis.__rl = null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (!channels) {
|
|
94
|
+
console.error('No voice channel names provided. Nothing changed.');
|
|
95
|
+
process.exitCode = 2;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
upsertEnvFile(envPath, { AUTO_JOIN_VOICE_CHANNELS: channels });
|
|
99
|
+
console.log(`Updated ${envPath}`);
|
|
100
|
+
console.log(`Auto-join voice channels: ${channels}`);
|
|
101
|
+
console.log('Restart the bridge for this to take effect. You can update it anytime with `vc setup channels`.');
|
|
102
|
+
}
|
|
103
|
+
|
|
79
104
|
async function main() {
|
|
80
105
|
const args = process.argv.slice(2);
|
|
81
106
|
if (args[0] === 'token' || args[0] === 'discord' || args[0] === 'bot-token') {
|
|
82
107
|
await configureDiscordToken(args);
|
|
83
108
|
return;
|
|
84
109
|
}
|
|
110
|
+
if (args[0] === 'channels' || args[0] === 'channel' || args[0] === 'voice') {
|
|
111
|
+
await configureAutoJoinChannels(args);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
85
114
|
const yes = args.includes('--yes') || args.includes('-y');
|
|
86
115
|
if (args[0] === 'instance' || args.includes('--instance')) {
|
|
87
116
|
const { spawnSync } = await import('node:child_process');
|