"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/
Python
fix: preserve WaveTone REPL project context
Shuhan Zhanged94575a352f
diff --git a/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md b/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.mdindex 070375ab2..3ff121dff 100644--- a/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md+++ b/wavetone/agent-harness/cli_anything/wavetone/tests/TEST.md@@ -2,7 +2,7 @@## Test Inventory Plan-- `test_core.py`: 8 unit tests for project manifests, audio probing, session logs,+- `test_core.py`: 9 unit tests for project manifests, audio probing, session logs,and backend discovery.- `test_full_e2e.py`: 5 E2E tests covering CLI subprocess workflows and realWaveTone launch smoke coverage.@@ -17,6 +17,7 @@- Probe a generated WAV file with the Python stdlib.- Append and reload session events.- Resolve `WAVETONE_EXE` from the environment.+- Preserve inherited project context for REPL-style nested CLI invocations.## E2E Test Plan@@ -68,7 +69,7 @@ python -m pytest cli_anything\wavetone\tests\ -v -sResult:```text-collected 13 items+collected 14 itemscli_anything/wavetone/tests/test_core.py::test_create_project_manifest PASSEDcli_anything/wavetone/tests/test_core.py::test_rejects_unsupported_audio PASSED@@ -78,19 +79,21 @@ cli_anything/wavetone/tests/test_core.py::test_update_analysis_settings PASSEDcli_anything/wavetone/tests/test_core.py::test_probe_wav_metadata PASSEDcli_anything/wavetone/tests/test_core.py::test_session_event_log PASSEDcli_anything/wavetone/tests/test_core.py::test_find_wavetone_from_env PASSED+cli_anything/wavetone/tests/test_core.py::test_cli_preserves_inherited_project_context PASSEDcli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_help PASSEDcli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_project_audio_workflow_json PASSEDcli_anything/wavetone/tests/test_full_e2e.py::TestCLISubprocess::test_formats_json PASSEDcli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_doctor_real_backend PASSEDcli_anything/wavetone/tests/test_full_e2e.py::TestRealWaveToneBackend::test_launch_real_backend_with_wav PASSED-13 passed in 3.35s+14 passed in 3.53s```## Coverage Notes- Unit tests cover manifest creation, validation, persistence, labels, tempo,- analysis settings, audio probing, session logs, and backend discovery.+ analysis settings, audio probing, session logs, backend discovery, and+ inherited CLI project context.- CLI subprocess tests resolve and use the installed `cli-anything-wavetone`entry point.- Real backend coverage launches `C:\Users\Hp\Desktop\wavetone2.6.1\wavetone.exe`diff --git a/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py b/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.pyindex 66d871a7f..68ddcf013 100644--- a/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py+++ b/wavetone/agent-harness/cli_anything/wavetone/tests/test_core.py@@ -1,11 +1,13 @@from __future__ import annotations+import jsonimport mathimport structimport wavefrom pathlib import Pathimport pytest+from click.testing import CliRunnerfrom cli_anything.wavetone.core.audio import probe_audiofrom cli_anything.wavetone.core.project import (@@ -19,6 +21,7 @@ from cli_anything.wavetone.core.project import ()from cli_anything.wavetone.core.session import append_event, load_eventsfrom cli_anything.wavetone.utils import wavetone_backend+from cli_anything.wavetone.wavetone_cli import clidef make_wav(path: Path, freq: float = 440.0, duration: float = 0.25, sample_rate: int = 8000) -> Path:@@ -109,3 +112,18 @@ def test_find_wavetone_from_env(tmp_path: Path, monkeypatch: pytest.MonkeyPatch)monkeypatch.setenv("WAVETONE_EXE", str(fake))assert wavetone_backend.find_wavetone() == fake.resolve()+++def test_cli_preserves_inherited_project_context(tmp_path: Path) -> None:+ wav = make_wav(tmp_path / "tone.wav")+ project_path = save_project(create_project(wav), tmp_path / "tone.wt.json")++ result = CliRunner().invoke(+ cli,+ ["--json", "audio", "probe"],+ obj={"project": str(project_path), "json": False},+ )++ assert result.exit_code == 0, result.output+ data = json.loads(result.output)+ assert data["audio"]["path"] == str(wav.resolve())diff --git a/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py b/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.pyindex 3a0edf649..a8f309506 100644--- a/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py+++ b/wavetone/agent-harness/cli_anything/wavetone/wavetone_cli.py@@ -63,7 +63,10 @@ def load_ctx_project(ctx: click.Context, explicit_path: str | Path | None = Nonedef cli(ctx: click.Context, project_path: str | None, json_mode: bool) -> None:"""Agent-native CLI harness for WaveTone 2.61."""ctx.ensure_object(dict)- ctx.obj["project"] = project_path+ if project_path is not None:+ ctx.obj["project"] = project_path+ else:+ ctx.obj.setdefault("project", None)ctx.obj["json"] = json_modeif ctx.invoked_subcommand is None:ctx.invoke(repl)