Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use devenv
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ profile_default/
ipython_config.py

# pyenv
.python-version
# .python-version — tracked as single source of truth for Python version

# pipenv
Pipfile.lock
Expand Down Expand Up @@ -178,6 +178,11 @@ CLAUDE.local.md
# Claude Code personal settings
.claude/settings.local.json

# devenv (local overrides only - devenv.nix/yaml/.envrc are committed)
.devenv/
devenv.lock
devenv.local.yaml

# Standalone mode files
.pal_venv/
.docker_cleaned
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ exclude: |
\.git/|
\.venv/|
venv/|
\.pal_venv/|
__pycache__/|
\.pytest_cache/|
\.devenv/|
logs/|
dist/|
build/|
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
2 changes: 1 addition & 1 deletion clink/agents/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ async def run(
process.communicate(prompt.encode("utf-8")),
timeout=self.client.timeout_seconds,
)
except asyncio.TimeoutError as exc:
except TimeoutError as exc:
process.kill()
await process.communicate()
raise CLIAgentError(
Expand Down
99 changes: 28 additions & 71 deletions code_quality_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,101 +3,58 @@
# PAL MCP Server - Code Quality Checks
# This script runs all required linting and testing checks before committing changes.
# ALL checks must pass 100% for CI/CD to succeed.
#
# Requires: devenv shell (uv, ruff, black, isort, pytest available via `uv run`)

set -e # Exit on any error

echo "🔍 Running Code Quality Checks for PAL MCP Server"
echo "Running Code Quality Checks for PAL MCP Server"
echo "================================================="

# Determine Python command
if [[ -f ".pal_venv/bin/python" ]]; then
PYTHON_CMD=".pal_venv/bin/python"
PIP_CMD=".pal_venv/bin/pip"
echo "✅ Using venv"
elif [[ -n "$VIRTUAL_ENV" ]]; then
PYTHON_CMD="python"
PIP_CMD="pip"
echo "✅ Using activated virtual environment: $VIRTUAL_ENV"
else
echo "❌ No virtual environment found!"
echo "Please run: ./run-server.sh first to set up the environment"
# Ensure uv is available
if ! command -v uv &> /dev/null; then
echo "Error: uv not found. Activate devenv first (cd into repo with direnv, or run devenv shell)."
exit 1
fi
Comment on lines +15 to 18
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The script uses command -v uv to check for uv. If uv is not found, it exits with an error. It is better to provide instructions on how to install uv or how to set up the environment properly, rather than just stating it is not found.

echo ""

# Check and install dev dependencies if needed
echo "🔍 Checking development dependencies..."
DEV_DEPS_NEEDED=false

# Check each dev dependency
for tool in ruff black isort pytest; do
# Check if tool exists in venv or in PATH
if [[ -f ".pal_venv/bin/$tool" ]] || command -v $tool &> /dev/null; then
continue
else
DEV_DEPS_NEEDED=true
break
fi
done

if [ "$DEV_DEPS_NEEDED" = true ]; then
echo "📦 Installing development dependencies..."
$PIP_CMD install -q -r requirements-dev.txt
echo "✅ Development dependencies installed"
else
echo "✅ Development dependencies already installed"
fi

# Set tool paths
if [[ -f ".pal_venv/bin/ruff" ]]; then
RUFF=".pal_venv/bin/ruff"
BLACK=".pal_venv/bin/black"
ISORT=".pal_venv/bin/isort"
PYTEST=".pal_venv/bin/pytest"
else
RUFF="ruff"
BLACK="black"
ISORT="isort"
PYTEST="pytest"
fi
# Sync deps if needed
echo "Syncing dependencies..."
uv sync --quiet
echo ""

# Step 1: Linting and Formatting
echo "📋 Step 1: Running Linting and Formatting Checks"
echo "Step 1: Running Linting and Formatting Checks"
echo "--------------------------------------------------"

echo "🔧 Running ruff linting with auto-fix..."
$RUFF check --fix --exclude test_simulation_files --exclude .pal_venv
echo "Running ruff linting with auto-fix..."
ruff check --fix --exclude test_simulation_files --exclude .devenv

echo "🎨 Running black code formatting..."
$BLACK . --exclude="test_simulation_files/" --exclude=".pal_venv/"
echo "Running black code formatting..."
black . --exclude="test_simulation_files/|\.devenv/"

echo "📦 Running import sorting with isort..."
$ISORT . --skip-glob=".pal_venv/*" --skip-glob="test_simulation_files/*"
echo "Running import sorting with isort..."
isort . --skip-glob="test_simulation_files/*" --skip-glob=".devenv/*"

echo "Verifying all linting passes..."
$RUFF check --exclude test_simulation_files --exclude .pal_venv
echo "Verifying all linting passes..."
ruff check --exclude test_simulation_files --exclude .devenv

echo "Step 1 Complete: All linting and formatting checks passed!"
echo "Step 1 Complete: All linting and formatting checks passed!"
echo ""

# Step 2: Unit Tests
echo "🧪 Step 2: Running Complete Unit Test Suite"
echo "Step 2: Running Complete Unit Test Suite"
echo "---------------------------------------------"

echo "🏃 Running unit tests (excluding integration tests)..."
$PYTHON_CMD -m pytest tests/ -v -x -m "not integration"
echo "Running unit tests (excluding integration tests)..."
pytest tests/ -v -x -m "not integration"

echo "Step 2 Complete: All unit tests passed!"
echo "Step 2 Complete: All unit tests passed!"
echo ""

# Step 3: Final Summary
echo "🎉 All Code Quality Checks Passed!"
echo "All Code Quality Checks Passed!"
echo "=================================="
echo "✅ Linting (ruff): PASSED"
echo "✅ Formatting (black): PASSED"
echo "✅ Import sorting (isort): PASSED"
echo "✅ Unit tests: PASSED"
echo ""
echo "🚀 Your code is ready for commit and GitHub Actions!"
echo "💡 Remember to add simulator tests if you modified tools"
echo "Linting (ruff): PASSED"
echo "Formatting (black): PASSED"
echo "Import sorting (isort): PASSED"
echo "Unit tests: PASSED"
47 changes: 25 additions & 22 deletions conf/gemini_models.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@
},
"models": [
{
"model_name": "gemini-3-pro-preview",
"friendly_name": "Gemini Pro 3.0 Preview",
"model_name": "gemini-3.1-pro-preview",
"friendly_name": "Gemini Pro 3.1 Preview",
"aliases": [
"pro",
"gemini3",
"gemini-pro"
"gemini-pro",
"gemini3.1"
],
"intelligence_score": 18,
"description": "Deep reasoning + thinking mode (1M context) - Complex problems, architecture, deep analysis",
"description": "Gemini 3.1 Pro (1M context, 65K output) - Flagship reasoning with thinking_level support, vision, computer use",
"context_window": 1048576,
"max_output_tokens": 65536,
"max_thinking_tokens": 32768,
Expand All @@ -54,8 +55,8 @@
"aliases": [
"gemini-pro-2.5"
],
"intelligence_score": 18,
"description": "Older Model. 1M context - Complex problems, architecture, deep analysis",
"intelligence_score": 16,
"description": "DEPRECATED (shuts down June 17, 2026) - Gemini 2.5 Pro (1M context). Use gemini-3.1-pro-preview instead.",
"context_window": 1048576,
"max_output_tokens": 65536,
"max_thinking_tokens": 32768,
Expand All @@ -66,18 +67,17 @@
"supports_json_mode": true,
"supports_images": true,
"supports_temperature": true,
"allow_code_generation": true,
"max_image_size_mb": 32.0
},
{
"model_name": "gemini-2.0-flash",
"friendly_name": "Gemini (Flash 2.0)",
"model_name": "gemini-3-flash-preview",
"friendly_name": "Gemini Flash 3.0 Preview",
"aliases": [
"flash-2.0",
"flash2"
"flash3",
"gemini3-flash"
],
"intelligence_score": 9,
"description": "Gemini 2.0 Flash (1M context) - Latest fast model with experimental thinking, supports audio/video input",
"intelligence_score": 12,
"description": "Gemini 3 Flash (1M context, 65K output) - Fast reasoning with thinking_level support, vision, computer use",
"context_window": 1048576,
"max_output_tokens": 65536,
"max_thinking_tokens": 24576,
Expand All @@ -91,23 +91,26 @@
"max_image_size_mb": 20.0
},
{
"model_name": "gemini-2.0-flash-lite",
"friendly_name": "Gemini (Flash Lite 2.0)",
"model_name": "gemini-3.1-flash-lite-preview",
"friendly_name": "Gemini Flash Lite 3.1 Preview",
"aliases": [
"flashlite",
"flash-lite"
"flash-lite",
"lite"
],
"intelligence_score": 7,
"description": "Gemini 2.0 Flash Lite (1M context) - Lightweight fast model, text-only",
"intelligence_score": 9,
"description": "Gemini 3.1 Flash Lite (1M context, 65K output) - Cheapest Gemini model with thinking_level support",
"context_window": 1048576,
"max_output_tokens": 65536,
"supports_extended_thinking": false,
"max_thinking_tokens": 24576,
"supports_extended_thinking": true,
"supports_system_prompts": true,
"supports_streaming": true,
"supports_function_calling": true,
"supports_json_mode": true,
"supports_images": false,
"supports_temperature": true
"supports_images": true,
"supports_temperature": true,
"max_image_size_mb": 20.0
},
{
"model_name": "gemini-2.5-flash",
Expand All @@ -117,7 +120,7 @@
"flash2.5"
],
"intelligence_score": 10,
"description": "Ultra-fast (1M context) - Quick analysis, simple queries, rapid iterations",
"description": "DEPRECATED (shuts down June 17, 2026) - Gemini 2.5 Flash (1M context). Use gemini-3-flash-preview instead.",
"context_window": 1048576,
"max_output_tokens": 65536,
"max_thinking_tokens": 24576,
Expand Down
Loading
Loading