diff --git a/.vscode/settings.json b/.vscode/settings.json index d43fcfde..274390ae 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,11 @@ { "python.defaultInterpreterPath": "${workspaceFolder}/backend/.venv/bin/python", - "python.terminal.activateEnvironment": true, + "terminal.integrated.profiles.osx": { + "bash + venv": { + "path": "/opt/homebrew/bin/bash", + "args": ["--rcfile", "${workspaceFolder}/.vscode/terminal-init.sh"] + } + }, + "terminal.integrated.defaultProfile.osx": "bash + venv", "terminal.integrated.enablePersistentSessions": false } \ No newline at end of file diff --git a/.vscode/terminal-init.sh b/.vscode/terminal-init.sh new file mode 100644 index 00000000..514eccc2 --- /dev/null +++ b/.vscode/terminal-init.sh @@ -0,0 +1,9 @@ +# 1. Load your normal shell setup first (brew, nvm, bun, etc.) +[ -f "$HOME/.bash_profile" ] && source "$HOME/.bash_profile" + +# 2. Restore the standard macOS prompt (normally set by /etc/bashrc for login shells) +PS1='\h:\W \u\$ ' + +# 3. Activate the project venv LAST, so it wins the PATH ordering +VENV="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/backend/.venv/bin/activate" +[ -f "$VENV" ] && source "$VENV" \ No newline at end of file diff --git a/run.sh b/run.sh index 296452b7..cd9484c6 100755 --- a/run.sh +++ b/run.sh @@ -158,6 +158,18 @@ fi # directly), so the env stays unset in production and uvicorn boots in # its leaner non-reload mode. export OPENSWARM_DEV=1 + +# --- Lint preflight: surface violations before the dev loop starts --- +# print_errors.sh -> linter/lint.py needs watchfiles + vulture, which live in +# the backend venv (installed by backend/run.sh when OPENSWARM_DEV=1). Prepend +# the venv's bin to PATH so the script's bare `python3` resolves there. Skip +# silently on a fresh checkout where the venv isn't built yet. +VENV_BIN="$PROJECT_ROOT/backend/.venv/bin" +if [ -x "$VENV_BIN/python3" ]; then + echo -e "${YELLOW}${BOLD}[lint]${RESET} Checking for linter violations..." + PATH="$VENV_BIN:$PATH" bash "$PROJECT_ROOT/linter/print_errors.sh" "$PROJECT_ROOT" +fi + echo -e "${BLUE}${BOLD}[backend]${RESET} Starting backend server..." bash "$PROJECT_ROOT/backend/run.sh" > >( while IFS= read -r line; do