@casatwy/deyo 0.1.0 → 0.1.3

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.
Files changed (3) hide show
  1. package/README.md +103 -38
  2. package/deyo.mjs +9 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # deyo
2
2
 
3
- `@casatwy/deyo` installs the `deyo` command for sending transcription jobs to Deyo from your terminal.
3
+ `deyo` 是 [https://deyo.miaobi.fun](https://deyo.miaobi.fun) 的命令行工具。你可以直接在终端里提交音视频链接进行转写,并把结果输出到终端或保存到本地文件。
4
4
 
5
- ## Install
5
+ 当前支持的来源包括小宇宙单集、B 站单视频和 YouTube 单视频。
6
+
7
+ ## 安装
8
+
9
+ 安装前请确认本机 Node.js 版本不低于 `18`。
6
10
 
7
11
  ```bash
8
12
  npm install -g @casatwy/deyo
@@ -12,89 +16,150 @@ npm install -g @casatwy/deyo
12
16
  pnpm add -g @casatwy/deyo
13
17
  ```
14
18
 
15
- ## First-time login
19
+ 安装完成后,可以先执行下面的命令确认 CLI 已可用:
20
+
21
+ ```bash
22
+ deyo --help
23
+ ```
24
+
25
+ ## 使用前准备
26
+
27
+ 在使用 CLI 之前,你需要先创建一个 Deyo API Key:
28
+
29
+ 1. 打开 `https://deyo.miaobi.fun/me/api-keys`
30
+ 2. 创建一个新的 API Key
31
+ 3. 复制这个 Key,后面登录 CLI 时会用到
32
+
33
+ `deyo` 默认连接正式服务 `https://deyo.miaobi.fun`,普通用户不需要额外配置服务地址。
34
+
35
+ ## 首次登录
16
36
 
17
- Create a Deyo API key from `https://deyo.miaobi.fun/me/api-keys`, then save it once locally:
37
+ 把 API Key 保存到本地后,后续就不需要每次转写时都重复传 `--api-key`。
18
38
 
19
39
  ```bash
20
40
  deyo auth login --api-key 'deyo_sk_xxx'
21
41
  ```
22
42
 
23
- Check whether the local config is active:
43
+ 查看当前本地登录状态:
24
44
 
25
45
  ```bash
26
46
  deyo auth status
27
47
  ```
28
48
 
29
- Remove the saved local config:
49
+ 如果你想清除本地保存的配置:
30
50
 
31
51
  ```bash
32
52
  deyo auth logout
33
53
  ```
34
54
 
35
- ## Usage
55
+ ## 快速开始
36
56
 
37
- The published CLI defaults to the production service at `https://deyo.miaobi.fun`.
57
+ 最简单的用法是直接给 `deyo` 一个链接:
38
58
 
39
- After `deyo auth login`, you can run transcription commands without repeating `--api-key`:
59
+ ```bash
60
+ deyo 'https://www.youtube.com/watch?v=xxxx'
61
+ ```
62
+
63
+ 这条命令会:
64
+
65
+ 1. 使用你本地已保存的 API Key
66
+ 2. 提交一个转写任务
67
+ 3. 在终端里持续显示任务进度
68
+ 4. 完成后直接把结果输出到终端
69
+
70
+ 如果你希望把结果保存到文件:
40
71
 
41
72
  ```bash
42
- deyo --language zh -O ./transcript.txt 'https://www.bilibili.com/video/BVxxxx'
73
+ deyo -O ./transcript.txt 'https://www.bilibili.com/video/BVxxxx'
43
74
  ```
44
75
 
76
+ ## 常见用法
77
+
78
+ 处理小宇宙单集并保存为文本:
79
+
45
80
  ```bash
46
- deyo --language zh --format srt -O ./transcript.srt 'https://www.youtube.com/watch?v=xxxx'
81
+ deyo -O ./episode.txt 'https://www.xiaoyuzhoufm.com/episode/xxxx'
47
82
  ```
48
83
 
84
+ 保存为普通文本:
85
+
49
86
  ```bash
50
- deyo --language en 'https://www.youtube.com/watch?v=xxxx'
87
+ deyo -O ./transcript.txt 'https://www.bilibili.com/video/BVxxxx'
51
88
  ```
52
89
 
53
- If you need local development, pass `--base-url` explicitly:
90
+ 导出为 `srt` 字幕文件:
54
91
 
55
92
  ```bash
56
- deyo auth login --api-key 'deyo_sk_xxx' --base-url 'http://deyo.mac-studio'
57
- deyo --base-url 'http://deyo.mac-studio' --language zh -O ./transcript.txt 'https://www.bilibili.com/video/BVxxxx'
93
+ deyo --format srt -O ./transcript.srt 'https://www.youtube.com/watch?v=xxxx'
58
94
  ```
59
95
 
60
- For a one-off override, `--api-key` still takes precedence over local config:
96
+ 如果输出文件名本身就是 `.srt`,也可以省略 `--format srt`,CLI 会自动识别格式。
97
+
98
+ 指定输出英文转写结果:
61
99
 
62
100
  ```bash
63
- deyo --api-key 'deyo_sk_other' --language zh 'https://www.youtube.com/watch?v=xxxx'
101
+ deyo --language en 'https://www.youtube.com/watch?v=xxxx'
64
102
  ```
65
103
 
66
- By default, the CLI requests Chinese output, which is equivalent to `--language zh`.
104
+ 如果某一次命令想临时使用另一个 API Key,可以直接显式传入:
67
105
 
68
- Run `deyo --help` to see the full argument list.
106
+ ```bash
107
+ deyo --api-key 'deyo_sk_other' 'https://www.youtube.com/watch?v=xxxx'
108
+ ```
69
109
 
70
- ## Install in AI tools
110
+ ## 常用参数
71
111
 
72
- The official install pages live at:
112
+ `--language <value>`
73
113
 
74
- - Codex: `https://deyo.miaobi.fun/ai/install/codex`
75
- - Claude: `https://deyo.miaobi.fun/ai/install/claude`
114
+ 指定转写语言。默认是 `zh`,也就是中文输出。也可以写 `en`,英文输出。
76
115
 
77
- These pages tell the AI how to install the `deyo` skill or plugin, ask for the user's API key once, and run `deyo auth login` locally.
116
+ `-O, --output <path>`
78
117
 
79
- ## Publish
118
+ 把结果写入文件。如果不传这个参数,结果会直接打印到终端。
80
119
 
81
- For maintainers, publish from the `cli_` directory:
120
+ `--format <value>`
82
121
 
83
- ```bash
84
- cd cli_
85
- make deploy
86
- ```
122
+ 指定结果格式,支持:
87
123
 
88
- If you need to publish a new version, pass it explicitly:
124
+ - `text`
125
+ - `srt`
126
+ - `vtt`
89
127
 
90
- ```bash
91
- cd cli_
92
- make deploy VERSION=0.1.1
93
- ```
128
+ 如果你已经通过 `-O` 指定了输出文件名,CLI 会根据扩展名自动推断常见格式:
129
+
130
+ - `.srt` 会自动使用 `srt`
131
+ - `.vtt` 会自动使用 `vtt`
132
+ - 其他情况默认使用 `text`
133
+
134
+ `--api-key <key>`
135
+
136
+ 为当前这一次命令临时指定 API Key。
137
+ 如果你已经执行过 `deyo auth login`,平时通常不需要再传。
138
+ 当它和本地已保存配置同时存在时,会优先使用这次命令里传入的 `--api-key`。
139
+
140
+ `-v, --version`
141
+
142
+ 打印当前 CLI 版本号并退出,适合快速确认本机装的是哪个版本。
143
+
144
+ ## 在 AI 工具中使用
145
+
146
+ 如果你希望让 AI 助手在你的本机环境里调用 `deyo`,可以参考官方安装页:
147
+
148
+ - Codex:[https://deyo.miaobi.fun/ai/install/codex](https://deyo.miaobi.fun/ai/install/codex)
149
+ - Claude:[https://deyo.miaobi.fun/ai/install/claude](https://deyo.miaobi.fun/ai/install/claude)
150
+
151
+ 这些页面面向普通用户,主要会指导 AI:
152
+
153
+ 1. 如何安装 `deyo` 的技能或插件
154
+ 2. 如何向你索取一次 API Key
155
+ 3. 如何在你的本地环境执行 `deyo auth login`
156
+
157
+ 完成后,你就可以让 AI 直接帮你调用 `deyo` 提交转写任务。
158
+
159
+ ## 更多帮助
94
160
 
95
- With npm 2FA enabled, pass the current OTP code explicitly:
161
+ 查看完整参数说明:
96
162
 
97
163
  ```bash
98
- cd cli_
99
- make deploy OTP=123456
164
+ deyo --help
100
165
  ```
package/deyo.mjs CHANGED
@@ -1,10 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { chmod, mkdir, readFile, rm, writeFile } from 'node:fs/promises'
4
+ import { createRequire } from 'node:module'
4
5
  import { dirname, extname, resolve } from 'node:path'
5
6
  import { homedir } from 'node:os'
6
7
  import process from 'node:process'
7
8
 
9
+ const CLI_VERSION = createRequire(import.meta.url)('./package.json').version
10
+
8
11
  const DEFAULT_BASE_URL = 'https://deyo.miaobi.fun'
9
12
  const DEFAULT_LANGUAGE = 'zh'
10
13
  const POLL_INTERVAL_MS = 1500
@@ -37,6 +40,7 @@ function printUsage() {
37
40
  --format <value> 可选,text | srt | vtt | json | verbose_json
38
41
  --base-url <url> 可选,默认 ${DEFAULT_BASE_URL}
39
42
  -h, --help 显示帮助
43
+ -v, --version 显示 CLI 版本
40
44
 
41
45
  auth 子命令:
42
46
  deyo auth login --api-key <key> [--base-url <url>]
@@ -825,6 +829,11 @@ async function main() {
825
829
  const argv = process.argv.slice(2)
826
830
  const primaryCommand = argv[0]
827
831
 
832
+ if (primaryCommand === '-v' || primaryCommand === '--version') {
833
+ process.stdout.write(`${CLI_VERSION}\n`)
834
+ return
835
+ }
836
+
828
837
  if (!primaryCommand || primaryCommand === '-h' || primaryCommand === '--help') {
829
838
  printUsage()
830
839
  return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casatwy/deyo",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "CLI for submitting Deyo transcription jobs from the terminal",
5
5
  "homepage": "https://deyo.miaobi.fun/docs",
6
6
  "license": "UNLICENSED",