From c3c56b9a74115befca2812c940dbfb8be27148b7 Mon Sep 17 00:00:00 2001 From: wantsong Date: Mon, 15 Jun 2026 06:45:39 +0800 Subject: [PATCH] feat: migrate voice-generation skill --- environment.yml | 1 + registry/skills-index.md | 1 + skills/voice-generation/.gitignore | 14 + skills/voice-generation/INSTALL.md | 77 +++ skills/voice-generation/MIGRATION.md | 70 +++ skills/voice-generation/README.md | 114 +++++ skills/voice-generation/SKILL.md | 77 +++ .../docs/examples/sample-script.md | 9 + skills/voice-generation/pyproject.toml | 23 + skills/voice-generation/scripts/.gitkeep | 0 .../src/voice_gen/__init__.py | 1 + .../src/voice_gen/__main__.py | 6 + skills/voice-generation/src/voice_gen/cli.py | 479 ++++++++++++++++++ .../voice-generation/src/voice_gen/errors.py | 26 + .../src/voice_gen/extractor.py | 60 +++ .../src/voice_gen/registry.py | 68 +++ .../src/voice_gen/synthesizer.py | 106 ++++ skills/voice-generation/tests/__init__.py | 0 skills/voice-generation/tests/conftest.py | 34 ++ skills/voice-generation/tests/test_cli.py | 300 +++++++++++ skills/voice-generation/tests/test_errors.py | 22 + .../voice-generation/tests/test_extractor.py | 100 ++++ .../voice-generation/tests/test_registry.py | 76 +++ skills/voice-generation/tests/test_smoke.py | 41 ++ .../tests/test_synthesizer.py | 61 +++ 25 files changed, 1766 insertions(+) create mode 100644 skills/voice-generation/.gitignore create mode 100644 skills/voice-generation/INSTALL.md create mode 100644 skills/voice-generation/MIGRATION.md create mode 100644 skills/voice-generation/README.md create mode 100644 skills/voice-generation/SKILL.md create mode 100644 skills/voice-generation/docs/examples/sample-script.md create mode 100644 skills/voice-generation/pyproject.toml create mode 100644 skills/voice-generation/scripts/.gitkeep create mode 100644 skills/voice-generation/src/voice_gen/__init__.py create mode 100644 skills/voice-generation/src/voice_gen/__main__.py create mode 100644 skills/voice-generation/src/voice_gen/cli.py create mode 100644 skills/voice-generation/src/voice_gen/errors.py create mode 100644 skills/voice-generation/src/voice_gen/extractor.py create mode 100644 skills/voice-generation/src/voice_gen/registry.py create mode 100644 skills/voice-generation/src/voice_gen/synthesizer.py create mode 100644 skills/voice-generation/tests/__init__.py create mode 100644 skills/voice-generation/tests/conftest.py create mode 100644 skills/voice-generation/tests/test_cli.py create mode 100644 skills/voice-generation/tests/test_errors.py create mode 100644 skills/voice-generation/tests/test_extractor.py create mode 100644 skills/voice-generation/tests/test_registry.py create mode 100644 skills/voice-generation/tests/test_smoke.py create mode 100644 skills/voice-generation/tests/test_synthesizer.py diff --git a/environment.yml b/environment.yml index f96cee2..5cfe929 100644 --- a/environment.yml +++ b/environment.yml @@ -4,3 +4,4 @@ channels: dependencies: - python=3.11 - pip + - pytest>=7.0 diff --git a/registry/skills-index.md b/registry/skills-index.md index e3222bf..3a0fca7 100644 --- a/registry/skills-index.md +++ b/registry/skills-index.md @@ -14,6 +14,7 @@ Existing CCPE content is not migrated here. | Skill | Purpose | Source | Status | Install Policy | Installed Path | CCPE Registration | | --- | --- | --- | --- | --- | --- | --- | | `fix-title` | Shift Markdown ATX heading depth for pasted LLM replies before insertion under parent sections. | `C:\Users\wangq\Documents\Codex\knowledge-vault\skills\fix-title` | `installed` | `default` | `C:\Users\wangq\.agents\skills\fix-title` | none | +| `voice-generation` | Generate spoken audio from Markdown scripts using the local `voice-gen` CLI and MiniMax `mmx`, including custom voice clone registration and voice registry management. | `D:\AI\ClaudeCode\voice-ge` | `installed` | `conditional` | `C:\Users\wangq\.agents\skills\voice-generation` | none | ## Status Values diff --git a/skills/voice-generation/.gitignore b/skills/voice-generation/.gitignore new file mode 100644 index 0000000..ae75910 --- /dev/null +++ b/skills/voice-generation/.gitignore @@ -0,0 +1,14 @@ +# Python +__pycache__/ +*.py[cod] +*.egg-info/ +.pytest_cache/ +.venv/ +venv/ + +# Project: keep registry out of git, keep outputs out of git +voices.json +output/* +!output/.gitkeep +scripts/* +!scripts/.gitkeep diff --git a/skills/voice-generation/INSTALL.md b/skills/voice-generation/INSTALL.md new file mode 100644 index 0000000..769d89c --- /dev/null +++ b/skills/voice-generation/INSTALL.md @@ -0,0 +1,77 @@ +# Install voice-generation + +`voice-generation` provides the `voice-gen` Python CLI and a Skill wrapper for Agentic tools. + +## Conda Environment + +Use the repository-level `skills-vault` Conda environment. + +```powershell +conda env create -f environment.yml +conda activate skills-vault +``` + +If the environment already exists: + +```powershell +conda activate skills-vault +``` + +This Skill does not currently require a dedicated Conda environment. Create one only if future dependencies conflict with the shared `skills-vault` environment. + +## Install Python Package + +From the repository root: + +```powershell +pip install -e .\skills\voice-generation +``` + +If the current shell has not activated the environment, use the environment Python directly: + +```powershell +C:\Users\wangq\.conda\envs\skills-vault\python.exe -m pip install -e .\skills\voice-generation +``` + +## External Requirements + +Install and authenticate MiniMax `mmx`: + +```powershell +npm install -g mmx-cli +mmx auth login +``` + +## Install Skill Wrapper + +Use the repository installer from the repository root: + +```powershell +powershell -ExecutionPolicy Bypass -File .\scripts\install-skill.ps1 -Skill voice-generation +``` + +Replace an existing installed copy after backing it up: + +```powershell +powershell -ExecutionPolicy Bypass -File .\scripts\install-skill.ps1 -Skill voice-generation -Force -InstallClaudeLink +``` + +## Test + +Testing is intentionally separate from migration. + +Run unit tests only after installation is ready: + +```powershell +New-Item -ItemType Directory -Force -Path .\tmp | Out-Null +python -m pytest .\skills\voice-generation\tests --basetemp .\tmp\pytest-voice-generation +``` + +Or without activating the environment: + +```powershell +New-Item -ItemType Directory -Force -Path .\tmp | Out-Null +C:\Users\wangq\.conda\envs\skills-vault\python.exe -m pytest .\skills\voice-generation\tests --basetemp .\tmp\pytest-voice-generation +``` + +Smoke tests may call real MiniMax services and consume quota. Do not run them unless explicitly requested. diff --git a/skills/voice-generation/MIGRATION.md b/skills/voice-generation/MIGRATION.md new file mode 100644 index 0000000..dd7a674 --- /dev/null +++ b/skills/voice-generation/MIGRATION.md @@ -0,0 +1,70 @@ +# voice-generation Migration + +## Source + +```text +D:\AI\ClaudeCode\voice-ge +``` + +## Target + +```text +C:\Users\wangq\Documents\Codex\skills-vault\skills\voice-generation +``` + +## Naming Decision + +The vault Skill name is `voice-generation`. + +The Python package and command remain `voice-gen`: + +```text +package: voice-gen +module: voice_gen +command: voice-gen +``` + +This preserves the existing CLI while giving the vault Skill a descriptive repository name. + +## Migrated + +```text +README.md +pyproject.toml +docs/ +scripts/ +src/ +tests/ +``` + +## Excluded + +```text +.git/ +.pytest_cache/ +.claude/settings.local.json +output/ +plan.md +environment.yml +install-skill.ps1 +install-skill.sh +``` + +## Status + +```text +migration status: source-migrated-and-installed +installed version updated: yes +installed path: C:\Users\wangq\.agents\skills\voice-generation +claude link: C:\Users\wangq\.claude\skills\voice-generation +old agents backup: C:\Users\wangq\.agents\skills\voice-gen.backup-20260615054951 +old claude backup: C:\Users\wangq\.claude\skills\voice-gen.backup-20260615054951 +unit test status: passed +unit test command: C:\Users\wangq\.conda\envs\skills-vault\python.exe -m pytest .\skills\voice-generation\tests --basetemp .\tmp\pytest-voice-generation +real generation test status: passed +real generation test cwd: D:\Mine\口播2 +real generation command: C:\Users\wangq\.conda\envs\skills-vault\Scripts\voice-gen.exe gen --voice BroTsong-2026-06-10 scripts --out output --format mp3 +real generation output: D:\Mine\口播2\output\hello.mp3 +conda environment: shared skills-vault +editable package installed in shared env: yes +``` diff --git a/skills/voice-generation/README.md b/skills/voice-generation/README.md new file mode 100644 index 0000000..e321c44 --- /dev/null +++ b/skills/voice-generation/README.md @@ -0,0 +1,114 @@ +# voice-generation + +Batch text-to-speech via the `mmx` CLI, with a local registry of custom MiniMax voice clones. + +This vault Skill is named `voice-generation`. The Python package, module, and command remain: + +```text +package: voice-gen +module: voice_gen +command: voice-gen +``` + +## Install + +See [INSTALL.md](INSTALL.md) for the current `skills-vault` installation workflow. + +Short version from the repository root: + +```powershell +conda env create -f environment.yml +conda activate skills-vault + +pip install -e .\skills\voice-generation + +powershell -ExecutionPolicy Bypass -File .\scripts\install-skill.ps1 -Skill voice-generation -Force -InstallClaudeLink +``` + +External requirements: + +- Conda +- `mmx` CLI v1.0.16+ (`npm install -g mmx-cli`) +- `mmx auth login` once + +## Quick Start + +```bash +# 1. Initialize a project +voice-gen init + +# 2. Register a custom voice +voice-gen voices add ./samples/wantsong.mp3 + +# 2b. Or pull existing voices from the server +voice-gen voices pull + +# 3. Put Markdown scripts in scripts/ +echo "Hello, this is a test." > scripts/hello.md + +# 4. Generate audio +voice-gen gen --voice wantsong scripts +# -> output/hello.mp3 +``` + +## Commands + +| Command | Purpose | +| --- | --- | +| `voice-gen init` | Create `voices.json`, `scripts/`, and `output/` in the current working directory. | +| `voice-gen voices add