auralwise_cli 1.0.0 → 1.0.1

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/bin/auralwise.js CHANGED
@@ -9,21 +9,21 @@ import { registerResult } from '../lib/commands/result.js';
9
9
  import { registerDelete } from '../lib/commands/delete.js';
10
10
  import { registerEvents } from '../lib/commands/events.js';
11
11
 
12
- const program = new Command();
13
-
14
12
  // Parse --locale early before command registration so descriptions use correct language
15
13
  const localeIdx = process.argv.indexOf('--locale');
16
14
  if (localeIdx !== -1 && process.argv[localeIdx + 1]) {
17
15
  setLocale(process.argv[localeIdx + 1]);
18
16
  }
19
17
 
18
+ const program = new Command();
19
+
20
20
  program
21
21
  .name('auralwise')
22
22
  .description(t('descMain'))
23
- .version('1.0.0')
24
- .option('--api-key <key>', 'API key (or set AURALWISE_API_KEY env)')
25
- .option('--base-url <url>', 'API base URL', 'https://auralwise.cn/api/v1')
26
- .option('--locale <locale>', 'UI language: en or zh (default: en)');
23
+ .version('1.0.1')
24
+ .option('--api-key <key>', t('optApiKey'))
25
+ .option('--base-url <url>', t('optBaseUrl'), 'https://auralwise.cn/api/v1')
26
+ .option('--locale <locale>', t('optLocale'));
27
27
 
28
28
  registerTranscribe(program);
29
29
  registerTasks(program);
