Skip to content

tkalevra/CodeGuard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

CodeGuard

Static analysis and edge case review for code in Open WebUI.

Designed as a companion to SuperPowersWUI or as a standalone tool.


What It Does

CodeGuard runs language-appropriate linters against code passed to it and returns structured findings. When a linter is not installed, it falls back to LLM-based analysis. A second LLM pass reviews edge cases that static analysis misses.

Language Linter Fallback
bash / sh shellcheck LLM
python ruff LLM
unknown LLM

Requirements

  • Open WebUI — tool runs inside the OWUI tool execution environment
  • shellcheck — optional, for bash/sh analysis (dnf install ShellCheck, apt install shellcheck, brew install shellcheck)
  • ruff — optional, for Python analysis (pip install ruff)

Neither linter is required. If missing and ENABLE_LLM_FALLBACK is True, CodeGuard uses the active model instead.


Installation

  1. Copy codeguard_tool.py into your Open WebUI tools directory, or paste it via the Tools editor in the OWUI admin panel.
  2. Enable the tool in your workspace or model configuration.

Usage

Standalone in chat

Ask the model to call the tool directly:

Analyze this bash script for issues:
<paste code>

Or explicitly:

Use CodeGuard to analyze this Python function. Language: python.

As a SuperPowersWUI companion

CodeGuard is designed to be called from SuperPowersWUI pipelines. The [SUPERPOWERS:AUTO-CONTINUE] marker at the end of every response signals the pipeline to proceed automatically after analysis.


Valve Reference

Valve Type Default Description
ENABLE_SHELLCHECK bool True Enable shellcheck for bash/sh
ENABLE_RUFF bool True Enable ruff for Python
ENABLE_LLM_FALLBACK bool True Fall back to LLM when linter is unavailable
SHELLCHECK_SEVERITY str style Minimum shellcheck severity: error, warning, info, style
ENABLE_EDGE_CASE_REVIEW bool True Run a second LLM pass for edge cases, race conditions, silent failures

Output Format

## CodeGuard Analysis
**Language:** python
**Linter:** ruff

### Static Analysis Findings
1. WARNING L12 [E501] Line too long (92 > 88 characters)

### Edge Case Review
1. ERROR — No timeout on the HTTP request; will hang indefinitely on unresponsive hosts.

### Summary
1 static finding(s). 1 edge case finding line(s).
**Verdict: APPROVED**

[SUPERPOWERS:AUTO-CONTINUE]

Verdict is BLOCKED if any ERROR-severity static findings are present, otherwise APPROVED.


License

MIT — see LICENSE.

About

Static analysis and edge case review tool for Open WebUI. Companion to SuperPowersWUI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages