Skip to content

IMPHNEN/malaz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Malaz - AI Coding Agent πŸ€–

Python OpenAI License CI Release

Malaz adalah AI coding assistant yang powerful, dirancang untuk membantu developer dalam berbagai tugas pengembangan software termasuk code generation, debugging, refactoring, dan project management.

✨ Features

  • πŸ”§ Tool Integration: Built-in tools untuk file management, code analysis, dan shell execution
  • 🧠 Smart Code Analysis: Analisis struktur code dan dependencies secara otomatis
  • πŸ› οΈ Project Scaffolding: Template untuk berbagai jenis project (Flask, CLI, Data Analysis)
  • πŸ” Code Search: Pencarian pattern dalam codebase menggunakan regex
  • πŸ“ Code Review: Review code otomatis dengan saran improvement
  • πŸ› Auto Debug: Analisis error trace dan saran solusi
  • πŸ”„ Version Control: Integrasi dengan Git untuk commit otomatis
  • πŸ’¬ Interactive Mode: CLI interaktif dengan session memory
  • πŸ” Security: Built-in security validation untuk operasi file

πŸ“¦ Installation

Download Pre-built Binaries (Recommended)

Download the latest release untuk platform Anda:

Installation Steps:

Windows:

  1. Download malaz-windows-*.zip
  2. Extract archive
  3. Run install.bat as Administrator
  4. Restart Command Prompt/PowerShell
  5. Use: malaz --help

Linux/macOS:

  1. Download file .tar.gz yang sesuai
  2. Extract: tar -xzf malaz-*.tar.gz
  3. Run: ./install.sh
  4. Restart terminal atau run: source ~/.bashrc
  5. Use: malaz --help

Development Installation

Untuk development atau jika ingin build dari source:

  1. Clone repository:
git clone <repository-url>
cd malaz
  1. Install dependencies:
pip install -r requirements.txt
  1. Setup environment:
cp .env.example .env
# Edit .env dan masukkan OpenAI API key Anda
  1. Run Malaz:
# Interactive mode
python malaz_cli.py

# Direct command
python malaz_cli.py "create a simple Python calculator"

# Show help
python malaz_cli.py --help

Build dari Source

Untuk build executable sendiri:

# Install build dependencies
pip install pyinstaller

# Build untuk platform saat ini
python scripts/build.py

# Build dengan clean
python scripts/build.py --clean

# Build dengan version custom
python scripts/build.py --version "1.0.0-custom"

πŸ“– Usage

Interactive Mode

Jalankan Malaz dalam mode interaktif:

python malaz_cli.py

Mode interaktif menyediakan:

  • Session memory untuk konteks percakapan
  • Built-in commands dengan prefix /
  • Special commands dengan prefix !

Direct Command Mode

Eksekusi command langsung:

python malaz_cli.py "analyze the code structure of this project"
python malaz_cli.py "create a Flask web app with user authentication"
python malaz_cli.py "debug this error: AttributeError in line 45"

Built-in Commands

Command Description
/help Tampilkan bantuan
/tools List available tools
/context Show project context
/history Show conversation history
/reset Reset session memory
/state Show current project state
/exit Keluar dari program

Special Commands

Command Description
!review <file> Review code file
!debug <trace> Debug error trace
!commit [message] Commit changes to Git

πŸ“š Documentation

Untuk panduan lengkap dan referensi API, kunjungi Malaz Documentation:

πŸ› οΈ Available Tools

Malaz dilengkapi dengan 9 built-in tools:

  1. create_file - Create file baru dengan content
  2. modify_file - Modify file menggunakan diff patches
  3. run_shell - Execute shell command
  4. search_code - Search pattern dalam codebase
  5. analyze_code - Analisis struktur code dan dependencies
  6. scaffold_project - Create project dari template
  7. code_review - Perform code review
  8. auto_debug - Analisis error trace
  9. vcs_commit - Commit changes ke version control

πŸ“ Project Structure

