Auto-install bin/voice_tool.py into working workspace directory
This commit is contained in:
@@ -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