@optima-chat/comfy-cli 0.9.6 → 0.9.7
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/.claude/settings.local.json +33 -1
- package/dist/commands/asr.d.ts +3 -0
- package/dist/commands/asr.d.ts.map +1 -0
- package/dist/commands/asr.js +104 -0
- package/dist/commands/asr.js.map +1 -0
- package/dist/commands/tts.d.ts +3 -0
- package/dist/commands/tts.d.ts.map +1 -0
- package/dist/commands/tts.js +127 -0
- package/dist/commands/tts.js.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/services/config.d.ts +4 -0
- package/dist/services/config.d.ts.map +1 -1
- package/dist/services/config.js +2 -0
- package/dist/services/config.js.map +1 -1
- package/dist/services/dashscope-tts-api.d.ts +23 -0
- package/dist/services/dashscope-tts-api.d.ts.map +1 -0
- package/dist/services/dashscope-tts-api.js +56 -0
- package/dist/services/dashscope-tts-api.js.map +1 -0
- package/dist/services/groq-api.d.ts +18 -0
- package/dist/services/groq-api.d.ts.map +1 -0
- package/dist/services/groq-api.js +30 -0
- package/dist/services/groq-api.js.map +1 -0
- package/package.json +4 -2
|
@@ -40,7 +40,39 @@
|
|
|
40
40
|
"WebFetch(domain:modelstudio.console.alibabacloud.com)",
|
|
41
41
|
"WebFetch(domain:help.aliyun.com)",
|
|
42
42
|
"Bash(npx ts-node:*)",
|
|
43
|
-
"WebSearch"
|
|
43
|
+
"WebSearch",
|
|
44
|
+
"Bash(grep -r \"tts\\\\|text-to-speech\\\\|speak\\\\|voice.*output\" /Users/verypro/agentic-chat/src --include=*.ts --include=*.tsx)",
|
|
45
|
+
"Bash(xargs ls:*)",
|
|
46
|
+
"Bash(echo:*)",
|
|
47
|
+
"Bash(ls:*)",
|
|
48
|
+
"WebFetch(domain:dashscope.aliyuncs.com)",
|
|
49
|
+
"Bash(npx tsx:*)",
|
|
50
|
+
"WebFetch(domain:bailian.console.aliyun.com)",
|
|
51
|
+
"WebFetch(domain:api.github.com)",
|
|
52
|
+
"WebFetch(domain:dashscope.console.aliyun.com)",
|
|
53
|
+
"WebFetch(domain:blog.csdn.net)",
|
|
54
|
+
"WebFetch(domain:stackoverflow.com)",
|
|
55
|
+
"WebFetch(domain:www.google.com)",
|
|
56
|
+
"WebFetch(domain:pypi.org)",
|
|
57
|
+
"Bash(ffprobe /Users/verypro/comfy-cli/test-output.mp3)",
|
|
58
|
+
"Bash(sox --info /Users/verypro/comfy-cli/test-output.mp3)",
|
|
59
|
+
"Bash(ffmpeg -y -f s16le -ar 24000 -ac 1 -i /Users/verypro/comfy-cli/test-output.mp3 /Users/verypro/comfy-cli/test-output-converted.mp3)",
|
|
60
|
+
"Bash(ffprobe /Users/verypro/comfy-cli/test-output-converted.mp3)",
|
|
61
|
+
"WebFetch(domain:www.alibabacloud.com)",
|
|
62
|
+
"WebFetch(domain:docs.aimlapi.com)",
|
|
63
|
+
"WebFetch(domain:deepwiki.com)",
|
|
64
|
+
"Bash(afplay:*)",
|
|
65
|
+
"Bash(source /Users/verypro/comfy-cli/.env)",
|
|
66
|
+
"Bash(curl -s -X POST 'https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' -H \"Authorization: Bearer $DASHSCOPE_API_KEY\" -H 'Content-Type: application/json' -d '{:*)",
|
|
67
|
+
"Bash(source /Users/verypro/agentic-chat/.env.local)",
|
|
68
|
+
"Skill(show-env)",
|
|
69
|
+
"Bash(optima-show-env agentic-chat:*)",
|
|
70
|
+
"Bash(optima-show-env session-gateway:*)",
|
|
71
|
+
"Bash(infisical --version)",
|
|
72
|
+
"Bash(infisical secrets:*)",
|
|
73
|
+
"Bash(git status:*)",
|
|
74
|
+
"Bash(gh pr:*)",
|
|
75
|
+
"Bash(git merge:*)"
|
|
44
76
|
],
|
|
45
77
|
"deny": [],
|
|
46
78
|
"ask": []
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asr.d.ts","sourceRoot":"","sources":["../../src/commands/asr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,QAmGlD"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { success, info } from '../utils/logger.js';
|
|
5
|
+
import { outputSuccess, outputError, isPrettyMode } from '../utils/output.js';
|
|
6
|
+
import { addEnhancedHelp } from '../utils/helpText.js';
|
|
7
|
+
import { getConfigValue } from '../services/config.js';
|
|
8
|
+
import { GroqClient } from '../services/groq-api.js';
|
|
9
|
+
export function registerAsrCommand(program) {
|
|
10
|
+
const cmd = program
|
|
11
|
+
.command('asr')
|
|
12
|
+
.description('语音识别 (Speech-to-Text) - 使用 Groq Whisper')
|
|
13
|
+
.argument('<file>', '音频文件路径 (支持 mp3, wav, m4a, ogg, webm)')
|
|
14
|
+
.option('--language <lang>', '语言提示: zh | en | ja | ko 等')
|
|
15
|
+
.option('--model <name>', 'Whisper 模型', 'whisper-large-v3-turbo')
|
|
16
|
+
.action(async (file, options) => {
|
|
17
|
+
const pretty = isPrettyMode(options);
|
|
18
|
+
try {
|
|
19
|
+
// 检查文件是否存在
|
|
20
|
+
const filePath = path.resolve(file);
|
|
21
|
+
if (!fs.existsSync(filePath)) {
|
|
22
|
+
outputError('FILE_NOT_FOUND', `音频文件不存在: ${filePath}`, options);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// 获取 API Key
|
|
26
|
+
const apiKey = process.env.GROQ_API_KEY || getConfigValue('groq.apiKey');
|
|
27
|
+
if (!apiKey) {
|
|
28
|
+
outputError('API_KEY_MISSING', '请设置 GROQ_API_KEY 环境变量或运行: comfy config set groq.apiKey <key>', options);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const client = new GroqClient(apiKey);
|
|
32
|
+
const startTime = Date.now();
|
|
33
|
+
if (pretty) {
|
|
34
|
+
const spinner = ora('正在识别语音...').start();
|
|
35
|
+
try {
|
|
36
|
+
const result = await client.transcribe({
|
|
37
|
+
filePath,
|
|
38
|
+
model: options.model,
|
|
39
|
+
language: options.language,
|
|
40
|
+
});
|
|
41
|
+
const durationMs = Date.now() - startTime;
|
|
42
|
+
spinner.succeed('语音识别完成!');
|
|
43
|
+
success(`识别结果: ${result.text}`);
|
|
44
|
+
info(`耗时: ${(durationMs / 1000).toFixed(1)}s`);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
spinner.fail(`识别失败: ${err?.message || err}`);
|
|
48
|
+
throw err;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const result = await client.transcribe({
|
|
53
|
+
filePath,
|
|
54
|
+
model: options.model,
|
|
55
|
+
language: options.language,
|
|
56
|
+
});
|
|
57
|
+
const durationMs = Date.now() - startTime;
|
|
58
|
+
outputSuccess({
|
|
59
|
+
text: result.text,
|
|
60
|
+
file: filePath,
|
|
61
|
+
language: options.language || 'auto',
|
|
62
|
+
model: options.model,
|
|
63
|
+
durationMs,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
outputError('ASR_FAILED', `语音识别失败: ${err}`, options);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
addEnhancedHelp(cmd, {
|
|
72
|
+
examples: [
|
|
73
|
+
'# 基本用法 - 自动检测语言',
|
|
74
|
+
'$ comfy asr recording.mp3',
|
|
75
|
+
'',
|
|
76
|
+
'# 指定语言提示(提高准确率)',
|
|
77
|
+
'$ comfy asr recording.wav --language zh',
|
|
78
|
+
'',
|
|
79
|
+
'# 识别英文音频',
|
|
80
|
+
'$ comfy asr speech.m4a --language en',
|
|
81
|
+
],
|
|
82
|
+
outputJson: `{
|
|
83
|
+
"success": true,
|
|
84
|
+
"data": {
|
|
85
|
+
"text": "识别出的文字内容",
|
|
86
|
+
"file": "/path/to/audio.mp3",
|
|
87
|
+
"language": "zh",
|
|
88
|
+
"model": "whisper-large-v3-turbo",
|
|
89
|
+
"durationMs": 850
|
|
90
|
+
}
|
|
91
|
+
}`,
|
|
92
|
+
relatedCommands: [
|
|
93
|
+
{ command: 'tts <text>', description: '文本转语音' },
|
|
94
|
+
{ command: 'config set groq.apiKey <key>', description: '设置 Groq API Key' },
|
|
95
|
+
],
|
|
96
|
+
notes: [
|
|
97
|
+
'使用 Groq Whisper (whisper-large-v3-turbo) 模型',
|
|
98
|
+
'支持 mp3, wav, m4a, ogg, webm 等常见音频格式',
|
|
99
|
+
'文件大小限制 25MB',
|
|
100
|
+
'设置 GROQ_API_KEY 环境变量或 comfy config set groq.apiKey',
|
|
101
|
+
],
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=asr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asr.js","sourceRoot":"","sources":["../../src/commands/asr.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,MAAM,GAAG,GAAG,OAAO;SAChB,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,yCAAyC,CAAC;SACtD,QAAQ,CAAC,QAAQ,EAAE,sCA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AC/C,EAAE,OAAO,EAAE,8BAA8B,EAAE,WAAW,EAAE,iBAAiB,EAAE;SAC5E;QACD,KAAK,EAAE;YACL,6CAA6C;YAC7C,qCAAqC;YACrC,aAAa;YACb,oDAAoD;SACrD;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tts.d.ts","sourceRoot":"","sources":["../../src/commands/tts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,QA6HlD"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import ora from 'ora';
|
|
3
|
+
import { success, info } from '../utils/logger.js';
|
|
4
|
+
import { outputSuccess, outputError, isPrettyMode } from '../utils/output.js';
|
|
5
|
+
import { addEnhancedHelp } from '../utils/helpText.js';
|
|
6
|
+
import { getConfigValue } from '../services/config.js';
|
|
7
|
+
import { DashScopeTTSClient, TTS_VOICES } from '../services/dashscope-tts-api.js';
|
|
8
|
+
export function registerTtsCommand(program) {
|
|
9
|
+
const cmd = program
|
|
10
|
+
.command('tts')
|
|
11
|
+
.description('文本转语音 (Text-to-Speech) - 使用 DashScope qwen3-tts-flash')
|
|
12
|
+
.argument('<text>', '要转换的文本内容')
|
|
13
|
+
.option('-o, --output <path>', '输出文件路径', '')
|
|
14
|
+
.option('--voice <name>', '声音名称 (默认: Cherry)', 'Cherry')
|
|
15
|
+
.option('--voices', '列出可用声音')
|
|
16
|
+
.option('--play', '生成后自动播放音频')
|
|
17
|
+
.action(async (text, options) => {
|
|
18
|
+
const pretty = isPrettyMode(options);
|
|
19
|
+
// 列出可用声音
|
|
20
|
+
if (options.voices) {
|
|
21
|
+
if (pretty) {
|
|
22
|
+
info('可用声音列表 (qwen3-tts-flash):');
|
|
23
|
+
console.log(` 女声: Cherry, Serena, Chelsie, Aria, Bella, Vivian, Jennifer, Katerina, Breeze, Maple, Sakura`);
|
|
24
|
+
console.log(` 男声: Ethan, Aiden, Brandon, Ryan, Luke, Leo`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
outputSuccess({ voices: TTS_VOICES });
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
// 获取 API Key
|
|
33
|
+
const apiKey = process.env.DASHSCOPE_API_KEY || getConfigValue('dashscope.apiKey');
|
|
34
|
+
if (!apiKey) {
|
|
35
|
+
outputError('API_KEY_MISSING', '请设置 DASHSCOPE_API_KEY 环境变量或运行: comfy config set dashscope.apiKey <key>', options);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
// 确定输出路径
|
|
39
|
+
const outputDir = getConfigValue('outputDir') || './comfy-output';
|
|
40
|
+
const outputPath = options.output
|
|
41
|
+
? path.resolve(options.output)
|
|
42
|
+
: path.resolve(outputDir, `tts_${Date.now()}.wav`);
|
|
43
|
+
const client = new DashScopeTTSClient(apiKey);
|
|
44
|
+
const startTime = Date.now();
|
|
45
|
+
if (pretty) {
|
|
46
|
+
const spinner = ora(`正在合成语音 (${options.voice})...`).start();
|
|
47
|
+
try {
|
|
48
|
+
const result = await client.synthesize({
|
|
49
|
+
text,
|
|
50
|
+
voice: options.voice,
|
|
51
|
+
});
|
|
52
|
+
spinner.text = '正在下载音频...';
|
|
53
|
+
await client.downloadAudio(result.audioUrl, outputPath);
|
|
54
|
+
const durationMs = Date.now() - startTime;
|
|
55
|
+
spinner.succeed('语音合成完成!');
|
|
56
|
+
success(`输出文件: ${outputPath}`);
|
|
57
|
+
info(`声音: ${options.voice}, 耗时: ${(durationMs / 1000).toFixed(1)}s`);
|
|
58
|
+
// 自动播放
|
|
59
|
+
if (options.play) {
|
|
60
|
+
const { execSync } = await import('child_process');
|
|
61
|
+
info('正在播放...');
|
|
62
|
+
execSync(`afplay "${outputPath}"`, { stdio: 'inherit' });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
spinner.fail(`合成失败: ${err?.message || err}`);
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
const result = await client.synthesize({
|
|
72
|
+
text,
|
|
73
|
+
voice: options.voice,
|
|
74
|
+
});
|
|
75
|
+
await client.downloadAudio(result.audioUrl, outputPath);
|
|
76
|
+
const durationMs = Date.now() - startTime;
|
|
77
|
+
outputSuccess({
|
|
78
|
+
output: outputPath,
|
|
79
|
+
voice: options.voice,
|
|
80
|
+
text,
|
|
81
|
+
durationMs,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
outputError('TTS_FAILED', `语音合成失败: ${err}`, options);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
addEnhancedHelp(cmd, {
|
|
90
|
+
examples: [
|
|
91
|
+
'# 基本用法 - 中文语音合成',
|
|
92
|
+
'$ comfy tts "你好,欢迎使用语音合成"',
|
|
93
|
+
'',
|
|
94
|
+
'# 指定输出文件和声音',
|
|
95
|
+
'$ comfy tts "Hello world" -o hello.wav --voice Ethan',
|
|
96
|
+
'',
|
|
97
|
+
'# 使用男声',
|
|
98
|
+
'$ comfy tts "今天天气真好" --voice Ryan',
|
|
99
|
+
'',
|
|
100
|
+
'# 生成后自动播放',
|
|
101
|
+
'$ comfy tts "测试语音" --play',
|
|
102
|
+
'',
|
|
103
|
+
'# 列出可用声音',
|
|
104
|
+
'$ comfy tts "" --voices',
|
|
105
|
+
],
|
|
106
|
+
outputJson: `{
|
|
107
|
+
"success": true,
|
|
108
|
+
"data": {
|
|
109
|
+
"output": "./comfy-output/tts_1234567890.wav",
|
|
110
|
+
"voice": "Cherry",
|
|
111
|
+
"text": "你好",
|
|
112
|
+
"durationMs": 1200
|
|
113
|
+
}
|
|
114
|
+
}`,
|
|
115
|
+
relatedCommands: [
|
|
116
|
+
{ command: 'asr <file>', description: '语音识别(语音转文字)' },
|
|
117
|
+
{ command: 'config set dashscope.apiKey <key>', description: '设置 DashScope API Key' },
|
|
118
|
+
],
|
|
119
|
+
notes: [
|
|
120
|
+
'使用 DashScope qwen3-tts-flash 模型,支持 50+ 种声音',
|
|
121
|
+
'支持中、英、日、韩、法、德等 10 种语言',
|
|
122
|
+
'输出格式为 WAV',
|
|
123
|
+
'设置 DASHSCOPE_API_KEY 环境变量或 comfy config set dashscope.apiKey',
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=tts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tts.js","sourceRoot":"","sources":["../../src/commands/tts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAElF,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,MAAM,GAAG,GAAG,OAAO;SAChB,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,uDAAuD,CAAC;SACpE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;SAC9B,MAAM,CAAC,qBAAqB,EAAE,QAAQ,EAAE,EAAE,CAAC;SAC3C,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,EAAE,QAAQ,CAAC;SACvD,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC;SAC5B,MAAM,CAAC,QAAQ,EAAE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AAQ,EAAE,UAAU,CAAC,CAAC;gBACxD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;gBAE1C,aAAa,CAAC;oBACZ,MAAM,EAAE,UAAU;oBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,IAAI;oBACJ,UAAU;iBACX,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,YAAY,EAAE,WAAW,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACvD,CAAC;IACH,CAAC,CAAC,CAAC;IAEL,eAAe,CAAC,GAAG,EAAE;QACnB,QAAQ,EAAE;YACR,iBAAiB;YACjB,2BAA2B;YAC3B,EAAE;YACF,aAAa;YACb,sDAAsD;YACtD,EAAE;YACF,QAAQ;YACR,mCAAmC;YACnC,EAAE;YACF,WAAW;YACX,2BAA2B;YAC3B,EAAE;YACF,UAAU;YACV,yBAAyB;SAC1B;QACD,UAAU,EAAE;;;;;;;;EAQd;QACE,eAAe,EAAE;YACf,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE;YACrD,EAAE,OAAO,EAAE,mCAAmC,EAAE,WAAW,EAAE,sBAAsB,EAAE;SACtF;QACD,KAAK,EAAE;YACL,4CAA4C;YAC5C,uBAAuB;YACvB,WAAW;YACX,8DAA8D;SAC/D;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,8 @@ import { registerSystemCommand } from './commands/system.js';
|
|
|
17
17
|
import { registerConfigCommand } from './commands/config.js';
|
|
18
18
|
import { registerInterruptCommand } from './commands/interrupt.js';
|
|
19
19
|
import { registerInitCommand } from './commands/init.js';
|
|
20
|
+
import { registerTtsCommand } from './commands/tts.js';
|
|
21
|
+
import { registerAsrCommand } from './commands/asr.js';
|
|
20
22
|
const __filename = fileURLToPath(import.meta.url);
|
|
21
23
|
const __dirname = dirname(__filename);
|
|
22
24
|
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
@@ -49,6 +51,8 @@ Output Formats:
|
|
|
49
51
|
常用命令:
|
|
50
52
|
$ comfy generate "a cat" # 生成图像(默认 JSON 输出)
|
|
51
53
|
$ comfy generate "a cat" --pretty # 生成图像(表格输出)
|
|
54
|
+
$ comfy tts "你好世界" --voice Cherry # 文本转语音
|
|
55
|
+
$ comfy asr audio.mp3 --language zh # 语音识别
|
|
52
56
|
$ comfy workflow list # 列出工作流历史
|
|
53
57
|
$ comfy queue status # 查看队列状态
|
|
54
58
|
$ comfy download <prompt_id> # 下载生成结果
|
|
@@ -62,6 +66,8 @@ registerImageCommand(program); // 统一图像命令(推荐)
|
|
|
62
66
|
registerGenerateCommand(program);
|
|
63
67
|
registerEditCommand(program);
|
|
64
68
|
registerVideoCommand(program);
|
|
69
|
+
registerTtsCommand(program);
|
|
70
|
+
registerAsrCommand(program);
|
|
65
71
|
registerDownloadCommand(program);
|
|
66
72
|
// 注册核心命令
|
|
67
73
|
registerWorkflowCommand(program);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,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CAAC,CAAE,aAAa;AAC7C,uBAAuB,CAAC,OAAO,CAAC,CAAC;AACjC,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC7B,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,kBAAkB,CAAC,OAAO,CAAC,CAAC;AAC5B,kBAAkB,CAAC,OAAO,CAAC,CAAC;AAC5B,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAEjC,SAAS;AACT,uBAAuB,CAAC,OAAO,CAAC,CAAC;AACjC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC7B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAClC,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAE7B,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -12,6 +12,9 @@ export interface DashScopeConfig {
|
|
|
12
12
|
audio: boolean;
|
|
13
13
|
shotType: 'single' | 'multi';
|
|
14
14
|
}
|
|
15
|
+
export interface GroqConfig {
|
|
16
|
+
apiKey?: string;
|
|
17
|
+
}
|
|
15
18
|
export interface ComfyConfig {
|
|
16
19
|
server: string;
|
|
17
20
|
timeout: number;
|
|
@@ -19,6 +22,7 @@ export interface ComfyConfig {
|
|
|
19
22
|
outputDir: string;
|
|
20
23
|
bfl: BFLConfig;
|
|
21
24
|
dashscope: DashScopeConfig;
|
|
25
|
+
groq: GroqConfig;
|
|
22
26
|
preferBackend: 'auto' | 'bfl' | 'comfyui';
|
|
23
27
|
preferVideoBackend: 'auto' | 'dashscope' | 'comfyui';
|
|
24
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,M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AAQ,GAAG,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,SAAS,CAAC;IACf,SAAS,EAAE,eAAe,CAAC;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IAC1C,kBAAkB,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;CACtD;AAuBD,eAAO,MAAM,MAAM,mBAGjB,CAAC;AAEH,wBAAgB,SAAS,IAAI,WAAW,CAEvC;AAGD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAEvD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAE/C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAGD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAoBrD"}
|
package/dist/services/config.js
CHANGED
|
@@ -15,6 +15,7 @@ const defaultConfig = {
|
|
|
15
15
|
audio: true,
|
|
16
16
|
shotType: 'single',
|
|
17
17
|
},
|
|
18
|
+
groq: {},
|
|
18
19
|
preferBackend: 'auto',
|
|
19
20
|
preferVideoBackend: 'auto',
|
|
20
21
|
};
|
|
@@ -54,6 +55,7 @@ export function isValidConfigKey(key) {
|
|
|
54
55
|
'dashscope.promptExtend',
|
|
55
56
|
'dashscope.audio',
|
|
56
57
|
'dashscope.shotType',
|
|
58
|
+
'groq.apiKey',
|
|
57
59
|
'preferBackend',
|
|
58
60
|
'preferVideoBackend',
|
|
59
61
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAiCxB,MAAM,aAAa,GAAgB;IACjC,MAAM,EAAE,6BAA6B;IACrC,OAAO,EAAE,MAAM;IACf,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,gBAAgB;IAC3B,GAAG,EAAE;QACH,eAAe,EAAE,CAAC;QAClB,YAAY,EAAE,KAAK;KACpB;IACD,SAAS,EAAE;QACT,UAAU,EAAE,OAAO;QACnB,QAAQ,EAAE,CAAC;QACX,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,QAAQ;KACnB;IACD,IAAI,EAAE,EAAE;IACR,aAAa,EAAE,MAAM;IACrB,kBAAkB,EAAE,MAAM;CAC3B,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,IAAI,CAAc;IAC1C,WAAW,EAAE,WAAW;IACxB,QAAQ,EAAE,aAAa;CACxB,CAAC,CAAC;AAEH,MAAM,UAAU,SAAS;IACvB,OAAO,MAAM,CAAC,KAAK,CAAC;AACtB,CAAC;AAED,uBAAuB;AACvB,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,KAAU;IAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,MAAM,CAAC,MAAM,CAAC,GAAwB,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,MAAM,CAAC,KAAK,EAAE,CAAC;AACjB,CAAC;AAED,YAAY;AACZ,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,SAAS,GAAG;QAChB,QAAQ;QACR,SAAS;QACT,aAAa;QACb,WAAW;QACX,YAAY;QACZ,qBAAqB;QACrB,kBAAkB;QAClB,kBAAkB;QAClB,sBAAsB;QACtB,oBAAoB;QACpB,wBAAwB;QACxB,iBAAiB;QACjB,oBAAoB;QACpB,aAAa;QACb,eAAe;QACf,oBAAoB;KACrB,CAAC;IACF,OAAO,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface TTSSynthesizeParams {
|
|
2
|
+
text: string;
|
|
3
|
+
voice?: string;
|
|
4
|
+
languageType?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TTSSynthesizeResult {
|
|
7
|
+
audioUrl: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const TTS_VOICES: readonly ["Cherry", "Serena", "Chelsie", "Aria", "Bella", "Vivian", "Jennifer", "Katerina", "Breeze", "Maple", "Sakura", "Ethan", "Aiden", "Brandon", "Ryan", "Luke", "Leo"];
|
|
10
|
+
export declare class DashScopeTTSClient {
|
|
11
|
+
private client;
|
|
12
|
+
private baseUrl;
|
|
13
|
+
constructor(apiKey: string);
|
|
14
|
+
/**
|
|
15
|
+
* 文本转语音
|
|
16
|
+
*/
|
|
17
|
+
synthesize(params: TTSSynthesizeParams): Promise<TTSSynthesizeResult>;
|
|
18
|
+
/**
|
|
19
|
+
* 下载音频到本地
|
|
20
|
+
*/
|
|
21
|
+
downloadAudio(url: string, outputPath: string): Promise<string>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=dashscope-tts-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashscope-tts-api.d.ts","sourceRoot":"","sources":["../../src/services/dashscope-tts-api.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAGD,eAAO,MAAM,UAAU,8KAMb,CAAC;AAEX,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAA2C;gBAE9C,MAAM,EAAE,MAAM;IAW1B;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAoB3E;;OAEG;IACG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAYtE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import * as fs from 'fs/promises';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
// qwen3-tts-flash 支持的声音列表
|
|
5
|
+
export const TTS_VOICES = [
|
|
6
|
+
// 女声
|
|
7
|
+
'Cherry', 'Serena', 'Chelsie', 'Aria', 'Bella', 'Vivian', 'Jennifer', 'Katerina',
|
|
8
|
+
'Breeze', 'Maple', 'Sakura',
|
|
9
|
+
// 男声
|
|
10
|
+
'Ethan', 'Aiden', 'Brandon', 'Ryan', 'Luke', 'Leo',
|
|
11
|
+
];
|
|
12
|
+
export class DashScopeTTSClient {
|
|
13
|
+
client;
|
|
14
|
+
baseUrl = 'https://dashscope.aliyuncs.com/api/v1';
|
|
15
|
+
constructor(apiKey) {
|
|
16
|
+
this.client = axios.create({
|
|
17
|
+
baseURL: this.baseUrl,
|
|
18
|
+
headers: {
|
|
19
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
},
|
|
22
|
+
timeout: 60000,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 文本转语音
|
|
27
|
+
*/
|
|
28
|
+
async synthesize(params) {
|
|
29
|
+
const response = await this.client.post('/services/aigc/multimodal-generation/generation', {
|
|
30
|
+
model: 'qwen3-tts-flash',
|
|
31
|
+
input: {
|
|
32
|
+
text: params.text,
|
|
33
|
+
voice: params.voice || 'Cherry',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const audioUrl = response.data?.output?.audio?.url;
|
|
37
|
+
if (!audioUrl) {
|
|
38
|
+
throw new Error('DashScope TTS: 未返回音频 URL');
|
|
39
|
+
}
|
|
40
|
+
return { audioUrl };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 下载音频到本地
|
|
44
|
+
*/
|
|
45
|
+
async downloadAudio(url, outputPath) {
|
|
46
|
+
const dir = path.dirname(outputPath);
|
|
47
|
+
await fs.mkdir(dir, { recursive: true });
|
|
48
|
+
const response = await axios.get(url, {
|
|
49
|
+
responseType: 'arraybuffer',
|
|
50
|
+
timeout: 60000,
|
|
51
|
+
});
|
|
52
|
+
await fs.writeFile(outputPath, response.data);
|
|
53
|
+
return outputPath;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=dashscope-tts-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashscope-tts-api.js","sourceRoot":"","sources":["../../src/services/dashscope-tts-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAY7B,0BAA0B;AAC1B,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK;IACL,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAA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AAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;YACpC,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;QAEH,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC9C,OAAO,UAAU,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface TranscribeParams {
|
|
2
|
+
filePath: string;
|
|
3
|
+
model?: string;
|
|
4
|
+
language?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TranscribeResult {
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class GroqClient {
|
|
10
|
+
private apiKey;
|
|
11
|
+
private baseUrl;
|
|
12
|
+
constructor(apiKey: string);
|
|
13
|
+
/**
|
|
14
|
+
* 语音识别(ASR)
|
|
15
|
+
*/
|
|
16
|
+
transcribe(params: TranscribeParams): Promise<TranscribeResult>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=groq-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groq-api.d.ts","sourceRoot":"","sources":["../../src/services/groq-api.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAoC;gBAEvC,MAAM,EAAE,MAAM;IAI1B;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAsBtE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import FormData from 'form-data';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
export class GroqClient {
|
|
5
|
+
apiKey;
|
|
6
|
+
baseUrl = 'https://api.groq.com/openai/v1';
|
|
7
|
+
constructor(apiKey) {
|
|
8
|
+
this.apiKey = apiKey;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 语音识别(ASR)
|
|
12
|
+
*/
|
|
13
|
+
async transcribe(params) {
|
|
14
|
+
const form = new FormData();
|
|
15
|
+
form.append('file', fs.createReadStream(params.filePath));
|
|
16
|
+
form.append('model', params.model || 'whisper-large-v3-turbo');
|
|
17
|
+
if (params.language) {
|
|
18
|
+
form.append('language', params.language);
|
|
19
|
+
}
|
|
20
|
+
const response = await axios.post(`${this.baseUrl}/audio/transcriptions`, form, {
|
|
21
|
+
headers: {
|
|
22
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
23
|
+
...form.getHeaders(),
|
|
24
|
+
},
|
|
25
|
+
timeout: 60000,
|
|
26
|
+
});
|
|
27
|
+
return { text: response.data.text };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=groq-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groq-api.js","sourceRoot":"","sources":["../../src/services/groq-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAYzB,MAAM,OAAO,UAAU;IACb,MAAM,CAAS;IACf,OAAO,GAAG,gCAAgC,CAAC;IAEnD,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,MAAwB;QACvC,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,IAAI,wBAAwB,CAAC,CAAC;QAC/D,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC3C,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAC/B,GAAG,IAAI,CAAC,OAAO,uBAAuB,EACtC,IAAI,EACJ;YACE,OAAO,EAAE;gBACP,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;gBACxC,GAAG,IAAI,CAAC,UAAU,EAAE;aACrB;YACD,OAAO,EAAE,KAAK;SACf,CACF,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACtC,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optima-chat/comfy-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "A CLI tool for ComfyUI designed for LLM interactions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"build": "tsc",
|
|
12
12
|
"dev": "tsx src/index.ts",
|
|
13
13
|
"start": "node dist/index.js",
|
|
14
|
+
"test": "vitest run",
|
|
14
15
|
"prepublishOnly": "npm run build"
|
|
15
16
|
},
|
|
16
17
|
"keywords": [
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"@types/node": "^20.17.10",
|
|
65
66
|
"@types/ws": "^8.5.13",
|
|
66
67
|
"tsx": "^4.19.2",
|
|
67
|
-
"typescript": "^5.7.2"
|
|
68
|
+
"typescript": "^5.7.2",
|
|
69
|
+
"vitest": "^2.1.9"
|
|
68
70
|
}
|
|
69
71
|
}
|