This guide covers setting up Code Scanner on Windows.
- Open Microsoft Store
- Search for "Python 3.12"
- Click "Install"
- Open PowerShell and verify:
python --version
- Download from python.org
- Run the installer
- Important: Check "Add Python to PATH" during installation
- Complete installation
Open PowerShell or Command Prompt:
python --version # Should be 3.10 or higher
pip --versionOpen PowerShell as Administrator:
# Install UV
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# Restart PowerShell, then verify
uv --versionIf Git isn't already installed:
- Download from git-scm.com
- Run the installer
- Use default options (Git Bash is recommended)
Verify installation:
git --versionUniversal Ctags is required for symbol indexing, which enables AI tools to efficiently navigate your codebase.
If you have Chocolatey installed:
# Open PowerShell as Administrator
choco install universal-ctags
# Verify installation
ctags --versionIf you have Scoop installed:
scoop install universal-ctags
ctags --version- Download from Universal Ctags GitHub releases
- Extract to a folder (e.g.,
C:\Program Files\ctags) - Add the folder to your PATH:
- Open System Properties → Advanced → Environment Variables
- Edit PATH and add the ctags folder
- Restart PowerShell and verify:
ctags --version
Note: Make sure it shows "Universal Ctags" (not "Exuberant Ctags").
Ripgrep is required for fast code search across the repository.
# Open PowerShell as Administrator
choco install ripgrep
# Verify installation
rg --versionscoop install ripgrep
rg --versionwinget install BurntSushi.ripgrep
rg --version- Download from ripgrep GitHub releases
- Extract to a folder (e.g.,
C:\Program Files\ripgrep) - Add the folder to your PATH
- Restart PowerShell and verify:
rg --version
Open PowerShell or Git Bash:
# Clone the repository
git clone https://github.com/ubego/Code-Scanner.git
cd code-scanner
# Install dependencies with UV
uv sync
# Verify installation
uv run code-scanner --helpChoose one of the following backends:
Ollama now supports Windows natively.
- Download from ollama.ai/download
- Run the installer
- Ollama starts automatically
Open PowerShell:
# Pull a model
ollama pull qwen3:4b
# Verify it's working
ollama list
# Test the API
curl http://localhost:11434/api/tags
# Or with PowerShell:
Invoke-WebRequest http://localhost:11434/api/tagsConfiguration for Ollama:
Copy a language-specific example (e.g., sample_configs/python-config.toml) and update the [llm] section:
[llm]
backend = "ollama"
host = "localhost"
port = 11434
model = "qwen3:4b"
timeout = 120
context_limit = 16384 # RequiredLM Studio provides a user-friendly Windows application.
- Download from lmstudio.ai
- Run the installer
- Launch LM Studio
In LM Studio:
- Search for "qwen2.5-coder-7b-instruct"
- Download the model
- Load the model
- Go to "Local Server" tab (click the "<->" icon)
- Set "Context Length" to at least 16384 in the right sidebar
- Click "Start Server" (default port: 1234)
Configuration for LM Studio:
Copy a language-specific example (e.g., sample_configs/python-config.toml) and update the [llm] section:
[llm]
backend = "lm-studio"
host = "localhost"
port = 1234
timeout = 120
context_limit = 16384 # Required# Navigate to your project
cd C:\path\to\your\project
# Create code_scanner_config.toml (copy from examples)
Copy-Item C:\path\to\code-scanner\examples\python-config.toml code_scanner_config.toml
# Edit code_scanner_config.toml with your preferred editor
notepad code_scanner_config.toml
# Run the scanner (runs continuously until Ctrl+C)
uv run code-scanner# Navigate to your project
cd /c/path/to/your/project
# Create code_scanner_config.toml
cp /c/path/to/code-scanner/sample_configs/python-config.toml code_scanner_config.toml
# Run the scanner
uv run code-scanner:: Navigate to your project
cd C:\path\to\your\project
:: Run the scanner
uv run code-scannerLM Studio and Ollama can use NVIDIA GPUs for faster inference:
- Install NVIDIA CUDA Toolkit
- Install latest NVIDIA drivers
- In LM Studio, enable GPU acceleration in settings
- Ollama automatically uses CUDA if available
- LM Studio supports AMD GPUs via ROCm
- Ollama support for AMD is limited on Windows
You can configure Code Scanner to start automatically on login using Windows Task Scheduler.
- Code Scanner installed and working via command line
- LLM backend (Ollama or LM Studio) installed
- PowerShell or Command Prompt with administrator access (for some operations)
Run the autostart script by double-clicking or from Command Prompt:
scripts\autostart-windows.batThe script will interactively guide you through:
- Project path - The directory to scan
- Config file path - Your
code_scanner_config.tomllocation - Test launch - Verifies the scanner works before registering
- Task Scheduler registration - Creates a login task
- Detects legacy tasks and offers to remove them
- Validates paths for project and config file
- Test launches the scanner to verify configuration
- Creates wrapper script at
%USERPROFILE%\.code-scanner\launch-wrapper.bat - Creates scheduled task named "CodeScanner" via Task Scheduler
- Configures login trigger to start on user logon
- Includes 60-second delay to allow LLM backend startup
REM Check status
schtasks /query /tn "CodeScanner"
REM Run manually
schtasks /run /tn "CodeScanner"
REM Stop
schtasks /end /tn "CodeScanner"
REM Remove completely
schtasks /delete /tn "CodeScanner" /f
del "%USERPROFILE%\.code-scanner\launch-wrapper.bat"You can also manage the task via the graphical interface:
- Press
Win + R, typetaskschd.msc, press Enter - Find "CodeScanner" in the task list
- Right-click to Run, End, Disable, or Delete
- Scanner log:
%USERPROFILE%\.code-scanner\code_scanner.log - Results:
<project>\code_scanner_results.md
Task won't start:
- Check scanner log:
type %USERPROFILE%\.code-scanner\code_scanner.log - Verify config file path is correct
- Ensure LLM backend is running
- Open Task Scheduler and check the task's "History" tab
Lock file errors: Another instance may be running. Check with:
type %USERPROFILE%\.code-scanner\code_scanner.lock
tasklist | findstr code-scannerDelete stale lock if needed:
del %USERPROFILE%\.code-scanner\code_scanner.lockPermission issues: If the task fails to create, try running Command Prompt as Administrator:
- Right-click Command Prompt
- Select "Run as administrator"
- Navigate to the code-scanner directory
- Run the autostart script again
Python isn't in your PATH. Either:
- Reinstall Python with "Add to PATH" checked
- Add Python manually to PATH:
- Search "Environment Variables" in Start
- Edit PATH
- Add Python installation directory (e.g.,
C:\Users\YourName\AppData\Local\Programs\Python\Python312)
Restart PowerShell after UV installation. If still not working:
# Check UV location
$env:USERPROFILE\.local\bin\uv.exe --version
# Add to PATH manually
$env:PATH += ";$env:USERPROFILE\.local\bin"Windows Firewall may block LLM backends:
- Open Windows Security
- Firewall & network protection
- Allow an app through firewall
- Add LM Studio or Ollama
Some antivirus software may slow down or block the scanner:
- Add code-scanner directory to exclusions
- Add LM Studio/Ollama to exclusions
If you see path-related errors:
- Open Group Policy Editor (gpedit.msc)
- Navigate to: Computer Configuration > Administrative Templates > System > Filesystem
- Enable "Enable Win32 long paths"
- Restart your computer
If you see "execution of scripts is disabled":
# Run as Administrator
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser# Check if Ollama is running
Get-Process ollama
# Check if LM Studio server is running
Test-NetConnection -ComputerName localhost -Port 1234
# For Ollama
Test-NetConnection -ComputerName localhost -Port 11434