Multi-language code analyzer and auto-fixer with real-time feedback and Docker sandbox testing support.
- Features
- Quick Start
- How to Use
- Examples
- Detected Issues
- API Reference
- Pactfix CLI
- Project Structure
- Development
- Contributing
- License
- β‘ Real-time analysis - BΕΔdy widoczne podczas pisania
- π§ Auto-fix - Automatyczne naprawianie typowych bΕΔdΓ³w
- π History tracking - PeΕna historia wykrytych bΕΔdΓ³w i poprawek
- πΎ Export options - Pobieranie poprawionego skryptu lub kopiowanie do schowka
- π³ Docker sandbox - Testowanie poprawek w izolowanym Εrodowisku
- π§ͺ Multi-language - Wsparcie dla 24+ jΔzykΓ³w i formatΓ³w
- π Live preview - PodglΔ d poprawek w czasie rzeczywistym
- π Statistics - Liczba linii, znakΓ³w, bΕΔdΓ³w i ostrzeΕΌeΕ
- π Share via URL - UdostΔpnianie kodu przez link
# Clone the repository
git clone https://github.com/wronai/pactown-debug.git
cd pactown-debug
# Build and run with Docker Compose
docker-compose up --build
# Or directly with Docker
docker build -t pactown-debug .
docker run -p 8081:8081 pactown-debugOpen http://localhost:8081 in your browser.
# Requirements: Python 3.10+ and ShellCheck
sudo apt-get install shellcheck # Ubuntu/Debian
brew install shellcheck # macOS
# Clone and run
git clone https://github.com/wronai/pactown-debug.git
cd pactown-debug
pip install -r requirements.txt
python3 server.py- Paste your code - Insert your script in the left panel
- Automatic analysis - Errors are detected in real-time
- View fixes - Right panel shows corrected code with explanations
- Export - Download or copy the fixed script
Input (with errors):
#!/usr/bin/bash
OUTPUT=/home/student/output-
for HOST in server{a,b}; do
echo "$(ssh student@${HOST} hostname -f") >> ${OUTPUT}${HOST}
if test -f $OUTPUT/$HOST; then
rm -v $OUTPUT/$HOST
fi
doneOutput (fixed):
#!/usr/bin/bash
OUTPUT=/home/student/output-
for HOST in server{a,b}; do
echo "$(ssh student@${HOST} hostname -f)" >> ${OUTPUT}${HOST} # β
NAPRAWIONO: Poprawiono pozycjΔ cudzysΕowu zamykajΔ
cego
if test -f ${OUTPUT}/${HOST}; then # β
NAPRAWIONO: Dodano klamerki do zmiennych
rm -v ${OUTPUT}/${HOST} # β
NAPRAWIONO: Dodano klamerki do zmiennych
fi || exit 1 # β
NAPRAWIONO: Dodano obsΕugΔ bΕΔdΓ³w dla rm
done || exit 1 # β
NAPRAWIONO: Dodano obsΕugΔ bΕΔdΓ³w dla for loopInput (with issues):
#!/usr/bin/env python3
import os
import sys
def process_data(items=[]):
for item in items:
if item == None:
print "Item is None"
continue
try:
result = item * 2
except:
print "Error processing item"
return items
if __name__ == "__main__":
data = [1, 2, None, 4]
process_data(data)Output (fixed):
#!/usr/bin/env python3
import os
import sys
def process_data(items=None): # β
NAPRAWIONO: Unikaj mutable default arguments
if items is None:
items = []
for item in items:
if item is None: # β
NAPRAWIONO: UΕΌyj 'is None' zamiast '== None'
print("Item is None") # β
NAPRAWIONO: UΕΌyj print() z nawiasami (Python 3)
continue
try:
result = item * 2
except Exception as e: # β
NAPRAWIONO: Unikaj bare except, Εap konkretny wyjΔ
tek
print(f"Error processing item: {e}") # β
NAPRAWIONO: UΕΌyj f-string i print()
return items
if __name__ == "__main__":
data = [1, 2, None, 4]
process_data(data) # β
NAPRAWIONO: Dodano docstring do funkcjiInput (with issues):
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y python3
COPY . /app
WORKDIR /app
CMD python3 app.pyOutput (fixed):
FROM ubuntu:latest # β
NAPRAWIONO: UΕΌyj konkretnego tagu zamiast latest
RUN apt-get update && apt-get install -y python3 && rm -rf /var/lib/apt/lists/* # β
NAPRAWIONO: PoΕΔ
cz RUN i wyczyΕΔ cache
COPY . /app
WORKDIR /app
CMD ["python3", "app.py"] # β
NAPRAWIONO: UΕΌyj exec formPactown Live Debug supports 24+ languages and formats:
| Language | Status | Example |
|---|---|---|
| Bash/Shell | β Full | #!/bin/bash |
| Python | β Full | def hello(): |
| JavaScript | β Full | console.log() |
| Dockerfile | β Full | FROM node:18 |
| Docker Compose | β Full | version: '3.8' |
| Kubernetes YAML | β Full | apiVersion: v1 |
| Terraform | β Full | resource "aws_instance" |
| SQL | β Full | SELECT * FROM |
| Nginx Config | β Full | server { ... } |
| GitHub Actions | β Full | on: [push] |
| GitLab CI | β New | stages: ... |
| Jenkinsfile | β New | pipeline { ... } |
| Ansible | β Full | ---\n- hosts: |
| Markdown | β Full | ``` fenced blocks |
| JSON | β Full | { "key": "value" } |
| TOML | β Full | [section] |
| INI | β Full | key=value |
| And more... | π§ In Progress | PHP, Go, Rust, Java |
| Code | Description | Example |
|---|---|---|
| SC1073 | Syntax errors - misplaced quotes, brackets | echo "$(cmd") |
| SC2086 | Unquoted variables | echo $VAR |
| SC2006 | Use backticks instead of $() | cmd |
| SC2164 | cd without error handling | cd /path |
| SC2162 | read without -r flag | read var |
| Code | Description | Example |
|---|---|---|
| PY001 | Use print() without parentheses | print "text" |
| PY002 | Mutable default arguments | def func(items=[]): |
| PY003 | Use == None instead of is None | if x == None: |
| PY004 | Bare except clause | except: |
| PY005 | Missing docstring | def func(): |
| Code | Description | Example |
|---|---|---|
| DF001 | Use 'latest' tag | FROM ubuntu:latest |
| DF002 | Multiple RUN instructions | RUN apt-get update\nRUN apt-get install |
| DF003 | Missing cache cleanup | RUN apt-get update |
| DF004 | Use shell form of CMD | CMD python app.py |
Analyzes code and returns fixes for detected issues.
Request:
{
"code": "#!/bin/bash\necho $VAR",
"language": "bash" // optional, auto-detected if not provided
}Response:
{
"originalCode": "#!/bin/bash\necho $VAR",
"fixedCode": "#!/bin/bash\necho \"$VAR\"",
"errors": [],
"warnings": [
{
"line": 2,
"column": 6,
"code": "SC2086",
"message": "Double quote to prevent globbing and word splitting",
"severity": "warning"
}
],
"fixes": [
{
"line": 2,
"message": "Dodano cudzysΕowy wokΓ³Ε zmiennej",
"before": "echo $VAR",
"after": "echo \"$VAR\""
}
],
"language": "bash",
"context": {}
}Health check endpoint.
Response:
{
"status": "healthy",
"version": "1.2.0",
"features": {
"shellcheck": false,
"bash_analysis": true,
"python_analysis": true,
"auto_fix": true,
"pactfix_api": false,
"pactfix_url": "http://pactfix-api:5000"
}
}Save or update a code snippet.
Request:
{
"code": "#!/bin/bash\necho hello",
"mode": "code"
}Response:
{
"id": "abc123def456",
"url": "http://localhost:8081/#abc123def456"
}The project includes the pactfix CLI tool for analyzing and auto-fixing code in multiple languages.
- Project-wide scanning (
--path) - Analyze entire projects - Docker sandbox (
--sandbox) - Test fixes in containers - Automated testing (
--test) - Run tests in sandbox - Multi-language support - Bash, Python, Go, Node.js, Dockerfile, and more
# Analyze and fix entire project
pactfix --path ./my-project
# Run with Docker sandbox
pactfix --path ./my-project --sandbox
# Sandbox with tests
pactfix --path ./my-project --sandbox --test
# Insert comments above fixes
pactfix --path ./my-project --comment
# Fix specific file
pactfix --file script.sh
# List supported languages
pactfix --list-languagesThe project includes test projects in pactfix-py/test-projects/:
# Run sandbox tests
make test-sandbox
# Run with in-container tests
make test-sandbox-testsEach test project has _fixtures/faulty/ with baseline code for deterministic testing.
pactown-debug/
βββ app/ # Frontend application
β βββ index.html # Main UI
β βββ assets/ # Static assets
βββ server.py # Python backend server
βββ pactfix-py/ # Pactfix CLI tool
β βββ pactfix/ # Main package
β β βββ analyzer.py # Core analysis engine
β β βββ analyzers/ # Language-specific analyzers
β β βββ cli.py # CLI interface
β βββ test-projects/ # Test projects with fixtures
β β βββ bash-project/
β β βββ python-project/
β β βββ ...
β βββ scripts/ # Test scripts
βββ tests/ # Backend tests
βββ e2e/ # E2E tests (Playwright)
βββ Dockerfile # Container definition
βββ docker-compose.yml # Docker Compose config
βββ Makefile # Build and test targets
βββ playwright.config.ts # Playwright configuration
βββ requirements.txt # Python dependencies
βββ README.md # This file
# Run all tests
make test
# Backend tests
make test-backend
# Pactfix CLI tests
make test-pactfix
# E2E tests
make test-frontend
# Sandbox tests
make test-sandbox
# Sandbox with in-container tests
make test-sandbox-tests- Backend: 8 tests covering API endpoints
- Pactfix CLI: 202 tests covering all analyzers
- E2E: 41 tests covering UI interactions
- Sandbox: Multiple real-world project scenarios
- Frontend: Vanilla JavaScript, CSS Grid, CSS Variables
- Backend: Python 3.10+, http.server
- Analysis: ShellCheck (with fallback to built-in analysis)
- Testing: Playwright (E2E), pytest (CLI), unittest (Backend)
- Container: Docker, Alpine-based
- Support for Python/Node.js/Go/Dockerfile
- GitLab CI and Jenkinsfile support
- AI-powered explanations (llama.cpp)
- Collaborative debugging sessions
- VSCode extension
- More auto-fix rules
- Real-time collaboration
- Code snippet library
- Integration with GitHub PRs
We welcome contributions! Here's how to get started:
-
Fork the repository
git clone https://github.com/your-username/pactown-debug.git
-
Create a feature branch
git checkout -b feature/amazing-feature
-
Make your changes
- Add tests for new features
- Follow the existing code style
- Update documentation
-
Run tests
make test -
Commit your changes
git commit -m 'Add amazing feature' -
Push to branch
git push origin feature/amazing-feature
-
Open a Pull Request
- Describe your changes clearly
- Link any relevant issues
- Ensure CI passes
# Clone the repo
git clone https://github.com/wronai/pactown-debug.git
cd pactown-debug
# Install dependencies
pip install -r requirements.txt
cd pactfix-py && pip install -e .[dev] && cd ..
# Install playwright browsers
npx playwright install
# Run development server
python3 server.py
# Run tests in watch mode
make test-frontend # E2E tests
make test-pactfix # CLI testsApache 2.0 License - Softreck Β© 2026