Auto-install bin/voice_tool.py into working workspace directory
This commit is contained in:
+4
-4
@@ -4,10 +4,10 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Add project root to sys.path
|
||||
here = Path(__file__).parent.parent
|
||||
if str(here) not in sys.path:
|
||||
sys.path.insert(0, str(here))
|
||||
# Add VoiceAgent1 project root to sys.path
|
||||
project_root = Path("/Users/adolforeyna/Projects/VoiceAgent1")
|
||||
if str(project_root) not in sys.path:
|
||||
sys.path.insert(0, str(project_root))
|
||||
|
||||
from voice_manager import KOKORO_VOICES, MACOS_VOICES, VoiceManager
|
||||
|
||||
|
||||
@@ -409,6 +409,22 @@ def build_vocabulary(args: argparse.Namespace, brain=None) -> Vocabulary | None:
|
||||
target.write_text(template.read_text())
|
||||
logger.info(f"Created {target} from the template")
|
||||
|
||||
# Ensure bin/voice_tool.py is available in the workspace for OpenCode and Claude
|
||||
ws_bin = workspace / "bin"
|
||||
ws_bin.mkdir(exist_ok=True)
|
||||
voice_script = ws_bin / "voice_tool.py"
|
||||
source_script = here / "bin" / "voice_tool.py"
|
||||
if source_script.exists() and not voice_script.exists():
|
||||
try:
|
||||
voice_script.symlink_to(source_script.resolve())
|
||||
logger.info(f"Created symlink {voice_script} -> {source_script}")
|
||||
except Exception:
|
||||
try:
|
||||
voice_script.write_text(source_script.read_text())
|
||||
logger.info(f"Copied {source_script} -> {voice_script}")
|
||||
except Exception as e:
|
||||
logger.warning(f"Could not install voice_tool.py into {ws_bin}: {e}")
|
||||
|
||||
vocabulary = Vocabulary(
|
||||
project_dir=workspace,
|
||||
vocabulary_file=vocabulary_file,
|
||||
|
||||
Reference in New Issue
Block a user