@@ -7,7 +7,7 @@ export function registerDelete(program) {
7
7
  .command('delete')
8
8
  .description(t('descDelete'))
9
9
  .argument('<id>', t('argTaskId'))
10
- .option('--force', 'Skip confirmation')
10
+ .option('--force', t('optForce'))
11
11
  .action(async (id, opts) => {
12
12
  try {
13
13
  if (!opts.force) {
@@ -27,7 +27,7 @@ export function registerDelete(program) {
27
27
  await client.deleteTask(id);
28
28
  console.log(chalk.green(t('taskDeleted', { id: id.substring(0, 8) })));
29
29
  } catch (err) {
30
- console.error(chalk.red(`Error: ${err.message}`));
30
+ console.error(chalk.red(`${t('error')}: ${err.message}`));
31
31
  process.exit(1);
32
32
  }
33
33
  });
@@ -6,9 +6,9 @@ export function registerEvents(program) {
6
6
  program
7
7
  .command('events')
8
8
  .description(t('descEvents'))
9
- .option('--category <cat>', 'Filter by category')
10
- .option('--search <keyword>', 'Search event name')
11
- .option('--json', 'Output as JSON')
9
+ .option('--category <cat>', t('optCategory'))
10
+ .option('--search <keyword>', t('optSearch'))
11
+ .option('--json', t('optJson'))
12
12
  .action(async (opts) => {
13
13
  try {
14
14
  const client = createClient(program);
@@ -43,7 +43,7 @@ export function registerEvents(program) {
43
43
  const isZh = getLocale() === 'zh';
44
44
  console.log(chalk.bold(`${t('totalClasses')}: ${classes.length}`));
45
45
  console.log();
46
- console.log(chalk.bold('Index Name Category'));
46
+ console.log(chalk.bold(`${t('tableHeaderIndex').padStart(5)} ${t('tableHeaderName').padEnd(40)} ${t('category')}`));
47
47
  console.log('─'.repeat(80));
48
48
  for (const c of classes) {
49
49
  const name = isZh ? (c.zh_name || c.display_name) : c.display_name;
@@ -51,7 +51,7 @@ export function registerEvents(program) {
51
51
  console.log(`${String(c.index).padStart(5)} ${name.padEnd(40)} ${cat}`);
52
52
  }
53
53
  } catch (err) {
54
- console.error(chalk.red(`Error: ${err.message}`));
54
+ console.error(chalk.red(`${t('error')}: ${err.message}`));
55
55
  process.exit(1);
56
56
  }
57
57
  });
@@ -8,8 +8,8 @@ export function registerResult(program) {
8
8
  .command('result')
9
9
  .description(t('descResult'))
10
10
  .argument('<id>', t('argTaskId'))
11
- .option('--json', 'Output as JSON')
12
- .option('--output <file>', 'Save result to file')
11
+ .option('--json', t('optJson'))
12
+ .option('--output <file>', t('optOutput'))
13
13
  .action(async (id, opts) => {
14
14
  try {
15
15
  const client = createClient(program);
@@ -24,7 +24,7 @@ export function registerResult(program) {
24
24
  printResult(result);
25
25
  }
26
26
  } catch (err) {
27
- console.error(chalk.red(`Error: ${err.message}`));
27
+ console.error(chalk.red(`${t('error')}: ${err.message}`));
28
28
  process.exit(1);
29
29
  }
30
30
  });
@@ -7,7 +7,7 @@ export function registerTask(program) {
7
7
  .command('task')
8
8
  .description(t('descTask'))
9
9
  .argument('<id>', t('argTaskId'))
10
- .option('--json', 'Output as JSON')
10
+ .option('--json', t('optJson'))
11
11
  .action(async (id, opts) => {
12
12
  try {
13
13
  const client = createClient(program);
@@ -19,7 +19,7 @@ export function registerTask(program) {
19
19
  printTaskDetail(task);
20
20
  }
21
21
  } catch (err) {
22
- console.error(chalk.red(`Error: ${err.message}`));
22
+ console.error(chalk.red(`${t('error')}: ${err.message}`));
23
23
  process.exit(1);
24
24
  }
25
25
  });
@@ -6,10 +6,10 @@ export function registerTasks(program) {
6
6
  program
7
7
  .command('tasks')
8
8
  .description(t('descTasks'))
9
- .option('--status <status>', 'Filter by status (pending/processing/done/failed/abandoned)')
10
- .option('--page <n>', 'Page number', parseInt, 1)
11
- .option('--page-size <n>', 'Items per page', parseInt, 20)
12
- .option('--json', 'Output as JSON')
9
+ .option('--status <status>', t('optStatus'))
10
+ .option('--page <n>', t('optPage'), parseInt, 1)
11
+ .option('--page-size <n>', t('optPageSize'), parseInt, 20)
12
+ .option('--json', t('optJson'))
13
13
  .action(async (opts) => {
14
14
  try {
15
15
  const client = createClient(program);
@@ -30,7 +30,7 @@ export function registerTasks(program) {
30
30
  return;
31
31
  }
32
32
 
33
- console.log(chalk.bold('ID Status Filename Created'));
33
+ console.log(chalk.bold(`${t('tableHeaderId').padEnd(10)}${t('tableHeaderStatus').padEnd(20)}${t('tableHeaderFilename').padEnd(42)}${t('tableHeaderCreated')}`));
34
34
  console.log('─'.repeat(100));
35
35
  for (const task of tasks) {
36
36
  console.log(formatTaskRow(task));
@@ -38,7 +38,7 @@ export function registerTasks(program) {
38
38
  console.log('─'.repeat(100));
39
39
  console.log(`${t('total')}: ${data.total || tasks.length} ${t('page')}: ${data.page || 1}/${Math.ceil((data.total || tasks.length) / (data.page_size || 20))}`);
40
40
  } catch (err) {
41
- console.error(chalk.red(`Error: ${err.message}`));
41
+ console.error(chalk.red(`${t('error')}: ${err.message}`));
42
42
  process.exit(1);
43
43
  }
44
44
  });
@@ -10,32 +10,32 @@ export function registerTranscribe(program) {
10
10
  .command('transcribe')
11
11
  .description(t('descTranscribe'))
12
12
  .argument('<source>', t('argSource'))
13
- .option('--base64', 'Force base64 mode for local file upload')
14
- .option('--language <lang>', 'ASR language (zh/en/ja/... or null for auto)')
15
- .option('--no-asr', 'Disable ASR')
16
- .option('--no-diarize', 'Disable speaker diarization')
17
- .option('--no-events', 'Disable audio event detection')
18
- .option('--optimize-zh', 'Enable Chinese optimization mode')
19
- .option('--beam-size <n>', 'Beam search width', parseInt)
20
- .option('--temperature <n>', 'Decoding temperature', parseFloat)
21
- .option('--hotwords <words>', 'Hotwords (comma-separated)')
22
- .option('--initial-prompt <text>', 'Initial prompt text')
23
- .option('--vad-threshold <n>', 'VAD threshold (0-1)', parseFloat)
24
- .option('--vad-min-speech <ms>', 'Min speech duration in ms', parseInt)
25
- .option('--vad-min-silence <ms>', 'Min silence duration in ms', parseInt)
26
- .option('--no-speech-threshold <n>', 'No-speech probability threshold', parseFloat)
27
- .option('--num-speakers <n>', 'Fixed number of speakers', parseInt)
28
- .option('--min-speakers <n>', 'Minimum speakers for auto-detection', parseInt)
29
- .option('--max-speakers <n>', 'Maximum speakers for auto-detection', parseInt)
30
- .option('--events-threshold <n>', 'Audio event confidence threshold', parseFloat)
31
- .option('--events-classes <classes>', 'Specific event classes (comma-separated)')
32
- .option('--batch', 'Enable batch mode (lower priority)')
33
- .option('--callback-url <url>', 'Webhook callback URL')
34
- .option('--callback-secret <secret>', 'Webhook HMAC secret')
35
- .option('--no-wait', 'Submit and return immediately without polling')
36
- .option('--poll-interval <seconds>', 'Polling interval in seconds', parseFloat, 5)
37
- .option('--json', 'Output as JSON')
38
- .option('--output <file>', 'Save result to file')
13
+ .option('--base64', t('optBase64'))
14
+ .option('--language <lang>', t('optLanguage'))
15
+ .option('--no-asr', t('optNoAsr'))
16
+ .option('--no-diarize', t('optNoDiarize'))
17
+ .option('--no-events', t('optNoEvents'))
18
+ .option('--optimize-zh', t('optOptimizeZh'))
19
+ .option('--beam-size <n>', t('optBeamSize'), parseInt)
20
+ .option('--temperature <n>', t('optTemperature'), parseFloat)
21
+ .option('--hotwords <words>', t('optHotwords'))
22
+ .option('--initial-prompt <text>', t('optInitialPrompt'))
23
+ .option('--vad-threshold <n>', t('optVadThreshold'), parseFloat)
24
+ .option('--vad-min-speech <ms>', t('optVadMinSpeech'), parseInt)
25
+ .option('--vad-min-silence <ms>', t('optVadMinSilence'), parseInt)
26
+ .option('--no-speech-threshold <n>', t('optNoSpeechThreshold'), parseFloat)
27
+ .option('--num-speakers <n>', t('optNumSpeakers'), parseInt)
28
+ .option('--min-speakers <n>', t('optMinSpeakers'), parseInt)
29
+ .option('--max-speakers <n>', t('optMaxSpeakers'), parseInt)
30
+ .option('--events-threshold <n>', t('optEventsThreshold'), parseFloat)
31
+ .option('--events-classes <classes>', t('optEventsClasses'))
32
+ .option('--batch', t('optBatch'))
33
+ .option('--callback-url <url>', t('optCallbackUrl'))
34
+ .option('--callback-secret <secret>', t('optCallbackSecret'))
35
+ .option('--no-wait', t('optNoWait'))
36
+ .option('--poll-interval <seconds>', t('optPollInterval'), parseFloat, 5)
37
+ .option('--json', t('optJson'))
38
+ .option('--output <file>', t('optOutput'))
39
39
  .action(async (source, opts) => {
40
40
  try {
41
41
  const client = createClient(program);
@@ -117,7 +117,7 @@ export function registerTranscribe(program) {
117
117
  process.exit(1);
118
118
  }
119
119
  } catch (err) {
120
- console.error(chalk.red(`Error: ${err.message}`));
120
+ console.error(chalk.red(`${t('error')}: ${err.message}`));
121
121
  process.exit(1);
122
122
  }
123
123
  });
package/lib/i18n.js CHANGED
@@ -2,13 +2,63 @@ const messages = {
2
2
  en: {
3
3
  // General
4
4
  apiKeyRequired: 'Error: API key required. Use --api-key or set AURALWISE_API_KEY environment variable.',
5
- // Transcribe
5
+ // Global options
6
+ optApiKey: 'API key (or set AURALWISE_API_KEY env)',
7
+ optBaseUrl: 'API base URL',
8
+ optLocale: 'UI language: en or zh (default: en)',
9
+
10
+ // Transcribe command
6
11
  submittingTask: 'Submitting task...',
7
12
  taskCreated: 'Task created',
8
13
  waitingTask: 'Waiting for task to complete...',
9
14
  taskCompleted: 'Task completed!',
10
15
  taskFailed: 'Task {status}: {error}',
11
16
  resultSaved: 'Result saved to {file}',
17
+ optBase64: 'Force base64 mode for local file upload',
18
+ optLanguage: 'ASR language (zh/en/ja/... or null for auto)',
19
+ optNoAsr: 'Disable ASR',
20
+ optNoDiarize: 'Disable speaker diarization',
21
+ optNoEvents: 'Disable audio event detection',
22
+ optOptimizeZh: 'Enable Chinese optimization mode',
23
+ optBeamSize: 'Beam search width',
24
+ optTemperature: 'Decoding temperature',
25
+ optHotwords: 'Hotwords (comma-separated)',
26
+ optInitialPrompt: 'Initial prompt text',
27
+ optVadThreshold: 'VAD threshold (0-1)',
28
+ optVadMinSpeech: 'Min speech duration in ms',
29
+ optVadMinSilence: 'Min silence duration in ms',
30
+ optNoSpeechThreshold: 'No-speech probability threshold',
31
+ optNumSpeakers: 'Fixed number of speakers',
32
+ optMinSpeakers: 'Minimum speakers for auto-detection',
33
+ optMaxSpeakers: 'Maximum speakers for auto-detection',
34
+ optEventsThreshold: 'Audio event confidence threshold',
35
+ optEventsClasses: 'Specific event classes (comma-separated)',
36
+ optBatch: 'Enable batch mode (lower priority)',
37
+ optCallbackUrl: 'Webhook callback URL',
38
+ optCallbackSecret: 'Webhook HMAC secret',
39
+ optNoWait: 'Submit and return immediately without polling',
40
+ optPollInterval: 'Polling interval in seconds',
41
+ optJson: 'Output as JSON',
42
+ optOutput: 'Save result to file',
43
+
44
+ // Tasks command
45
+ optStatus: 'Filter by status (pending/processing/done/failed/abandoned)',
46
+ optPage: 'Page number',
47
+ optPageSize: 'Items per page',
48
+ tableHeaderId: 'ID',
49
+ tableHeaderStatus: 'Status',
50
+ tableHeaderFilename: 'Filename',
51
+ tableHeaderCreated: 'Created',
52
+
53
+ // Delete command
54
+ optForce: 'Skip confirmation',
55
+
56
+ // Events command
57
+ optCategory: 'Filter by category',
58
+ optSearch: 'Search event name',
59
+ tableHeaderIndex: 'Index',
60
+ tableHeaderName: 'Name',
61
+
12
62
  // Result display
13
63
  audioDuration: 'Audio Duration',
14
64
  language: 'Language',
@@ -18,6 +68,7 @@ const messages = {
18
68
  speakerEmbeddings: 'Speaker Embeddings',
19
69
  segments: 'segments',
20
70
  dimVector: '-dim vector',
71
+
21
72
  // Task detail
22
73
  taskId: 'Task ID',
23
74
  status: 'Status',
@@ -31,19 +82,23 @@ const messages = {
31
82
  progress: 'Progress',
32
83
  error: 'Error',
33
84
  options: 'Options',
85
+
34
86
  // Tasks list
35
87
  noTasks: 'No tasks found.',
36
88
  total: 'Total',
37
89
  page: 'Page',
90
+
38
91
  // Delete
39
92
  taskDeleted: 'Task {id} deleted.',
40
93
  confirmDelete: 'Are you sure you want to delete task {id}?',
41
94
  deleteCancelled: 'Delete cancelled.',
95
+
42
96
  // Events
43
97
  totalClasses: 'Total event classes',
44
98
  category: 'Category',
45
99
  noEventsFound: 'No matching events found.',
46
- // Descriptions
100
+
101
+ // Command descriptions
47
102
  descMain: 'CLI for AuralWise audio intelligence API',
48
103
  descTranscribe: 'Submit an audio transcription task (URL or local file)',
49
104
  descTasks: 'List tasks',
@@ -55,13 +110,66 @@ const messages = {
55
110
  argTaskId: 'Task ID',
56
111
  },
57
112
  zh: {
113
+ // General
58
114
  apiKeyRequired: '错误:需要 API Key。请使用 --api-key 参数或设置 AURALWISE_API_KEY 环境变量。',
115
+ // Global options
116
+ optApiKey: 'API 密钥(或设置 AURALWISE_API_KEY 环境变量)',
117
+ optBaseUrl: 'API 基础 URL',
118
+ optLocale: '界面语言:en 或 zh(默认 en)',
119
+
120
+ // Transcribe command
59
121
  submittingTask: '提交任务中...',
60
122
  taskCreated: '任务已创建',
61
123
  waitingTask: '等待任务完成...',
62
124
  taskCompleted: '任务完成!',
63
125
  taskFailed: '任务{status}:{error}',
64
126
  resultSaved: '结果已保存到 {file}',
127
+ optBase64: '强制使用 Base64 模式上传本地文件',
128
+ optLanguage: 'ASR 识别语言(zh/en/ja/... 或留空自动检测)',
129
+ optNoAsr: '禁用语音转写',
130
+ optNoDiarize: '禁用说话人分离',
131
+ optNoEvents: '禁用声音事件检测',
132
+ optOptimizeZh: '启用中文精简模式',
133
+ optBeamSize: 'Beam Search 宽度',
134
+ optTemperature: '解码温度',
135
+ optHotwords: '热词(逗号分隔)',
136
+ optInitialPrompt: '初始提示文本',
137
+ optVadThreshold: 'VAD 语音检测阈值(0-1)',
138
+ optVadMinSpeech: '最短语音段时长(毫秒)',
139
+ optVadMinSilence: '最短静音间隔(毫秒)',
140
+ optNoSpeechThreshold: '无语音概率阈值',
141
+ optNumSpeakers: '固定说话人数',
142
+ optMinSpeakers: '自动检测最少说话人数',
143
+ optMaxSpeakers: '自动检测最多说话人数',
144
+ optEventsThreshold: '声音事件置信度阈值',
145
+ optEventsClasses: '指定事件类别(逗号分隔)',
146
+ optBatch: '启用批量模式(低优先级)',
147
+ optCallbackUrl: 'Webhook 回调 URL',
148
+ optCallbackSecret: 'Webhook HMAC 签名密钥',
149
+ optNoWait: '提交后立即返回,不等待完成',
150
+ optPollInterval: '轮询间隔(秒)',
151
+ optJson: '以 JSON 格式输出',
152
+ optOutput: '将结果保存到文件',
153
+
154
+ // Tasks command
155
+ optStatus: '按状态过滤(pending/processing/done/failed/abandoned)',
156
+ optPage: '页码',
157
+ optPageSize: '每页数量',
158
+ tableHeaderId: 'ID',
159
+ tableHeaderStatus: '状态',
160
+ tableHeaderFilename: '文件名',
161
+ tableHeaderCreated: '创建时间',
162
+
163
+ // Delete command
164
+ optForce: '跳过确认',
165
+
166
+ // Events command
167
+ optCategory: '按类别过滤',
168
+ optSearch: '搜索事件名称',
169
+ tableHeaderIndex: '序号',
170
+ tableHeaderName: '名称',
171
+
172
+ // Result display
65
173
  audioDuration: '音频时长',
66
174
  language: '语言',
67
175
  speakers: '说话人数',
@@ -70,6 +178,8 @@ const messages = {
70
178
  speakerEmbeddings: '声纹向量',
71
179
  segments: '段',
72
180
  dimVector: '维向量',
181
+
182
+ // Task detail
73
183
  taskId: '任务 ID',
74
184
  status: '状态',
75
185
  source: '来源',
@@ -82,15 +192,23 @@ const messages = {
82
192
  progress: '进度',
83
193
  error: '错误',
84
194
  options: '选项',
195
+
196
+ // Tasks list
85
197
  noTasks: '没有找到任务。',
86
198
  total: '总计',
87
199
  page: '页',
200
+
201
+ // Delete
88
202
  taskDeleted: '任务 {id} 已删除。',
89
203
  confirmDelete: '确定要删除任务 {id} 吗?',
90
204
  deleteCancelled: '已取消删除。',
205
+
206
+ // Events
91
207
  totalClasses: '事件类别总数',
92
208
  category: '类别',
93
209
  noEventsFound: '未找到匹配的事件。',
210
+
211
+ // Command descriptions
94
212
  descMain: 'AuralWise 语音智能 API 命令行工具',
95
213
  descTranscribe: '提交音频转写任务(URL 或本地文件)',
96
214
  descTasks: '列出任务',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auralwise_cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "CLI for AuralWise audio intelligence API - transcription, speaker diarization, audio event detection",
5
5
  "type": "module",
6
6
  "bin": {