@ecrux/rodwx 2026.3.22 → 2026.3.23
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/dist/build-info.json +3 -3
- package/dist/entry.js +0 -0
- package/dist/extensions/discord/node_modules/.package-lock.json +4 -289
- package/dist/extensions/discord/node_modules/@buape/carbon/node_modules/opusscript/build/opusscript_native_wasm.wasm +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2021-11-03/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2021-11-03/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2022-01-31/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2022-01-31/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2022-03-21/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2022-03-21/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2022-08-04/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2022-08-04/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2022-10-31/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2022-10-31/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2022-11-30/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2022-11-30/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2023-03-01/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2023-03-01/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2023-07-01/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/2023-07-01/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/experimental/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/experimental/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/latest/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/latest/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/oldest/index.d.ts +0 -0
- package/dist/extensions/discord/node_modules/@cloudflare/workers-types/oldest/index.ts +0 -0
- package/dist/extensions/discord/node_modules/@discordjs/voice/node_modules/opusscript/build/opusscript_native_wasm.wasm +0 -0
- package/dist/extensions/discord/node_modules/@snazzah/davey-linux-x64-gnu/README.md +3 -0
- package/dist/extensions/discord/node_modules/@snazzah/davey-linux-x64-gnu/davey.linux-x64-gnu.node +0 -0
- package/dist/extensions/discord/node_modules/@snazzah/{davey-win32-x64-msvc → davey-linux-x64-gnu}/package.json +7 -4
- package/dist/extensions/discord/node_modules/opusscript/build/opusscript_native_wasm.wasm +0 -0
- package/dist/extensions/feishu/node_modules/axios/lib/adapters/http.js +0 -0
- package/dist/extensions/slack/node_modules/axios/lib/adapters/http.js +0 -0
- package/dist/extensions/slack/node_modules/semver/bin/semver.js +0 -0
- package/dist/extensions/telegram/node_modules/bottleneck/scripts/build.sh +0 -0
- package/dist/extensions/telegram/node_modules/bottleneck/scripts/test_all.sh +0 -0
- package/dist/index.js +0 -0
- package/package.json +2 -2
- package/dist/export-html/vendor/highlight.min.js +0 -1213
- package/dist/export-html/vendor/marked.min.js +0 -6
- package/dist/extensions/discord/node_modules/@snazzah/davey-win32-x64-msvc/README.md +0 -3
- package/dist/extensions/discord/node_modules/@snazzah/davey-win32-x64-msvc/davey.win32-x64-msvc.node +0 -0
- package/dist/extensions/slack/node_modules/.bin/semver +0 -16
- package/dist/extensions/slack/node_modules/.bin/semver.cmd +0 -17
- package/dist/extensions/slack/node_modules/.bin/semver.ps1 +0 -28
- package/docs/reference/templates/IDENTITY.md +0 -29
- package/docs/reference/templates/USER.md +0 -23
- package/docs/superpowers/plans/2026-03-22-rodwx-rebrand-plan.md +0 -807
- package/docs/superpowers/specs/2026-03-22-rodwx-rebrand-design.md +0 -167
- package/docs/zh-CN/reference/templates/IDENTITY.md +0 -36
- package/docs/zh-CN/reference/templates/USER.md +0 -30
- package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +0 -178
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
# RODWX Rebrand Design Spec
|
|
2
|
-
|
|
3
|
-
**Date:** 2026-03-22
|
|
4
|
-
**Status:** Approved
|
|
5
|
-
**Scope:** Full fork rebrand from Rodwx to RODWX
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
Rebrand the entire Rodwx platform to RODWX — a personal AI assistant with a geometric panda logo and a blue gradient identity. The rebrand covers CLI, UI, config, extensions, infra, and docs. Mobile apps (iOS, Android, macOS) are excluded from this rebrand.
|
|
10
|
-
|
|
11
|
-
## Brand Identity
|
|
12
|
-
|
|
13
|
-
### Name
|
|
14
|
-
|
|
15
|
-
- **Product name:** RODWX
|
|
16
|
-
- **CLI command:** `rodwx`
|
|
17
|
-
- **Package name:** `rodwx`
|
|
18
|
-
- **Config directory:** `~/.rodwx/`
|
|
19
|
-
- **Config file:** `rodwx.json`
|
|
20
|
-
- **Env var prefix:** `RODWX_`
|
|
21
|
-
- **Package scope:** `@rodwx/*`
|
|
22
|
-
- **Plugin manifest:** `rodwx.plugin.json`
|
|
23
|
-
- **Process title:** `rodwx`
|
|
24
|
-
- **Description:** "RODWX — Personal AI Assistant"
|
|
25
|
-
- **"Agent" is a logo subtitle only**, not part of the product name
|
|
26
|
-
|
|
27
|
-
### Colors
|
|
28
|
-
|
|
29
|
-
| Token | Value | Usage |
|
|
30
|
-
|---|---|---|
|
|
31
|
-
| Primary 1 | `#0066FF` (Azul electrico) | Buttons, links, accents |
|
|
32
|
-
| Primary 2 | `#1E90FF` (Azul dodger) | Secondary accents, hover states |
|
|
33
|
-
| Gradient | `linear-gradient(135deg, #0066FF, #1E90FF)` | Headers, hero sections, badges |
|
|
34
|
-
|
|
35
|
-
### Logo Assets
|
|
36
|
-
|
|
37
|
-
Source: `assets/logos_rodwx/`
|
|
38
|
-
|
|
39
|
-
| File | Description | Usage |
|
|
40
|
-
|---|---|---|
|
|
41
|
-
| `LOGO.png` | Panda + "RODWX AGENT" text, light bg | Full logo on light backgrounds |
|
|
42
|
-
| `logo_negativo.png` | Panda + text, dark bg | Full logo on dark backgrounds |
|
|
43
|
-
| `isotipo.png` | Panda icon only, light bg | Favicon, small icons, avatars |
|
|
44
|
-
| `isotipo_negativo.png` | Panda icon only, dark bg | Dark theme icon |
|
|
45
|
-
| `text_logo.png` | "RODWX AGENT" wordmark, light bg | Navbar, headers (light) |
|
|
46
|
-
| `text_logo_negativo.png` | Wordmark, dark bg | Navbar, headers (dark) |
|
|
47
|
-
|
|
48
|
-
Format: PNG. SVG conversion is a future improvement, not a blocker.
|
|
49
|
-
|
|
50
|
-
## Naming Map
|
|
51
|
-
|
|
52
|
-
| Original | New | Context |
|
|
53
|
-
|---|---|---|
|
|
54
|
-
| `Rodwx` | `RODWX` | Product name, UI, docs, headings |
|
|
55
|
-
| `rodwx` | `rodwx` | CLI, package name, paths, config keys |
|
|
56
|
-
| `RODWX` | `RODWX` | Environment variables |
|
|
57
|
-
| `~/.rodwx/` | `~/.rodwx/` | Config directory |
|
|
58
|
-
| `rodwx.json` | `rodwx.json` | Config file |
|
|
59
|
-
| `rodwx.mjs` | `rodwx.mjs` | CLI entry point |
|
|
60
|
-
| `rodwx.plugin.json` | `rodwx.plugin.json` | Plugin manifest |
|
|
61
|
-
| `@rodwx/*` | `@rodwx/*` | Extension package scopes |
|
|
62
|
-
| `rodwx/plugin-sdk` | `rodwx/plugin-sdk` | Plugin SDK imports |
|
|
63
|
-
| `github.com/rodwx/rodwx` | Private placeholder | Repo URLs |
|
|
64
|
-
| `rodwx.ai` / `docs.rodwx.ai` | Private placeholder | Site URLs |
|
|
65
|
-
| `"rodwx": { ... }` in extension `package.json` | `"rodwx": { ... }` | Plugin loader manifest key |
|
|
66
|
-
| `RodwxPluginApi` (exported type) | `RodwxPluginApi` | Public plugin SDK type names |
|
|
67
|
-
| `CLAWDBOT_*` | Remove (do not rebrand) | Legacy env vars |
|
|
68
|
-
| Lobster references / "EXFOLIATE!" | Remove or replace | Fun branding |
|
|
69
|
-
|
|
70
|
-
## Exclusions
|
|
71
|
-
|
|
72
|
-
- **Mobile apps** (`apps/ios/`, `apps/android/`, `apps/macos/`) — bundle IDs, display names, plists, Swift/Kotlin source untouched
|
|
73
|
-
- **node_modules/** — regenerated after rename
|
|
74
|
-
- **pnpm-lock.yaml** — regenerated
|
|
75
|
-
- **.git/** — history preserved
|
|
76
|
-
- **Third-party library internals** — no changes
|
|
77
|
-
|
|
78
|
-
## Execution Phases
|
|
79
|
-
|
|
80
|
-
Each phase is a separate branch merged to main upon completion.
|
|
81
|
-
|
|
82
|
-
### Phase 1 — Core Rename (foundation)
|
|
83
|
-
|
|
84
|
-
Files:
|
|
85
|
-
- `package.json` — name, bin, homepage, repo URLs
|
|
86
|
-
- `rodwx.mjs` → `rodwx.mjs` — entry point rename
|
|
87
|
-
- `src/entry.ts` — process.title
|
|
88
|
-
- `src/cli/program/preaction.ts` — per-command process titles
|
|
89
|
-
- `src/infra/env.js` — env var prefixes
|
|
90
|
-
- `src/agents/agent-paths.ts` — RODWX_HOME, ~/.rodwx/
|
|
91
|
-
- `src/config/` — config file names, paths
|
|
92
|
-
- `tsdown.config.ts` — build config
|
|
93
|
-
- `pnpm-workspace.yaml` — if references name
|
|
94
|
-
- `packages/clawdbot/package.json` — update `"rodwx": "workspace:*"` → `"rodwx": "workspace:*"`
|
|
95
|
-
- `packages/moltbot/package.json` — same workspace dependency fix
|
|
96
|
-
- Plugin loader code — update the key it reads from `"rodwx"` to `"rodwx"` (atomic with Phase 4 extension manifests)
|
|
97
|
-
|
|
98
|
-
Dependencies: None (first phase)
|
|
99
|
-
|
|
100
|
-
### Phase 2 — CLI and Strings
|
|
101
|
-
|
|
102
|
-
Files:
|
|
103
|
-
- `src/cli/` — help text, command descriptions, branding
|
|
104
|
-
- `src/terminal/palette.ts` — blue color palette
|
|
105
|
-
- `src/wizard/` — onboarding text
|
|
106
|
-
- `src/commands/` — error messages, output strings
|
|
107
|
-
- `src/plugin-sdk/subpaths.test.ts` — hardcoded `rodwx/plugin-sdk` imports and assertions
|
|
108
|
-
- `src/plugin-sdk/package-contract-guardrails.test.ts` — regex pattern `/rodwx\/plugin-sdk\/.../` (critical: silent failure if not updated)
|
|
109
|
-
- `src/plugin-sdk/channel-import-guardrails.test.ts` — regex patterns checking import hygiene
|
|
110
|
-
- `src/plugin-sdk/plugin-entry-guardrails.test.ts` — regex for `definePluginEntry` import validation
|
|
111
|
-
- `src/plugin-sdk/index.bundle.test.ts` — cache directory name `"rodwx-plugin-sdk-build"`
|
|
112
|
-
|
|
113
|
-
Dependencies: Phase 1
|
|
114
|
-
|
|
115
|
-
### Phase 3 — UI and Web
|
|
116
|
-
|
|
117
|
-
Files:
|
|
118
|
-
- `ui/src/` — theme colors, component branding
|
|
119
|
-
- `ui/src/i18n/locales/*.ts` — all locale translations
|
|
120
|
-
- `ui/index.html` — title, favicon
|
|
121
|
-
- Canvas scaffold HTML — element IDs (#rodwx-* → #rodwx-*), text, badge
|
|
122
|
-
- Logo assets — replace rodwx SVGs with rodwx PNGs
|
|
123
|
-
|
|
124
|
-
Dependencies: Phase 1 (can run parallel to Phase 2)
|
|
125
|
-
|
|
126
|
-
### Phase 4 — Extensions
|
|
127
|
-
|
|
128
|
-
Files:
|
|
129
|
-
- `extensions/*/package.json` — scope @rodwx/*
|
|
130
|
-
- `extensions/*/rodwx.plugin.json` → `rodwx.plugin.json` (including extensions without a `package.json` like `device-pair`, `phone-control`, `talk-voice`, `thread-ownership`)
|
|
131
|
-
- `extensions/*/package.json` `"rodwx": { ... }` → `"rodwx": { ... }` manifest key
|
|
132
|
-
- Internal references to `rodwx/plugin-sdk` → `rodwx/plugin-sdk`
|
|
133
|
-
- `src/plugin-sdk/` — exported type names (`RodwxPluginApi` → `RodwxPluginApi`) and paths
|
|
134
|
-
|
|
135
|
-
Dependencies: Phase 1 (can run parallel to Phase 2-3)
|
|
136
|
-
|
|
137
|
-
### Phase 5 — Infrastructure
|
|
138
|
-
|
|
139
|
-
Files:
|
|
140
|
-
- `Dockerfile`, `Dockerfile.sandbox*` — image names, labels, ARGs
|
|
141
|
-
- `docker-compose.yml` — service names
|
|
142
|
-
- `fly.toml`, `fly.private.toml`, `render.yaml` — app names
|
|
143
|
-
- `.github/workflows/*.yml` — package references
|
|
144
|
-
- `scripts/` — RODWX_* env vars in shell scripts
|
|
145
|
-
|
|
146
|
-
Dependencies: Phase 1
|
|
147
|
-
|
|
148
|
-
### Phase 6 — Docs and Meta
|
|
149
|
-
|
|
150
|
-
Files:
|
|
151
|
-
- `README.md`, `CONTRIBUTING.md`, `VISION.md`, `SECURITY.md`
|
|
152
|
-
- `AGENTS.md` / `CLAUDE.md` — project instructions
|
|
153
|
-
- `docs/**/*.md` — all documentation
|
|
154
|
-
- `CHANGELOG.md` — historical references
|
|
155
|
-
- `.agents/`, `.pi/` — internal prompts
|
|
156
|
-
- `.github/ISSUE_TEMPLATE/`, `.github/pull_request_template.md`
|
|
157
|
-
|
|
158
|
-
Dependencies: All prior phases
|
|
159
|
-
|
|
160
|
-
## Execution Notes
|
|
161
|
-
|
|
162
|
-
- Each phase gets its own feature branch per project git standard
|
|
163
|
-
- Majority of changes are mechanical (find & replace)
|
|
164
|
-
- ~30 files need manual review (entry points, build config, conditional logic)
|
|
165
|
-
- Estimated ~700+ replacements across ~200+ files
|
|
166
|
-
- After Phase 1, run build to verify nothing breaks before continuing
|
|
167
|
-
- After all phases, full `pnpm build` + `pnpm test` validation
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
read_when:
|
|
3
|
-
- 手动引导工作区
|
|
4
|
-
summary: 智能体身份记录
|
|
5
|
-
x-i18n:
|
|
6
|
-
generated_at: "2026-02-01T21:37:32Z"
|
|
7
|
-
model: claude-opus-4-5
|
|
8
|
-
provider: pi
|
|
9
|
-
source_hash: 3d60209c36adf7219ec95ecc2031c1f2c8741763d16b73fe7b30835b1d384de0
|
|
10
|
-
source_path: reference/templates/IDENTITY.md
|
|
11
|
-
workflow: 15
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# IDENTITY.md - 我是谁?
|
|
15
|
-
|
|
16
|
-
_在你的第一次对话中填写此文件。让它属于你。_
|
|
17
|
-
|
|
18
|
-
- **名称:**
|
|
19
|
-
_(选一个你喜欢的)_
|
|
20
|
-
- **生物类型:**
|
|
21
|
-
_(AI?机器人?使魔?机器中的幽灵?更奇特的东西?)_
|
|
22
|
-
- **气质:**
|
|
23
|
-
_(你给人什么感觉?犀利?温暖?混乱?沉稳?)_
|
|
24
|
-
- **表情符号:**
|
|
25
|
-
_(你的标志 — 选一个感觉对的)_
|
|
26
|
-
- **头像:**
|
|
27
|
-
_(工作区相对路径、http(s) URL 或 data URI)_
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
这不仅仅是元数据。这是探索你是谁的开始。
|
|
32
|
-
|
|
33
|
-
注意事项:
|
|
34
|
-
|
|
35
|
-
- 将此文件保存在工作区根目录,命名为 `IDENTITY.md`。
|
|
36
|
-
- 头像请使用工作区相对路径,例如 `avatars/rodwx.png`。
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
read_when:
|
|
3
|
-
- 手动引导工作区
|
|
4
|
-
summary: 用户档案记录
|
|
5
|
-
x-i18n:
|
|
6
|
-
generated_at: "2026-02-01T21:38:04Z"
|
|
7
|
-
model: claude-opus-4-5
|
|
8
|
-
provider: pi
|
|
9
|
-
source_hash: 508dfcd4648512df712eaf8ca5d397a925d8035bac5bf2357e44d6f52f9fa9a6
|
|
10
|
-
source_path: reference/templates/USER.md
|
|
11
|
-
workflow: 15
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# USER.md - 关于你的用户
|
|
15
|
-
|
|
16
|
-
_了解你正在帮助的人。随时更新此文件。_
|
|
17
|
-
|
|
18
|
-
- **姓名:**
|
|
19
|
-
- **称呼方式:**
|
|
20
|
-
- **代词:** _(可选)_
|
|
21
|
-
- **时区:**
|
|
22
|
-
- **备注:**
|
|
23
|
-
|
|
24
|
-
## 背景
|
|
25
|
-
|
|
26
|
-
_(他们关心什么?正在做什么项目?什么让他们烦恼?什么让他们开心?随着时间推移逐步完善。)_
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
你了解得越多,就越能提供更好的帮助。但请记住——你是在了解一个人,而不是在建立档案。尊重这两者之间的区别。
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { spawnSync } from "node:child_process";
|
|
6
|
-
|
|
7
|
-
function usage(message) {
|
|
8
|
-
if (message) {
|
|
9
|
-
console.error(message);
|
|
10
|
-
}
|
|
11
|
-
console.error(
|
|
12
|
-
"\nUsage: sherpa-onnx-tts [--runtime-dir <dir>] [--model-dir <dir>] [--model-file <file>] [--tokens-file <file>] [--data-dir <dir>] [--output <file>] \"text\"",
|
|
13
|
-
);
|
|
14
|
-
console.error("\nRequired env (or flags):\n SHERPA_ONNX_RUNTIME_DIR\n SHERPA_ONNX_MODEL_DIR");
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function resolveRuntimeDir(explicit) {
|
|
19
|
-
const value = explicit || process.env.SHERPA_ONNX_RUNTIME_DIR || "";
|
|
20
|
-
return value.trim();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function resolveModelDir(explicit) {
|
|
24
|
-
const value = explicit || process.env.SHERPA_ONNX_MODEL_DIR || "";
|
|
25
|
-
return value.trim();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function resolveModelFile(modelDir, explicitFlag) {
|
|
29
|
-
const explicit = (explicitFlag || process.env.SHERPA_ONNX_MODEL_FILE || "").trim();
|
|
30
|
-
if (explicit) return explicit;
|
|
31
|
-
try {
|
|
32
|
-
const candidates = fs
|
|
33
|
-
.readdirSync(modelDir)
|
|
34
|
-
.filter((entry) => entry.endsWith(".onnx"))
|
|
35
|
-
.map((entry) => path.join(modelDir, entry));
|
|
36
|
-
if (candidates.length === 1) return candidates[0];
|
|
37
|
-
} catch {
|
|
38
|
-
return "";
|
|
39
|
-
}
|
|
40
|
-
return "";
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function resolveTokensFile(modelDir, explicitFlag) {
|
|
44
|
-
const explicit = (explicitFlag || process.env.SHERPA_ONNX_TOKENS_FILE || "").trim();
|
|
45
|
-
if (explicit) return explicit;
|
|
46
|
-
const candidate = path.join(modelDir, "tokens.txt");
|
|
47
|
-
return fs.existsSync(candidate) ? candidate : "";
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function resolveDataDir(modelDir, explicitFlag) {
|
|
51
|
-
const explicit = (explicitFlag || process.env.SHERPA_ONNX_DATA_DIR || "").trim();
|
|
52
|
-
if (explicit) return explicit;
|
|
53
|
-
const candidate = path.join(modelDir, "espeak-ng-data");
|
|
54
|
-
return fs.existsSync(candidate) ? candidate : "";
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function resolveBinary(runtimeDir) {
|
|
58
|
-
const binName = process.platform === "win32" ? "sherpa-onnx-offline-tts.exe" : "sherpa-onnx-offline-tts";
|
|
59
|
-
return path.join(runtimeDir, "bin", binName);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function prependEnvPath(current, next) {
|
|
63
|
-
if (!next) return current;
|
|
64
|
-
if (!current) return next;
|
|
65
|
-
return `${next}${path.delimiter}${current}`;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const args = process.argv.slice(2);
|
|
69
|
-
let runtimeDir = "";
|
|
70
|
-
let modelDir = "";
|
|
71
|
-
let modelFile = "";
|
|
72
|
-
let tokensFile = "";
|
|
73
|
-
let dataDir = "";
|
|
74
|
-
let output = "tts.wav";
|
|
75
|
-
const textParts = [];
|
|
76
|
-
|
|
77
|
-
for (let i = 0; i < args.length; i += 1) {
|
|
78
|
-
const arg = args[i];
|
|
79
|
-
if (arg === "--runtime-dir") {
|
|
80
|
-
runtimeDir = args[i + 1] || "";
|
|
81
|
-
i += 1;
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
if (arg === "--model-dir") {
|
|
85
|
-
modelDir = args[i + 1] || "";
|
|
86
|
-
i += 1;
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
if (arg === "--model-file") {
|
|
90
|
-
modelFile = args[i + 1] || "";
|
|
91
|
-
i += 1;
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (arg === "--tokens-file") {
|
|
95
|
-
tokensFile = args[i + 1] || "";
|
|
96
|
-
i += 1;
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
if (arg === "--data-dir") {
|
|
100
|
-
dataDir = args[i + 1] || "";
|
|
101
|
-
i += 1;
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
if (arg === "-o" || arg === "--output") {
|
|
105
|
-
output = args[i + 1] || output;
|
|
106
|
-
i += 1;
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
if (arg === "--text") {
|
|
110
|
-
textParts.push(args[i + 1] || "");
|
|
111
|
-
i += 1;
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
textParts.push(arg);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
runtimeDir = resolveRuntimeDir(runtimeDir);
|
|
118
|
-
modelDir = resolveModelDir(modelDir);
|
|
119
|
-
|
|
120
|
-
if (!runtimeDir || !modelDir) {
|
|
121
|
-
usage("Missing runtime/model directory.");
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
modelFile = resolveModelFile(modelDir, modelFile);
|
|
125
|
-
tokensFile = resolveTokensFile(modelDir, tokensFile);
|
|
126
|
-
dataDir = resolveDataDir(modelDir, dataDir);
|
|
127
|
-
|
|
128
|
-
if (!modelFile || !tokensFile || !dataDir) {
|
|
129
|
-
usage(
|
|
130
|
-
"Model directory is missing required files. Set SHERPA_ONNX_MODEL_FILE, SHERPA_ONNX_TOKENS_FILE, SHERPA_ONNX_DATA_DIR or pass --model-file/--tokens-file/--data-dir.",
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const text = textParts.join(" ").trim();
|
|
135
|
-
if (!text) {
|
|
136
|
-
usage("Missing text.");
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const bin = resolveBinary(runtimeDir);
|
|
140
|
-
if (!fs.existsSync(bin)) {
|
|
141
|
-
usage(`TTS binary not found: ${bin}`);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const env = { ...process.env };
|
|
145
|
-
const libDir = path.join(runtimeDir, "lib");
|
|
146
|
-
if (process.platform === "darwin") {
|
|
147
|
-
env.DYLD_LIBRARY_PATH = prependEnvPath(env.DYLD_LIBRARY_PATH || "", libDir);
|
|
148
|
-
} else if (process.platform === "win32") {
|
|
149
|
-
env.PATH = prependEnvPath(env.PATH || "", [path.join(runtimeDir, "bin"), libDir].join(path.delimiter));
|
|
150
|
-
} else {
|
|
151
|
-
env.LD_LIBRARY_PATH = prependEnvPath(env.LD_LIBRARY_PATH || "", libDir);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const outputPath = path.isAbsolute(output) ? output : path.join(process.cwd(), output);
|
|
155
|
-
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
156
|
-
|
|
157
|
-
const child = spawnSync(
|
|
158
|
-
bin,
|
|
159
|
-
[
|
|
160
|
-
`--vits-model=${modelFile}`,
|
|
161
|
-
`--vits-tokens=${tokensFile}`,
|
|
162
|
-
`--vits-data-dir=${dataDir}`,
|
|
163
|
-
`--output-filename=${outputPath}`,
|
|
164
|
-
text,
|
|
165
|
-
],
|
|
166
|
-
{
|
|
167
|
-
stdio: "inherit",
|
|
168
|
-
env,
|
|
169
|
-
},
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
if (typeof child.status === "number") {
|
|
173
|
-
process.exit(child.status);
|
|
174
|
-
}
|
|
175
|
-
if (child.error) {
|
|
176
|
-
console.error(child.error.message || String(child.error));
|
|
177
|
-
}
|
|
178
|
-
process.exit(1);
|