Newer
Older
navi-1 / bin / navi-code
#!/usr/bin/env bash
"""
Wrapper script for launching the Navi Code terminal client from anywhere.

Usage:
  1. Clone the navi repository.
  2. Create a venv and install the package:
       python -m venv .venv
       .venv/bin/pip install -e .
  3. Symlink this script onto your PATH:
       ln -s /path/to/navi/bin/navi-code ~/.local/bin/navi-code
  4. cd into any project and run:
       navi-code

The wrapper locates the project root from the script's own location, activates
the local venv if present, and forwards all arguments to the `navi-code` entry
point. The client captures the shell's current working directory and sends it to
the backend so Navi resolves relative paths against your project directory.
"""

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
VENV_DIR="${NAVI_CODE_VENV:-${PROJECT_ROOT}/.venv}"

if [[ -d "${VENV_DIR}" && -f "${VENV_DIR}/bin/navi-code" ]]; then
    exec "${VENV_DIR}/bin/navi-code" "$@"
fi

# Fallback: run the entry point directly if the package is installed elsewhere.
exec python -m clients.terminal.cli "$@"