Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

fix: tighten WaveTone harness validation

Shuhan Zhangb19f49215e98
diff --git a/README.md b/README.md
index ac76b3900..9745020db 100644
--- a/README.md
+++ b/README.md
@@ -1228,7 +1228,7 @@ gimp 107 passed ✅ (64 unit + 43 e2e)
blender 208 passed ✅ (150 unit + 58 e2e)
inkscape 202 passed ✅ (148 unit + 54 e2e)
audacity 161 passed ✅ (107 unit + 54 e2e)
-wavetone 25 passed ✅ (21 unit + 4 default, 2 backend-gated e2e skipped; 27 passed opt-in)
+wavetone 28 passed ✅ (23 unit + 5 default e2e, 2 backend-gated e2e skipped; 30 passed opt-in)
libreoffice 158 passed ✅ (89 unit + 69 e2e)
mubu 96 passed ✅ (85 unit + 11 e2e)
obs-studio 153 passed ✅ (116 unit + 37 e2e)
@@ -1308,7 +1308,7 @@ cli-anything/
├── 🧊 blender/agent-harness/ # Blender CLI (208 tests)
├── ✏️ inkscape/agent-harness/ # Inkscape CLI (202 tests)
├── 🎵 audacity/agent-harness/ # Audacity CLI (161 tests)
-├── wavetone/agent-harness/ # WaveTone CLI (27 tests: 25 default + 2 backend-gated e2e)
+├── wavetone/agent-harness/ # WaveTone CLI (30 tests: 28 default + 2 backend-gated e2e)
├── 🌐 browser/agent-harness/ # Browser CLI (DOMShell MCP, new)
├── 📄 libreoffice/agent-harness/ # LibreOffice CLI (158 tests)
├── 📧 mailchimp/agent-harness/ # Mailchimp Marketing API CLI (303 commands, 36 unit tests)
diff --git a/README_CN.md b/README_CN.md
index caedc5456..48fe18faf 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -679,7 +679,7 @@ gimp 107 passed ✅ (64 unit + 43 e2e)
blender 208 passed ✅ (150 unit + 58 e2e)
inkscape 202 passed ✅ (148 unit + 54 e2e)
audacity 161 passed ✅ (107 unit + 54 e2e)
-wavetone 25 passed ✅ (21 unit + 4 default,2 backend-gated e2e skipped;27 passed opt-in)
+wavetone 28 passed ✅ (23 unit + 5 default e2e,2 backend-gated e2e skipped;30 passed opt-in)
libreoffice 158 passed ✅ (89 unit + 69 e2e)
obs-studio 153 passed ✅ (116 unit + 37 e2e)
kdenlive 155 passed ✅ (111 unit + 44 e2e)
@@ -753,7 +753,7 @@ cli-anything/
├── 🧊 blender/agent-harness/ # Blender CLI(208 项测试)
├── ✏️ inkscape/agent-harness/ # Inkscape CLI(202 项测试)
├── 🎵 audacity/agent-harness/ # Audacity CLI(161 项测试)
-├── wavetone/agent-harness/ # WaveTone CLI(27 项测试:25 default + 2 backend-gated e2e)
+├── wavetone/agent-harness/ # WaveTone CLI(30 项测试:28 default + 2 backend-gated e2e)
├── 📄 libreoffice/agent-harness/ # LibreOffice CLI(158 项测试)
├── 📚 zotero/agent-harness/ # Zotero CLI(新增,支持文献导入)
├── 📓 joplin/agent-harness/ # Joplin CLI(134 测试:107 单元 + 27 e2e)
diff --git a/wavetone/agent-harness/cli_anything/wavetone/README.md b/wavetone/agent-harness/cli_anything/wavetone/README.md
index d79626ab0..31ce407a8 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/README.md
+++ b/wavetone/agent-harness/cli_anything/wavetone/README.md
@@ -55,4 +55,7 @@ The default test run skips real WaveTone backend tests so CI and contributors
without WaveTone can still run the CLI-only suite. To opt into the real Windows
smoke, set `CLI_ANYTHING_WAVETONE_REAL_BACKEND=1` plus `WAVETONE_EXE` or
`WAVETONE_HOME` pointing at a WaveTone 2.61 extraction with `wavetone.exe` and
-the bundled `data` directory.
+the bundled `data` directory. E2E subprocess tests run the in-tree
+`python -m cli_anything.wavetone.wavetone_cli` module by default; set
+`CLI_ANYTHING_FORCE_INSTALLED=1` only when intentionally testing an installed
+entry point.
diff --git a/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md b/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md
index eb82b7543..801e5794f 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md
+++ b/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md
@@ -2,10 +2,11 @@
## Test Inventory Plan
-- `test_core.py`: 21 unit tests for project manifests, audio probing, session logs,
+- `test_core.py`: 23 unit tests for project manifests, audio probing, session logs,
and backend discovery.
-- `test_full_e2e.py`: 6 tests covering default real-backend opt-in gating, CLI
- subprocess workflows, and real WaveTone launch smoke coverage.
+- `test_full_e2e.py`: 7 tests covering default real-backend opt-in gating,
+ source-module subprocess resolution, CLI workflows, and real WaveTone launch
+ smoke coverage.
## Unit Test Plan
@@ -25,6 +26,7 @@
- Reject invalid session JSON schemas with clear `ValueError`s.
- Reject non-finite session payload values before writing JSON.
- Resolve `WAVETONE_EXE` from the environment.
+- Reject WaveTone backend data artifacts that are directories instead of files.
- Preserve inherited project and JSON context for REPL-style nested CLI
invocations.
- Return a failing exit status for launch smoke checks when the backend exits
@@ -32,6 +34,7 @@
- Convert launch runtime errors to clean CLI errors.
- Reject GUI launch attempts on non-Windows hosts with a clear error.
- Strip Windows REPL path quotes while preserving backslashes.
+- Preserve WaveTone branding and expose the local skill path in the REPL banner.
- Report Click REPL exit control flow without falling through to the unexpected
exception handler.
@@ -44,10 +47,12 @@ Simulates an agent preparing an audio file before opening it in WaveTone.
Operations:
1. Generate a real WAV fixture.
-2. Run `cli-anything-wavetone --json project new`.
-3. Run `project set-tempo`.
-4. Run `project add-label`.
-5. Run `audio probe`.
+2. Resolve the in-tree `python -m cli_anything.wavetone.wavetone_cli` module by
+ default, even if an installed `cli-anything-wavetone` exists in `PATH`.
+3. Run `cli-anything-wavetone --json project new`.
+4. Run `project set-tempo`.
+5. Run `project add-label`.
+6. Run `audio probe`.
Verified:
@@ -81,6 +86,7 @@ Default command:
```bash
$env:PATH = "$env:APPDATA\Python\Python313\Scripts;$env:PATH"
+Remove-Item Env:CLI_ANYTHING_FORCE_INSTALLED -ErrorAction SilentlyContinue
Remove-Item Env:CLI_ANYTHING_WAVETONE_REAL_BACKEND -ErrorAction SilentlyContinue
Remove-Item Env:WAVETONE_EXE -ErrorAction SilentlyContinue
Remove-Item Env:WAVETONE_HOME -ErrorAction SilentlyContinue
@@ -90,7 +96,7 @@ python -m pytest cli_anything\wavetone\tests\ -v -s
Default result:
```text
-collected 27 items
+collected 30 items
cli_anything/wavetone/tests/test_core.py::test_create_project_manifest PASSED
cli_anything/wavetone/tests/test_core.py::test_rejects_unsupported_audio PASSED
@@ -107,26 +113,30 @@ cli_anything/wavetone/tests/test_core.py::test_ffprobe_handles_non_numeric_metad
cli_anything/wavetone/tests/test_core.py::test_session_event_log PASSED
cli_anything/wavetone/tests/test_core.py::test_session_rejects_invalid_schema PASSED
cli_anything/wavetone/tests/test_core.py::test_find_wavetone_from_env PASSED
+cli_anything/wavetone/tests/test_core.py::test_doctor_rejects_required_data_directories PASSED
cli_anything/wavetone/tests/test_core.py::test_cli_preserves_inherited_project_and_json_context PASSED
cli_anything/wavetone/tests/test_core.py::test_wavetone_launch_fails_on_early_nonzero_exit PASSED
cli_anything/wavetone/tests/test_core.py::test_wavetone_launch_reports_runtime_errors PASSED
cli_anything/wavetone/tests/test_core.py::test_launch_requires_windows PASSED
cli_anything/wavetone/tests/test_core.py::test_repl_split_strips_windows_quotes PASSED
+cli_anything/wavetone/tests/test_core.py::test_repl_skin_uses_wavetone_branding_and_local_skill_path PASSED
cli_anything/wavetone/tests/test_core.py::test_repl_reports_click_exit_without_unexpected_error PASSED
cli_anything/wavetone/tests/test_full_e2e.py::test_real_backend_requires_explicit_opt_in PASSED
+cli_anything/wavetone/tests/test_full_e2e.py::test_resolve_cli_defaults_to_source_module PASSED
cli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_help PASSED
cli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_project_audio_workflow_json PASSED
cli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_formats_json PASSED
cli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_doctor_real_backend SKIPPED
cli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_launch_real_backend_with_wav SKIPPED
-25 passed, 2 skipped in 1.83s
+28 passed, 2 skipped in 2.10s
```
Real backend opt-in command:
```bash
$env:PATH = "$env:APPDATA\Python\Python313\Scripts;$env:PATH"
+Remove-Item Env:CLI_ANYTHING_FORCE_INSTALLED -ErrorAction SilentlyContinue
$env:CLI_ANYTHING_WAVETONE_REAL_BACKEND = "1"
$env:WAVETONE_HOME = "C:\Users\Hp\Desktop\wavetone2.6.1"
Remove-Item Env:WAVETONE_EXE -ErrorAction SilentlyContinue
@@ -136,7 +146,7 @@ python -m pytest cli_anything\wavetone\tests\ -v -s
Real backend result:
```text
-27 passed in 3.56s
+30 passed in 3.44s
```
## Coverage Notes
@@ -145,12 +155,13 @@ Real backend result:
analysis settings, CLI analysis flag tri-state behavior, finite numeric
validation, project JSON schema validation, audio probing, malformed WAV
fallback, session logs, session schema and payload validation, backend
- discovery, ffprobe argument construction, ffprobe metadata parsing, inherited
- CLI project and JSON context, failed launch smoke reporting, launch runtime
- error reporting, Windows launch gating, REPL Windows path splitting, and
+ discovery, backend data artifact validation, ffprobe argument construction,
+ ffprobe metadata parsing, inherited CLI project and JSON context, failed
+ launch smoke reporting, launch runtime error reporting, Windows launch gating,
+ REPL Windows path splitting, REPL branding and local skill path display, and
REPL Click exit handling.
-- CLI subprocess tests resolve and use the installed `cli-anything-wavetone`
- entry point.
+- CLI subprocess tests resolve and use the in-tree
+ `python -m cli_anything.wavetone.wavetone_cli` module by default.
- Real backend coverage launches `C:\Users\Hp\Desktop\wavetone2.6.1\wavetone.exe`
with a generated WAV and terminates it after a short wait.
- Real backend tests are skipped by default unless
diff --git a/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py b/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py
index 522f8ef28..e747182c7 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py
+++ b/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py
@@ -23,6 +23,7 @@ from cli_anything.wavetone.core.project import (
from cli_anything.wavetone.core.session import append_event, load_events
from cli_anything.wavetone.tests.helpers import make_wav
from cli_anything.wavetone.utils import wavetone_backend
+from cli_anything.wavetone.utils.repl_skin import ReplSkin
from cli_anything.wavetone.wavetone_cli import _split_repl_args, cli
@@ -249,6 +250,34 @@ def test_find_wavetone_from_env(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)
assert wavetone_backend.find_wavetone() == fake.resolve()
+def test_doctor_rejects_required_data_directories(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
+ root = tmp_path / "wavetone"
+ data_dir = root / "data"
+ help_dir = root / "wthelp"
+ data_dir.mkdir(parents=True)
+ help_dir.mkdir()
+ exe = root / "wavetone.exe"
+ exe.write_bytes(b"MZ")
+
+ directory_artifact = wavetone_backend.REQUIRED_DATA_FILES[0]
+ for filename in wavetone_backend.REQUIRED_DATA_FILES:
+ path = data_dir / filename
+ if filename == directory_artifact:
+ path.mkdir()
+ else:
+ path.write_bytes(b"x")
+
+ monkeypatch.setenv("WAVETONE_EXE", str(exe))
+ monkeypatch.setattr(wavetone_backend.platform, "system", lambda: "Windows")
+ monkeypatch.setattr(wavetone_backend.platform, "platform", lambda: "Windows-test")
+
+ status = wavetone_backend.doctor()
+ artifact = next(check for check in status["checks"] if check["name"] == f"data/{directory_artifact}")
+
+ assert status["ready"] is False
+ assert artifact["ok"] is False
+
+
def test_cli_preserves_inherited_project_and_json_context(tmp_path: Path) -> None:
wav = make_wav(tmp_path / "tone.wav")
project_path = save_project(create_project(wav), tmp_path / "tone.wt.json")
@@ -316,6 +345,20 @@ def test_repl_split_strips_windows_quotes() -> None:
]
+def test_repl_skin_uses_wavetone_branding_and_local_skill_path(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
+ skill_path = tmp_path / "SKILL.md"
+ skill_path.write_text("# WaveTone", encoding="utf-8")
+ skin = ReplSkin("WaveTone", version="test", history_file=str(tmp_path / "history"), skill_path=str(skill_path))
+
+ skin.print_banner()
+ output = capsys.readouterr().out
+
+ assert skin.display_name == "WaveTone"
+ assert "WaveTone" in output
+ assert "Local skill:" in output
+ assert "SKILL.md" in output
+
+
def test_repl_reports_click_exit_without_unexpected_error(monkeypatch: pytest.MonkeyPatch) -> None:
errors: list[str] = []
inputs = iter(["wavetone launch", "exit"])
diff --git a/wavetone/agent-harness/cli_anything/wavetone/tests/test_full_e2e.py b/wavetone/agent-harness/cli_anything/wavetone/tests/test_full_e2e.py
index ae28a5592..c3e9ab45c 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/tests/test_full_e2e.py
+++ b/wavetone/agent-harness/cli_anything/wavetone/tests/test_full_e2e.py
@@ -16,17 +16,18 @@ REAL_BACKEND_ENV = "CLI_ANYTHING_WAVETONE_REAL_BACKEND"
def _resolve_cli(name: str) -> list[str]:
- """Resolve installed CLI command; fall back to python -m for development."""
+ """Run the in-tree module by default; installed entry points are opt-in."""
force = os.environ.get("CLI_ANYTHING_FORCE_INSTALLED", "").strip() == "1"
+ module = "cli_anything.wavetone.wavetone_cli"
+ if not force:
+ print(f"[_resolve_cli] Using source module: {sys.executable} -m {module}")
+ return [sys.executable, "-m", module]
+
path = shutil.which(name)
- if path:
- print(f"[_resolve_cli] Using installed command: {path}")
- return [path]
- if force:
+ if not path:
raise RuntimeError(f"{name} not found in PATH. Install with: pip install -e .")
- module = "cli_anything.wavetone.wavetone_cli"
- print(f"[_resolve_cli] Falling back to: {sys.executable} -m {module}")
- return [sys.executable, "-m", module]
+ print(f"[_resolve_cli] Using installed command: {path}")
+ return [path]
def _env_flag_enabled(name: str) -> bool:
@@ -64,6 +65,13 @@ def test_real_backend_requires_explicit_opt_in(monkeypatch: pytest.MonkeyPatch)
assert REAL_BACKEND_ENV in reason
+def test_resolve_cli_defaults_to_source_module(monkeypatch: pytest.MonkeyPatch) -> None:
+ monkeypatch.delenv("CLI_ANYTHING_FORCE_INSTALLED", raising=False)
+ monkeypatch.setattr(shutil, "which", lambda name: "C:/foreign/cli-anything-wavetone.exe")
+
+ assert _resolve_cli("cli-anything-wavetone") == [sys.executable, "-m", "cli_anything.wavetone.wavetone_cli"]
+
+
class TestCLISubprocess:
CLI_BASE = _resolve_cli("cli-anything-wavetone")
diff --git a/wavetone/agent-harness/cli_anything/wavetone/utils/repl_skin.py b/wavetone/agent-harness/cli_anything/wavetone/utils/repl_skin.py
index 4e74c13c1..3296206c8 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/utils/repl_skin.py
+++ b/wavetone/agent-harness/cli_anything/wavetone/utils/repl_skin.py
@@ -125,7 +125,8 @@ class ReplSkin:
Displayed in banner for AI agents to know where to read skill info.
"""
self.software = software.lower().replace("-", "_")
- self.display_name = software.replace("_", " ").title()
+ display_overrides = {"wavetone": "WaveTone"}
+ self.display_name = display_overrides.get(self.software, software.replace("_", " ").title())
self.version = version
software_aliases = {"iterm2_ctl": "iterm2"}
self.skill_slug = software_aliases.get(self.software, self.software).replace("_", "-")
@@ -231,6 +232,8 @@ class ReplSkin:
meta_lines: list[str] = []
meta_lines.extend(_meta_lines("Install:", self.skill_install_cmd))
+ if self.skill_path:
+ meta_lines.extend(_meta_lines("Local skill:", _display_home_path(self.skill_path)))
meta_lines.extend(_meta_lines("Global skill:", _display_home_path(self.global_skill_path)))
print(top)
print(_box_line(title))
diff --git a/wavetone/agent-harness/cli_anything/wavetone/utils/wavetone_backend.py b/wavetone/agent-harness/cli_anything/wavetone/utils/wavetone_backend.py
index 33af7de43..81d3d35ec 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/utils/wavetone_backend.py
+++ b/wavetone/agent-harness/cli_anything/wavetone/utils/wavetone_backend.py
@@ -79,7 +79,7 @@ def doctor(executable: str | Path | None = None) -> dict[str, Any]:
checks.append({"name": "data directory", "ok": data_dir.is_dir(), "path": str(data_dir)})
for filename in REQUIRED_DATA_FILES:
path = data_dir / filename
- checks.append({"name": f"data/{filename}", "ok": path.exists(), "path": str(path)})
+ checks.append({"name": f"data/{filename}", "ok": path.is_file(), "path": str(path)})
help_dir = root / "wthelp"
checks.append({"name": "help directory", "ok": help_dir.is_dir(), "path": str(help_dir)})
checks.append(
diff --git a/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py b/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py
index f67931944..fc2604042 100644
--- a/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py
+++ b/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py
@@ -88,7 +88,7 @@ def cli(ctx: click.Context, project_path: str | None, json_mode: bool) -> None:
@click.pass_context
def repl(ctx: click.Context) -> None:
"""Start an interactive command loop."""
- skin = ReplSkin("wavetone", version=__version__)
+ skin = ReplSkin("WaveTone", version=__version__)
skin.print_banner()
skin.info("Type 'help' for commands, 'exit' to quit.")
prompt_session = skin.create_prompt_session()