[hAIk]: add lint preflight step in run.sh that runs print_errors.sh before the dev loop starts (skips gracefully if venv missing), replace python.terminal.activateEnvironment with a custom terminal-init.sh profile that sources .bash_profile then activates the backend venv, and set it as the default macOS terminal in VS Code settings

This commit is contained in:
haikdc
2026-06-13 10:55:32 -07:00
parent 51532c548c
commit 7fdf37f416
3 changed files with 28 additions and 1 deletions
+7 -1
View File
@@ -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
}
+9
View File
@@ -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"
+12
View File
@@ -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