malaz/
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ agent.py           # Main AI agent class
β”‚   β”œβ”€β”€ tool_manager.py    # Tool management system
β”‚   β”œβ”€β”€ memory.py          # Session memory management
β”‚   β”œβ”€β”€ scaffold.py        # Project scaffolding
β”‚   β”œβ”€β”€ debugger.py        # Auto debugging system
β”‚   └── vcs_integration.py # Version control integration
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ file_utils.py      # File operations utilities
β”‚   β”œβ”€β”€ security.py        # Security validation
β”‚   └── review_assistant.py # Code review assistant
β”œβ”€β”€ malaz_cli.py           # Main CLI interface
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ .env                   # Environment configuration
└── README.md             # Documentation

βš™οΈ Configuration

Edit file .env untuk konfigurasi:

# Required
OPENAI_API_KEY=your_openai_api_key_here

# Optional
MALAZ_MODEL=gpt-4o-mini  # Default model to use

Supported Models

  • gpt-4o-mini (default, cost-effective)
  • gpt-4o
  • gpt-4-turbo
  • gpt-3.5-turbo

πŸ“‹ Examples

1. Create New Project

python malaz_cli.py "create a Flask web application with user authentication and database integration"

2. Code Analysis

python malaz_cli.py "analyze the security vulnerabilities in my authentication module"

3. Debug Assistance

python malaz_cli.py "!debug 'TypeError: unsupported operand type(s) for +: 'int' and 'str' at line 42'"

4. Code Review

python malaz_cli.py "!review app.py"

5. Interactive Development

python malaz_cli.py
malaz> create a REST API for user management
malaz> add input validation to the endpoints
malaz> write unit tests for the API
malaz> /exit

πŸ”§ Development

CI/CD Pipeline

Project ini menggunakan GitHub Actions untuk automated testing dan releases:

  • Continuous Integration: Test otomatis pada Python 3.8-3.11 di Windows, Linux, dan macOS
  • Security Scanning: Automated security checks dengan bandit dan safety
  • Code Quality: Linting dengan flake8, formatting dengan black, type checking dengan mypy
  • Automated Releases: Build dan release otomatis untuk semua platform saat merge ke branch release

Release Process

  1. Development: Work pada branch feature/* atau develop
  2. Testing: CI pipeline akan run test otomatis
  3. Release: Merge ke branch release akan trigger:
    • Build executable untuk Windows, Linux, macOS
    • Create GitHub release dengan versioning otomatis
    • Upload binaries sebagai release assets

Branch Strategy

  • main: Stable production code
  • develop: Development integration branch
  • feature/*: Feature development branches
  • release: Release trigger branch

Adding Custom Tools

Extend ToolManager class di core/tool_manager.py:

def your_custom_tool(self, param1, param2):
    """Your custom tool implementation"""
    # Implementation here
    return "Tool result"

Update tool definitions dalam _get_builtin_tools() method.

Adding Project Templates

Edit core/scaffold.py untuk menambah template baru:

"your_template": {
    "description": "Your template description",
    "structure": {
        "file1.py": "file content",
        "folder/": None,
        # ... more files
    }
}

🚦 Troubleshooting

Common Issues

  1. OpenAI API Error

    • Pastikan API key valid di .env
    • Check quota/billing di OpenAI dashboard
  2. Tool Execution Failed

    • Verify file permissions
    • Check security validation dalam utils/security.py
  3. Module Import Error

    • Pastikan semua dependencies terinstall
    • Run pip install -r requirements.txt
  4. Executable Issues

    • Download ulang dari releases page
    • Pastikan executable memiliki permission yang benar
    • Check antivirus software yang mungkin block executable

Debug Mode

Enable verbose logging:

export MALAZ_DEBUG=1
python malaz_cli.py

Atau untuk pre-built executable:

export MALAZ_DEBUG=1
malaz

πŸ—οΈ Build Status

Platform Status Latest Release
Windows Windows Download
Linux Linux Download
macOS macOS Download

🀝 Contributing

  1. Fork repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push branch (git push origin feature/amazing-feature)
  5. Open Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • OpenAI untuk GPT API
  • Rich library untuk beautiful CLI output
  • Python community untuk ecosystem yang luar biasa

πŸ“ž Support

Jika ada pertanyaan atau issue:

  1. Check troubleshooting section
  2. Search existing issues
  3. Create new issue dengan detail lengkap
  4. Join komunitas developer untuk diskusi

Happy Coding with Malaz! πŸš€

About

AI Agent Coding: Malaz Edition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages